From 8451b5f00a210773ea51b4c705928e82c9fb7cff Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Oct 2013 10:02:26 +0100 Subject: [PATCH 1/4] dpx: stop using deprecated avcodec_set_dimensions --- libavcodec/dpx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index da7457d753..0dfa5385d1 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -147,10 +147,9 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - 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) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; From caeed8deeb0c991ce72f371b619055b6a62aee5e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Oct 2013 10:02:26 +0100 Subject: [PATCH 2/4] dvdec: stop using deprecated avcodec_set_dimensions --- libavcodec/dvdec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index 4b7dfeebed..aee405314f 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -318,7 +318,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, int buf_size = avpkt->size; DVVideoContext *s = avctx->priv_data; const uint8_t* vsc_pack; - int apt, is16_9; + int apt, is16_9, ret; s->sys = avpriv_dv_frame_profile(s->sys, buf, buf_size); if (!s->sys || buf_size < s->sys->frame_size || ff_dv_init_dynamic_tables(s->sys)) { @@ -330,7 +330,11 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, s->picture.pict_type = AV_PICTURE_TYPE_I; avctx->pix_fmt = s->sys->pix_fmt; avctx->time_base = s->sys->time_base; - avcodec_set_dimensions(avctx, s->sys->width, s->sys->height); + + ret = ff_set_dimensions(avctx, s->sys->width, s->sys->height); + if (ret < 0) + return ret; + if (ff_get_buffer(avctx, &s->picture, 0) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; From babbec086790321d9ec045fc2fa4a9d8f4856c8c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Oct 2013 10:02:26 +0100 Subject: [PATCH 3/4] dvdsubdec: stop using deprecated avcodec_set_dimensions --- libavcodec/dvdsubdec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 3cc9022b7e..c5e864df0c 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -21,6 +21,8 @@ #include "avcodec.h" #include "get_bits.h" #include "dsputil.h" +#include "internal.h" + #include "libavutil/attributes.h" #include "libavutil/colorspace.h" #include "libavutil/imgutils.h" @@ -527,9 +529,11 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) } } else if (!strncmp("size:", cur, 5)) { int w, h; - if (sscanf(cur + 5, "%dx%d", &w, &h) == 2 && - av_image_check_size(w, h, 0, avctx) >= 0) - avcodec_set_dimensions(avctx, w, h); + if (sscanf(cur + 5, "%dx%d", &w, &h) == 2) { + int ret = ff_set_dimensions(avctx, w, h); + if (ret < 0) + return ret; + } } cur += strcspn(cur, "\n\r"); cur += strspn(cur, "\n\r"); From d6da372984c87fd6288c148c291065d6032ceda3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Oct 2013 10:02:26 +0100 Subject: [PATCH 4/4] eacmv: stop using deprecated avcodec_set_dimensions --- libavcodec/eacmv.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c index 3b1256c254..d39ebd36b9 100644 --- a/libavcodec/eacmv.c +++ b/libavcodec/eacmv.c @@ -129,19 +129,21 @@ static void cmv_decode_inter(CmvContext *s, AVFrame *frame, const uint8_t *buf, } } -static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) +static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) { - int pal_start, pal_count, i; + int pal_start, pal_count, i, ret; if(buf_end - buf < 16) { av_log(s->avctx, AV_LOG_WARNING, "truncated header\n"); - return; + return AVERROR_INVALIDDATA; } s->width = AV_RL16(&buf[4]); s->height = AV_RL16(&buf[6]); - 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; s->avctx->time_base.num = 1; s->avctx->time_base.den = AV_RL16(&buf[10]); @@ -154,6 +156,8 @@ static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t s->palette[i] = AV_RB24(buf); buf += 3; } + + return 0; } #define EA_PREAMBLE_SIZE 8 @@ -174,7 +178,9 @@ static int cmv_decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) { - cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end); + ret = cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end); + if (ret < 0) + return ret; return buf_size; }