diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index b8827634e1..ddb4ad0dee 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -956,7 +956,7 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx, free_frame_buffers(ctx); if ((res = allocate_frame_buffers(ctx, avctx, width, height)) < 0) return res; - avcodec_set_dimensions(avctx, width, height); + ff_set_dimensions(avctx, width, height); } y_offset = bytestream2_get_le32(&gb); diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c index ab4c9958c4..9b5f5f876e 100644 --- a/libavcodec/ivi_common.c +++ b/libavcodec/ivi_common.c @@ -1056,7 +1056,10 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (!ctx->is_nonnull_frame(ctx)) return buf_size; - avcodec_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height); + result = ff_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height); + if (result < 0) + return result; + if ((result = ff_get_buffer(avctx, frame, 0)) < 0) return result; diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c index f793137306..328a555b62 100644 --- a/libavcodec/kgv1dec.c +++ b/libavcodec/kgv1dec.c @@ -60,12 +60,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, h = (buf[1] + 1) * 8; buf += 2; - if ((res = av_image_check_size(w, h, 0, avctx)) < 0) - return res; - if (w != avctx->width || h != avctx->height) { av_frame_unref(c->prev); - avcodec_set_dimensions(avctx, w, h); + if ((res = ff_set_dimensions(avctx, w, h)) < 0) + return res; } maxcnt = w * h; diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 93f47a21d5..0543e3a897 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -32,6 +32,7 @@ #include "libavutil/pixfmt.h" #include "libavutil/opt.h" #include "avcodec.h" +#include "internal.h" #include "thread.h" #if HAVE_OPENJPEG_1_5_OPENJPEG_H @@ -296,13 +297,9 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, width = image->x1 - image->x0; height = image->y1 - image->y0; - if ((ret = av_image_check_size(width, height, 0, avctx)) < 0) { - av_log(avctx, AV_LOG_ERROR, - "%dx%d dimension invalid.\n", width, height); + ret = ff_set_dimensions(avctx, width, height); + if (ret < 0) goto done; - } - - avcodec_set_dimensions(avctx, width, height); if (avctx->pix_fmt != AV_PIX_FMT_NONE) if (!libopenjpeg_matches_pix_fmt(image, avctx->pix_fmt))