diff options
author | Måns Rullgård <mans@mansr.com> | 2006-06-29 19:03:53 +0000 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2006-06-29 19:03:53 +0000 |
commit | 25c533a2c220e7657477605e8f34e2bd94fe0375 (patch) | |
tree | 878daa23699e56299590b7e1a1f919747fbddf0c | |
parent | 344a18c3b8b783756b209e515e004bb21b03c7a4 (diff) | |
download | ffmpeg-25c533a2c220e7657477605e8f34e2bd94fe0375.tar.gz |
detect audio-only program streams and broken files made by VDR
Originally committed as revision 5546 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/mpeg.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 8c8a24284f..eca8bff511 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -1269,21 +1269,21 @@ static int mpegps_probe(AVProbeData *p) for(i=0; i<p->buf_size; i++){ code = (code<<8) + p->buf[i]; if ((code & 0xffffff00) == 0x100) { - switch(code){ - case SYSTEM_HEADER_START_CODE: sys++; break; - case PRIVATE_STREAM_1: priv1++; break; - case PACK_START_CODE: pspack++; break; - case (VIDEO_ID + 0x100): vid++; break; - case (AUDIO_ID + 0x100): audio++; break; - } + 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++; } } if(sys && sys*9 <= pspack*10) return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg - if((priv1 || vid) && (priv1+vid)*9 <= pspack*10) + 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; + return AVPROBE_SCORE_MAX/2+2; + if(vid || audio) /* invalid VDR files */ + return AVPROBE_SCORE_MAX/2+2; return 0; } |