diff options
author | Mark Reid <mindmark@gmail.com> | 2016-02-13 21:44:32 -0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-02-14 19:17:36 +0100 |
commit | 8395b6eeaa279cff5c1c5d2b2ddfd5be087ca3ee (patch) | |
tree | 1b5834e1adcacc81f73f312ed413bcb72076a3e6 /libavcodec/dnxhddec.c | |
parent | b8bc6b14a556e11e3f6cb49ead9d21d9a769b7c8 (diff) | |
download | ffmpeg-streaming-8395b6eeaa279cff5c1c5d2b2ddfd5be087ca3ee.zip ffmpeg-streaming-8395b6eeaa279cff5c1c5d2b2ddfd5be087ca3ee.tar.gz |
libavcodec/dnxhd_parser: add parser and probe support raw 444 and dnxhr formats
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dnxhddec.c')
-rw-r--r-- | libavcodec/dnxhddec.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 5c09c64..1808080 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -163,21 +163,17 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, const uint8_t *buf, int buf_size, int first_field) { - static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 }; - static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 }; - static const uint8_t header_prefixhr1[] = { 0x00, 0x00, 0x02, 0x80, 0x03 }; - static const uint8_t header_prefixhr2[] = { 0x00, 0x00, 0x03, 0x8C, 0x03 }; int i, cid, ret; int old_bit_depth = ctx->bit_depth, bitdepth; - + uint64_t header_prefix; if (buf_size < 0x280) { av_log(ctx->avctx, AV_LOG_ERROR, "buffer too small (%d < 640).\n", buf_size); return AVERROR_INVALIDDATA; } - if (memcmp(buf, header_prefix, 5) && memcmp(buf, header_prefix444, 5) && - memcmp(buf, header_prefixhr1, 5) && memcmp(buf, header_prefixhr2, 5)) { + header_prefix = avpriv_dnxhd_parse_header_prefix(buf); + if (header_prefix == 0) { av_log(ctx->avctx, AV_LOG_ERROR, "unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n", buf[0], buf[1], buf[2], buf[3], buf[4]); @@ -279,7 +275,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, ctx->bit_depth, ctx->mbaff, ctx->act); // Newer format supports variable mb_scan_index sizes - if (!memcmp(buf, header_prefixhr2, 5)) { + if (header_prefix == DNXHD_HEADER_HR2) { ctx->data_offset = 0x170 + (ctx->mb_height << 2); } else { if (ctx->mb_height > 68 || |