diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-01 18:25:09 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-01 18:25:09 +0400 |
commit | a897ba33e88316d2591a89ab93f8f69587d245ca (patch) | |
tree | 0286276ca6dd54107f8f9db82e8277a59d3f1955 | |
parent | 64a0ed190efa4c8d1514a7d258ab533b340408d8 (diff) | |
parent | 0f21d8b1b40848973558c737aebe800c46e93a3d (diff) |
Merge commit '0f21d8b1b40848973558c737aebe800c46e93a3d'
* commit '0f21d8b1b40848973558c737aebe800c46e93a3d':
pictordec: stop using deprecated avcodec_set_dimensions
pgssubdec: stop using deprecated avcodec_set_dimensions
pcx: stop using deprecated avcodec_set_dimensions
mpegvideo_parser: stop using deprecated avcodec_set_dimensions
Conflicts:
libavcodec/pcx.c
libavcodec/pgssubdec.c
libavcodec/pictordec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/mpegvideo_parser.c | 4 | ||||
-rw-r--r-- | libavcodec/pcx.c | 5 | ||||
-rw-r--r-- | libavcodec/pgssubdec.c | 28 | ||||
-rw-r--r-- | libavcodec/pictordec.c | 4 |
4 files changed, 25 insertions, 16 deletions
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index f127218d21..7aa3660f7f 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -66,7 +66,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; @@ -94,7 +94,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, pc->height |=( vert_size_ext << 12); bit_rate = (bit_rate&0x3FFFF) | (bit_rate_ext << 18); 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; diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index 66b1a35fdf..6487aa573b 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -132,10 +132,9 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, bytestream2_skipu(&gb, 60); - 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/pgssubdec.c b/libavcodec/pgssubdec.c index 4de83f3cd0..f45f0bfc87 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" #include "libavutil/opt.h" @@ -294,11 +296,12 @@ static void parse_palette_segment(AVCodecContext *avctx, * @param buf_size size of packet to process * @todo TODO: Implement cropping */ -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 ret; int w = bytestream_get_be16(&buf); int h = bytestream_get_be16(&buf); @@ -309,8 +312,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++; @@ -327,20 +331,20 @@ static void parse_presentation_segment(AVCodecContext *avctx, ctx->presentation.object_count = bytestream_get_byte(&buf); if (!ctx->presentation.object_count) - return; + return 0; /* Verify that enough bytes are remaining for all of the objects. */ buf_size -= 11; if (buf_size < ctx->presentation.object_count * 8) { ctx->presentation.object_count = 0; - return; + return AVERROR_INVALIDDATA; } av_freep(&ctx->presentation.objects); ctx->presentation.objects = av_malloc(sizeof(PGSSubPictureReference) * ctx->presentation.object_count); if (!ctx->presentation.objects) { ctx->presentation.object_count = 0; - return; + return AVERROR(ENOMEM); } for (object_index = 0; object_index < ctx->presentation.object_count; ++object_index) { @@ -365,6 +369,8 @@ static void parse_presentation_segment(AVCodecContext *avctx, reference->y = 0; } } + + return 0; } /** @@ -456,7 +462,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"); @@ -495,7 +501,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, sub->pts); + ret = parse_presentation_segment(avctx, buf, segment_length, sub->pts); + if (ret < 0) + return ret; break; case WINDOW_SEGMENT: /* diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index 5b528f5e8a..1bc51bcf24 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -143,7 +143,9 @@ static int decode_frame(AVCodecContext *avctx, if (av_image_check_size(s->width, s->height, 0, avctx) < 0) return -1; if (s->width != avctx->width && s->height != avctx->height) { - 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) |