diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index 6d8291e514..9ef216fd69 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -263,12 +263,11 @@ static int decode_frame(AVCodecContext *avctx, } if (avctx->width != width || avctx->height != height) { + av_frame_unref(&s->last_frame); if((width * height)/2048*7 > buf_end-buf) return AVERROR_INVALIDDATA; - if ((ret = av_image_check_size(width, height, 0, avctx)) < 0) + if ((ret = ff_set_dimensions(avctx, width, height)) < 0) return ret; - avcodec_set_dimensions(avctx, width, height); - av_frame_unref(&s->last_frame); } if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c index a24550b795..2950d055d7 100644 --- a/libavcodec/eatgq.c +++ b/libavcodec/eatgq.c @@ -219,9 +219,10 @@ static int tgq_decode_frame(AVCodecContext *avctx, s->height = bytestream2_get_le16u(&s->gb); } - if (s->avctx->width!=s->width || s->avctx->height!=s->height) { - avcodec_set_dimensions(s->avctx, s->width, s->height); - } + ret = ff_set_dimensions(s->avctx, s->width, s->height); + if (ret < 0) + return ret; + tgq_calculate_qtable(s, bytestream2_get_byteu(&s->gb)); bytestream2_skip(&s->gb, 3); diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index bfdfb76b9b..6664cdb0f4 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -281,9 +281,10 @@ static int tgv_decode_frame(AVCodecContext *avctx, s->width = AV_RL16(&buf[0]); s->height = AV_RL16(&buf[2]); if (s->avctx->width != s->width || s->avctx->height != s->height) { - avcodec_set_dimensions(s->avctx, s->width, s->height); av_freep(&s->frame_buffer); av_frame_unref(&s->last_frame); + if ((ret = ff_set_dimensions(s->avctx, s->width, s->height)) < 0) + return ret; } pal_count = AV_RL16(&buf[6]); @@ -294,9 +295,6 @@ static int tgv_decode_frame(AVCodecContext *avctx, } } - if ((ret = av_image_check_size(s->width, s->height, 0, avctx)) < 0) - return ret; - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c index 262deb1cdd..387456a933 100644 --- a/libavcodec/eatqi.c +++ b/libavcodec/eatqi.c @@ -111,8 +111,9 @@ static int tqi_decode_frame(AVCodecContext *avctx, tqi_calculate_qtable(s, buf[4]); buf += 8; - if (s->avctx->width!=s->width || s->avctx->height!=s->height) - avcodec_set_dimensions(s->avctx, s->width, s->height); + ret = ff_set_dimensions(s->avctx, s->width, s->height); + if (ret < 0) + return ret; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret;