From 6da9c9d38125b662600c702809018e4bb9ed11cf Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Oct 2013 10:02:26 +0100 Subject: [PATCH 1/4] mpegvideo_parser: stop using deprecated avcodec_set_dimensions --- libavcodec/mpegvideo_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 3219c10977..bec1b36975 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -62,7 +62,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, pc->width = (buf[0] << 4) | (buf[1] >> 4); pc->height = ((buf[1] & 0x0f) << 8) | buf[2]; if(!avctx->width || !avctx->height || !avctx->coded_width || !avctx->coded_height){ - avcodec_set_dimensions(avctx, pc->width, pc->height); + ff_set_dimensions(avctx, pc->width, pc->height); did_set_size=1; } frame_rate_index = buf[3] & 0xf; @@ -90,7 +90,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, pc->height |=( vert_size_ext << 12); avctx->bit_rate += (bit_rate_ext << 18) * 400; if(did_set_size) - avcodec_set_dimensions(avctx, pc->width, pc->height); + ff_set_dimensions(avctx, pc->width, pc->height); avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1) * 2; avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1); avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO; From 067941626917cd8e913e66b6104f1f8bc3a22400 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Oct 2013 10:02:26 +0100 Subject: [PATCH 2/4] pcx: stop using deprecated avcodec_set_dimensions --- libavcodec/pcx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index ad92d756ce..1a5357b012 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -135,10 +135,9 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf += 128; - 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 41ad353dcffc02803c5ccf98307f0c468ee0313a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Oct 2013 10:02:26 +0100 Subject: [PATCH 3/4] pgssubdec: stop using deprecated avcodec_set_dimensions --- libavcodec/pgssubdec.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 874493ccbc..2102a51653 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -27,6 +27,8 @@ #include "avcodec.h" #include "dsputil.h" #include "bytestream.h" +#include "internal.h" + #include "libavutil/colorspace.h" #include "libavutil/imgutils.h" @@ -272,13 +274,13 @@ static void parse_palette_segment(AVCodecContext *avctx, * @todo TODO: Implement cropping * @todo TODO: Implement forcing of subtitles */ -static void parse_presentation_segment(AVCodecContext *avctx, - const uint8_t *buf, int buf_size, - int64_t pts) +static int parse_presentation_segment(AVCodecContext *avctx, + const uint8_t *buf, int buf_size, + int64_t pts) { PGSSubContext *ctx = avctx->priv_data; - int x, y; + int x, y, ret; int w = bytestream_get_be16(&buf); int h = bytestream_get_be16(&buf); @@ -287,8 +289,9 @@ static void parse_presentation_segment(AVCodecContext *avctx, av_dlog(avctx, "Video Dimensions %dx%d\n", w, h); - if (av_image_check_size(w, h, 0, avctx) >= 0) - avcodec_set_dimensions(avctx, w, h); + ret = ff_set_dimensions(avctx, w, h); + if (ret < 0) + return ret; /* Skip 1 bytes of unknown, frame rate? */ buf++; @@ -306,7 +309,7 @@ static void parse_presentation_segment(AVCodecContext *avctx, ctx->presentation.object_number = bytestream_get_byte(&buf); ctx->presentation.composition_flag = 0; if (!ctx->presentation.object_number) - return; + return 0; /* * Skip 3 bytes of unknown: @@ -332,6 +335,8 @@ static void parse_presentation_segment(AVCodecContext *avctx, /* Fill in dimensions */ ctx->presentation.x = x; ctx->presentation.y = y; + + return 0; } /** @@ -413,7 +418,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf_end; uint8_t segment_type; int segment_length; - int i; + int i, ret; av_dlog(avctx, "PGS sub packet:\n"); @@ -452,7 +457,9 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, parse_picture_segment(avctx, buf, segment_length); break; case PRESENTATION_SEGMENT: - parse_presentation_segment(avctx, buf, segment_length, avpkt->pts); + ret = parse_presentation_segment(avctx, buf, segment_length, avpkt->pts); + if (ret < 0) + return ret; break; case WINDOW_SEGMENT: /* From 0f21d8b1b40848973558c737aebe800c46e93a3d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Oct 2013 10:02:26 +0100 Subject: [PATCH 4/4] pictordec: stop using deprecated avcodec_set_dimensions --- libavcodec/pictordec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index 2d72977897..33c4545483 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -141,9 +141,9 @@ static int decode_frame(AVCodecContext *avctx, avctx->pix_fmt = AV_PIX_FMT_PAL8; if (s->width != avctx->width && s->height != avctx->height) { - if (av_image_check_size(s->width, s->height, 0, avctx) < 0) - return -1; - 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, frame, 0)) < 0) {