diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index 6da9f0250c..8c3abd7ddb 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -55,10 +55,9 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf += offset; - if ((ret = av_image_check_size(w, h, 0, avctx)) < 0) + if ((ret = ff_set_dimensions(avctx, w, h)) < 0) return ret; - if (w != avctx->width || h != avctx->height) - avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 5206533633..57ebdc577c 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -28,6 +28,7 @@ #include "libavutil/imgutils.h" #include "avcodec.h" #include "error_resilience.h" +#include "internal.h" #include "mpegvideo.h" #include "mpeg4video.h" #include "h263.h" @@ -363,8 +364,6 @@ static int rv20_decode_picture_header(RVDecContext *rv) AVRational old_aspect = s->avctx->sample_aspect_ratio; av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h); - if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0) - return AVERROR_INVALIDDATA; ff_MPV_common_end(s); // attempt to keep aspect during typical resolution switches @@ -374,7 +373,11 @@ static int rv20_decode_picture_header(RVDecContext *rv) s->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){2, 1}); if (new_w * s->height == 2 * new_h * s->width) s->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){1, 2}); - avcodec_set_dimensions(s->avctx, new_w, new_h); + + ret = ff_set_dimensions(s->avctx, new_w, new_h); + if (ret < 0) + return ret; + s->width = new_w; s->height = new_h; if ((ret = ff_MPV_common_init(s)) < 0) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index f84fb005df..4896b39a8c 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1693,7 +1693,11 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, si.width, si.height); s->width = si.width; s->height = si.height; - avcodec_set_dimensions(s->avctx, s->width, s->height); + + err = ff_set_dimensions(s->avctx, s->width, s->height); + if (err < 0) + return err; + if ((err = ff_MPV_common_frame_size_change(s)) < 0) return err; if ((err = rv34_decoder_realloc(r)) < 0) diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index e373825ba8..35063ea53b 100644 --- a/libavcodec/sgidec.c +++ b/libavcodec/sgidec.c @@ -202,9 +202,9 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if (av_image_check_size(s->width, s->height, 0, avctx)) - return AVERROR_INVALIDDATA; - avcodec_set_dimensions(avctx, s->width, s->height); + ret = ff_set_dimensions(avctx, s->width, s->height); + if (ret < 0) + return ret; if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret;