00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "avformat.h"
00023 #include "rawdec.h"
00024
00025 #define VISUAL_OBJECT_START_CODE 0x000001b5
00026 #define VOP_START_CODE 0x000001b6
00027
00028 static int mpeg4video_probe(AVProbeData *probe_packet)
00029 {
00030 uint32_t temp_buffer= -1;
00031 int VO=0, VOL=0, VOP = 0, VISO = 0, res=0;
00032 int i;
00033
00034 for(i=0; i<probe_packet->buf_size; i++){
00035 temp_buffer = (temp_buffer<<8) + probe_packet->buf[i];
00036 if ((temp_buffer & 0xffffff00) != 0x100)
00037 continue;
00038
00039 if (temp_buffer == VOP_START_CODE) VOP++;
00040 else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++;
00041 else if (temp_buffer < 0x120) VO++;
00042 else if (temp_buffer < 0x130) VOL++;
00043 else if ( !(0x1AF < temp_buffer && temp_buffer < 0x1B7)
00044 && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++;
00045 }
00046
00047 if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0)
00048 return VOP+VO > 3 ? AVPROBE_SCORE_MAX/2 : AVPROBE_SCORE_MAX/4;
00049 return 0;
00050 }
00051
00052 FF_DEF_RAWVIDEO_DEMUXER(m4v, "raw MPEG-4 video", mpeg4video_probe, "m4v", AV_CODEC_ID_MPEG4)