Mercurial > libavformat.hg
diff mp3.c @ 4254:d05b13327b07 libavformat
Fix probing of files with ID3v2 tags. Discussed at
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-January/059302.html
author | alexc |
---|---|
date | Mon, 19 Jan 2009 21:54:06 +0000 |
parents | 77e0c7511d41 |
children | 35c8abd32d93 |
line wrap: on
line diff
--- a/mp3.c Mon Jan 19 17:01:22 2009 +0000 +++ b/mp3.c Mon Jan 19 21:54:06 2009 +0000 @@ -354,14 +354,16 @@ 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 @@ 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;