00001 /* 00002 * RAW DNxHD (SMPTE VC-3) demuxer 00003 * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier@gmail.com> 00004 * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de> 00005 * 00006 * This file is part of FFmpeg. 00007 * 00008 * FFmpeg is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * FFmpeg is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with FFmpeg; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #include "libavutil/intreadwrite.h" 00024 #include "avformat.h" 00025 #include "rawdec.h" 00026 00027 static int dnxhd_probe(AVProbeData *p) 00028 { 00029 static const uint8_t header[] = {0x00,0x00,0x02,0x80,0x01}; 00030 int w, h, compression_id; 00031 if (p->buf_size < 0x2c) 00032 return 0; 00033 if (memcmp(p->buf, header, 5)) 00034 return 0; 00035 h = AV_RB16(p->buf + 0x18); 00036 w = AV_RB16(p->buf + 0x1a); 00037 if (!w || !h) 00038 return 0; 00039 compression_id = AV_RB32(p->buf + 0x28); 00040 if (compression_id < 1237 || compression_id > 1253) 00041 return 0; 00042 return AVPROBE_SCORE_MAX; 00043 } 00044 00045 FF_DEF_RAWVIDEO_DEMUXER(dnxhd, "raw DNxHD (SMPTE VC-3)", dnxhd_probe, NULL, AV_CODEC_ID_DNXHD)