Commit a1c69e0b authored by Michael Niedermayer's avatar Michael Niedermayer

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
parent 652c59b9
......@@ -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; i<p->buf_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 */
return AVPROBE_SCORE_MAX/2+2;
if(vid || audio) /* invalid VDR files */
if((!!vid ^ !!audio) && (audio+vid > 1) && !sys && !pspack) /* PES stream */
return AVPROBE_SCORE_MAX/2+2;
return 0;
//02-Penguin.flac has sys:0 priv1:0 pspack:0 vid:0 audio:1
return score;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment