From a1c69e0b5097be8fa76c3882f535c6600b0e56b6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 19 Aug 2006 08:39:00 +0000 Subject: [PATCH] fix probing of 02-Penguin.flac = a single startcode should not override extension based detection Originally committed as revision 6025 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/mpeg.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index d3dd0e02cf..1b77b64afa 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -1265,6 +1265,7 @@ static int mpegps_probe(AVProbeData *p) uint32_t code= -1; int sys=0, pspack=0, priv1=0, vid=0, audio=0; int i; + int score=0; for(i=0; ibuf_size; i++){ code = (code<<8) + p->buf[i]; @@ -1276,15 +1277,20 @@ static int mpegps_probe(AVProbeData *p) else if((code & 0xe0) == AUDIO_ID) audio++; } } + + if(vid || audio) /* invalid VDR files nd short PES streams */ + score= AVPROBE_SCORE_MAX/4; + +//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d\n", sys, priv1, pspack,vid, audio); if(sys && sys*9 <= pspack*10) return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg if((priv1 || vid || audio) && (priv1+vid+audio)*9 <= pspack*10) return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg - if((!!vid ^ !!audio) && !sys && !pspack) /* PES stream */ + if((!!vid ^ !!audio) && (audio+vid > 1) && !sys && !pspack) /* PES stream */ return AVPROBE_SCORE_MAX/2+2; - if(vid || audio) /* invalid VDR files */ - return AVPROBE_SCORE_MAX/2+2; - return 0; + + //02-Penguin.flac has sys:0 priv1:0 pspack:0 vid:0 audio:1 + return score; }