mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
make mpeg-ps probe less happy with random data
fixes missdetection of O-MP3-5.mp3 Originally committed as revision 11149 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
2db971135a
commit
7e1720dec6
@ -67,7 +67,7 @@ static int check_pes(uint8_t *p, uint8_t *end){
|
|||||||
static int mpegps_probe(AVProbeData *p)
|
static int mpegps_probe(AVProbeData *p)
|
||||||
{
|
{
|
||||||
uint32_t code= -1;
|
uint32_t code= -1;
|
||||||
int sys=0, pspack=0, priv1=0, vid=0, audio=0;
|
int sys=0, pspack=0, priv1=0, vid=0, audio=0, invalid=0;
|
||||||
int i;
|
int i;
|
||||||
int score=0;
|
int score=0;
|
||||||
|
|
||||||
@ -85,16 +85,19 @@ static int mpegps_probe(AVProbeData *p)
|
|||||||
else if(code == PACK_START_CODE) pspack++;
|
else if(code == PACK_START_CODE) pspack++;
|
||||||
else if((code & 0xf0) == VIDEO_ID && pes) vid++;
|
else if((code & 0xf0) == VIDEO_ID && pes) vid++;
|
||||||
else if((code & 0xe0) == AUDIO_ID && pes) audio++;
|
else if((code & 0xe0) == AUDIO_ID && pes) audio++;
|
||||||
|
|
||||||
|
else if((code & 0xf0) == VIDEO_ID && !pes) invalid++;
|
||||||
|
else if((code & 0xe0) == AUDIO_ID && !pes) invalid++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vid || audio) /* invalid VDR files nd short PES streams */
|
if(vid+audio > invalid) /* invalid VDR files nd short PES streams */
|
||||||
score= AVPROBE_SCORE_MAX/4;
|
score= AVPROBE_SCORE_MAX/4;
|
||||||
|
|
||||||
//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d len:%d\n", sys, priv1, pspack,vid, audio, p->buf_size);
|
//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d len:%d\n", sys, priv1, pspack,vid, audio, p->buf_size);
|
||||||
if(sys && sys*9 <= pspack*10)
|
if(sys>invalid && sys*9 <= pspack*10)
|
||||||
return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg
|
return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg
|
||||||
if((priv1 || vid || audio) && (priv1+vid+audio)*9 <= pspack*10)
|
if(priv1 + vid + audio > invalid && (priv1+vid+audio)*9 <= pspack*10)
|
||||||
return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg
|
return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg
|
||||||
if((!!vid ^ !!audio) && (audio+vid > 1) && !sys && !pspack && p->buf_size>2048) /* PES stream */
|
if((!!vid ^ !!audio) && (audio+vid > 1) && !sys && !pspack && p->buf_size>2048) /* PES stream */
|
||||||
return AVPROBE_SCORE_MAX/2+2;
|
return AVPROBE_SCORE_MAX/2+2;
|
||||||
|
Loading…
Reference in New Issue
Block a user