Libav 0.7.1
|
00001 /* 00002 * RAW MPEG-4 video demuxer 00003 * Copyright (c) 2006 Thijs Vermeir <thijs.vermeir@barco.com> 00004 * 00005 * This file is part of Libav. 00006 * 00007 * Libav is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * Libav is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with Libav; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 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 AVPROBE_SCORE_MAX/2; 00049 return 0; 00050 } 00051 00052 FF_DEF_RAWVIDEO_DEMUXER(m4v, "raw MPEG-4 video format", mpeg4video_probe, "m4v", CODEC_ID_MPEG4)