3 * Copyright (c) 2015 Carl Eugen Hoyos
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "libavutil/intreadwrite.h"
25 #include "libavcodec/vc1_common.h"
27 static int vc1_probe(AVProbeData
*p
)
29 int seq
= 0, entry
= 0, frame
= 0, i
;
31 for (i
= 0; i
< p
->buf_size
+ 5; i
++) {
32 uint32_t code
= AV_RB32(p
->buf
+ i
);
33 if ((code
& 0xffffffe0) == 0x100) {
34 int type
= code
& 0x11f;
37 case VC1_CODE_SEQHDR
: {
38 int profile
, level
, chromaformat
;
39 profile
= (p
->buf
[i
] & 0xc0) >> 6;
40 if (profile
!= PROFILE_ADVANCED
) {
44 level
= (p
->buf
[i
] & 0x38) >> 3;
49 chromaformat
= (p
->buf
[i
] & 0x6) >> 1;
50 if (chromaformat
!= 1) {
58 case VC1_CODE_ENTRYPOINT
:
75 return AVPROBE_SCORE_EXTENSION
/ 2 + 1;
77 return AVPROBE_SCORE_EXTENSION
/ 4;
81 FF_DEF_RAWVIDEO_DEMUXER2(vc1
, "raw VC-1", vc1_probe
, "vc1", AV_CODEC_ID_VC1
, AVFMT_GENERIC_INDEX
|AVFMT_NOTIMESTAMPS
)