[FFmpeg-cvslog] lavc/dnxhd: Fix pix_fmt change.

Carl Eugen Hoyos git at videolan.org
Sat Mar 28 19:52:01 CET 2015


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Sat Mar 28 17:36:02 2015 +0100| [dcac15a84c8fc087ec85b2172db13d2e0d543e50] | committer: Carl Eugen Hoyos

lavc/dnxhd: Fix pix_fmt change.

Fixes ticket #4400.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dcac15a84c8fc087ec85b2172db13d2e0d543e50
---

 libavcodec/dnxhddec.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index cc011c4..053bf1c 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -119,6 +119,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
     static const uint8_t header_prefix[]    = { 0x00, 0x00, 0x02, 0x80, 0x01 };
     static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 };
     int i, cid, ret;
+    int old_bit_depth = ctx->bit_depth;
 
     if (buf_size < 0x280) {
         av_log(ctx->avctx, AV_LOG_ERROR, "buffer too small (%d < 640).\n",
@@ -145,10 +146,6 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
 
     av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
 
-    if (!ctx->bit_depth) {
-        ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
-        ff_idctdsp_init(&ctx->idsp, ctx->avctx);
-    }
     if (buf[0x21] == 0x58) { /* 10 bit */
         ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 10;
 
@@ -172,6 +169,10 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
                buf[0x21]);
         return AVERROR_INVALIDDATA;
     }
+    if (ctx->bit_depth != old_bit_depth) {
+        ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
+        ff_idctdsp_init(&ctx->idsp, ctx->avctx);
+    }
 
     cid = AV_RB32(buf + 0x28);
     av_dlog(ctx->avctx, "compression id %d\n", cid);



More information about the ffmpeg-cvslog mailing list