diff options
author | Alex Converse <alex.converse@gmail.com> | 2009-01-19 21:54:06 +0000 |
---|---|---|
committer | Alex Converse <alex.converse@gmail.com> | 2009-01-19 21:54:06 +0000 |
commit | ac3ef4a41b6de8bd0309fe166bb4c544f3d719be (patch) | |
tree | 709028defcbd2cfe5c1184fae3778d5a8c3512ae /libavformat/mp3.c | |
parent | 2f642393381659f4a198d9c5a96896eebb23de18 (diff) | |
download | ffmpeg-ac3ef4a41b6de8bd0309fe166bb4c544f3d719be.tar.gz |
Fix probing of files with ID3v2 tags. Discussed at
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-January/059302.html
Originally committed as revision 16688 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mp3.c')
-rw-r--r-- | libavformat/mp3.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavformat/mp3.c b/libavformat/mp3.c index 1a3c5e23cf..ec8c0bb997 100644 --- a/libavformat/mp3.c +++ b/libavformat/mp3.c @@ -354,14 +354,16 @@ static int mp3_read_probe(AVProbeData *p) int max_frames, first_frames = 0; int fsize, frames, sample_rate; uint32_t header; - uint8_t *buf, *buf2, *end; + uint8_t *buf, *buf0, *buf2, *end; AVCodecContext avctx; - if(ff_id3v2_match(p->buf)) - return AVPROBE_SCORE_MAX/2+1; // this must be less than mpeg-ps because some retards put id3v2 tags before mpeg-ps files + buf0 = p->buf; + if(ff_id3v2_match(buf0)) { + buf0 += ff_id3v2_tag_len(buf0); + } max_frames = 0; - buf = p->buf; + buf = buf0; end = buf + p->buf_size - sizeof(uint32_t); for(; buf < end; buf= buf2+1) { @@ -375,7 +377,7 @@ static int mp3_read_probe(AVProbeData *p) buf2 += fsize; } max_frames = FFMAX(max_frames, frames); - if(buf == p->buf) + if(buf == buf0) first_frames= frames; } if (first_frames>=3) return AVPROBE_SCORE_MAX/2+1; |