From 05b001ab8dacfd37561d50310695169ee6ea3446 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 25 Jul 2016 16:20:50 +0200 Subject: cfhd: set the dimensions/pixel format unconditionally for each frame --- libavcodec/cfhd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 9ab9304f90..ce57ac2da6 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -176,13 +176,6 @@ static int alloc_buffers(CFHDContext *s) int chroma_x_shift, chroma_y_shift; unsigned k; - if ((ret = ff_set_dimensions(s->avctx, s->coded_width, s->coded_height)) < 0) - return ret; - if (s->cropped_height) - s->avctx->height = s->cropped_height; - - s->avctx->pix_fmt = s->coded_format; - if ((ret = av_pix_fmt_get_chroma_sub_sample(s->coded_format, &chroma_x_shift, &chroma_y_shift)) < 0) @@ -709,6 +702,14 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_INVALIDDATA; } + ret = ff_set_dimensions(s->avctx, s->coded_width, s->coded_height); + if (ret < 0) + return ret; + if (s->cropped_height) + s->avctx->height = s->cropped_height; + + s->avctx->pix_fmt = s->coded_format; + if (s->a_width != s->coded_width || s->a_height != s->coded_height || s->a_format != s->coded_format) { free_buffers(s); -- cgit v1.2.3