mpeg4probe patch by (Thijs Vermeir ; thijs vermeir barco com)

tabs removed by me
VOL vs. VOP check fixed by me

Originally committed as revision 6940 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Thijs Vermeir 18 years ago committed by Michael Niedermayer
parent 79e5a53c0a
commit 8f57cc5a32
  1. 32
      libavformat/raw.c

@ -346,6 +346,36 @@ 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 i;
for(i=0; i<probe_packet->buf_size; i++){
temp_buffer = (temp_buffer<<8) + probe_packet->buf[i];
if ((temp_buffer & 0xffffff00) == 0x100) {
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;
}
}
}
if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0)
return AVPROBE_SCORE_MAX/2;
return 0;
}
static int h263_probe(AVProbeData *p)
{
int code;
@ -523,7 +553,7 @@ AVInputFormat m4v_demuxer = {
"m4v",
"raw MPEG4 video format",
0,
NULL /*mpegvideo_probe*/,
mpeg4video_probe, /** probing for mpeg4 data */
video_read_header,
raw_read_partial_packet,
raw_read_close,

Loading…
Cancel
Save