From c6dcd0d7f082ac046612cb4cd561fb51d09ddfb2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 3 Nov 2007 13:48:30 +0000 Subject: [PATCH] fix misdetection of mp3could_not_find_codec_parameters.mp3 Originally committed as revision 10908 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/mpeg.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 0f8270a4fc..a362e29e8b 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -44,6 +44,26 @@ static int cdxa_probe(AVProbeData *p) return 0; } +static int check_pes(uint8_t *p, uint8_t *end){ + int pes1; + int pes2= (p[3] & 0xC0) == 0x80 + && (p[4] & 0xC0) != 0x40 + &&((p[4] & 0xC0) == 0x00 || (p[4]&0xC0)>>2 == (p[6]&0xF0)); + + for(p+=3; pbuf_size; i++){ code = (code<<8) + p->buf[i]; if ((code & 0xffffff00) == 0x100) { + int pes= check_pes(p->buf+i, p->buf+i+p->buf_size); + if(code == SYSTEM_HEADER_START_CODE) sys++; else if(code == PRIVATE_STREAM_1) priv1++; else if(code == PACK_START_CODE) pspack++; - else if((code & 0xf0) == VIDEO_ID) vid++; - else if((code & 0xe0) == AUDIO_ID) audio++; + else if((code & 0xf0) == VIDEO_ID && pes) vid++; + else if((code & 0xe0) == AUDIO_ID && pes) audio++; } }