PR #21557 opened by Jun Zhao (mypopydev)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21557
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21557.patch

Since 33dd3485ba (lavf/format: skip multiple consecutive ID3v2 tags
in probe), av_probe_input_format3() skips all ID3v2 tags before
calling format probes, so mp3_read_probe() will never see ID3v2 data
at the start of the buffer. This makes the ff_id3v2_match check
dead code.

Additionally, the original logic of returning a low score when only
ID3v2 tags were visible was questionable - format.c already handles
this case properly by using file extension matching with appropriate
scores when ID3 tags consume the probe buffer.

Signed-off-by: Jun Zhao <[email protected]>


>From 8d5c9f38d8df0ac9575b3c570ec47e39d20f8234 Mon Sep 17 00:00:00 2001
From: Jun Zhao <[email protected]>
Date: Fri, 23 Jan 2026 16:10:20 +0800
Subject: [PATCH] lavf/mp3dec: remove ID3v2 check in mp3_read_probe

Since 33dd3485ba (lavf/format: skip multiple consecutive ID3v2 tags
in probe), av_probe_input_format3() skips all ID3v2 tags before
calling format probes, so mp3_read_probe() will never see ID3v2 data
at the start of the buffer. This makes the ff_id3v2_match check
dead code.

Additionally, the original logic of returning a low score when only
ID3v2 tags were visible was questionable - format.c already handles
this case properly by using file extension matching with appropriate
scores when ID3 tags consume the probe buffer.

Signed-off-by: Jun Zhao <[email protected]>
---
 libavformat/mp3dec.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 5b153c7c9e..912e5da502 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -122,8 +122,6 @@ static int mp3_read_probe(const AVProbeData *p)
     if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
     else if (max_frames>200 && p->buf_size < 2*max_framesizes)return 
AVPROBE_SCORE_EXTENSION;
     else if (max_frames>=4 && p->buf_size < 2*max_framesizes) return 
AVPROBE_SCORE_EXTENSION / 2;
-    else if (ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 
2*ff_id3v2_tag_len(buf0) >= p->buf_size)
-                           return p->buf_size < PROBE_BUF_MAX ? 
AVPROBE_SCORE_EXTENSION / 4 : AVPROBE_SCORE_EXTENSION - 2;
     else if (first_frames > 1 && whole_used) return 5;
     else if (max_frames>=1 && p->buf_size < 10*max_framesizes) return 1;
     else                   return 0;
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to