# HG changeset patch # User michael # Date 1162948883 0 # Node ID acf4dbb1a7e6e7c328bf617a1769f862cab62189 # Parent e5e2d80a859c7db2789414b4139bd84b553dcf7a mpeg4probe patch by (Thijs Vermeir ; thijs vermeir barco com) tabs removed by me VOL vs. VOP check fixed by me diff -r e5e2d80a859c -r acf4dbb1a7e6 raw.c --- a/raw.c Wed Nov 08 01:15:06 2006 +0000 +++ b/raw.c Wed Nov 08 01:21:23 2006 +0000 @@ -346,6 +346,36 @@ 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; ibuf_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 @@ "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,