diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-05-07 11:57:46 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-05-07 11:57:46 +0000 |
commit | 5fd5d0ef3ad534c0ff7b5ac555a9dc7149e9aa01 (patch) | |
tree | 6ab4042b418442dcffac90a63041ec75d16fa893 | |
parent | f025588bb6008600195184b733800f768ed8e025 (diff) | |
download | ffmpeg-5fd5d0ef3ad534c0ff7b5ac555a9dc7149e9aa01.tar.gz |
improve mpeg4-es detection by rejecting streams with reserved startcodes (fixes 11-i_need_your_love-daw.mp3 detected as mpeg4)
Originally committed as revision 8923 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/raw.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libavformat/raw.c b/libavformat/raw.c index ba3ec235e1..688ad6f46d 100644 --- a/libavformat/raw.c +++ b/libavformat/raw.c @@ -347,15 +347,13 @@ static int mpegvideo_probe(AVProbeData *p) return 0; } -#define VIDEO_OBJECT_START_CODE 0x00000100 -#define VIDEO_OBJECT_LAYER_START_CODE 0x00000120 #define VISUAL_OBJECT_START_CODE 0x000001b5 #define VOP_START_CODE 0x000001b6 static int mpeg4video_probe(AVProbeData *probe_packet) { uint32_t temp_buffer= -1; - int VO=0, VOL=0, VOP = 0, VISO = 0; + int VO=0, VOL=0, VOP = 0, VISO = 0, res=0; int i; for(i=0; i<probe_packet->buf_size; i++){ @@ -364,15 +362,16 @@ static int mpeg4video_probe(AVProbeData *probe_packet) switch(temp_buffer){ case VOP_START_CODE: VOP++; break; case VISUAL_OBJECT_START_CODE: VISO++; break; - } - switch(temp_buffer & 0xfffffff0){ - case VIDEO_OBJECT_START_CODE: VO++; break; - case VIDEO_OBJECT_LAYER_START_CODE: VOL++; break; + case 0x100 ... 0x11F: VO++; break; + case 0x120 ... 0x12F: VOL++; break; + case 0x130 ... 0x1AF: + case 0x1B7 ... 0x1B9: + case 0x1C4 ... 0x1FF: res++; break; } } } - if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0) + if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0) return AVPROBE_SCORE_MAX/2; return 0; } |