Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-01 18:25:09 +0400
committerMichael Niedermayer <michaelni@gmx.at>2013-11-01 18:25:09 +0400
commita897ba33e88316d2591a89ab93f8f69587d245ca (patch)
tree0286276ca6dd54107f8f9db82e8277a59d3f1955 /libavcodec/pgssubdec.c
parent64a0ed190efa4c8d1514a7d258ab533b340408d8 (diff)
parent0f21d8b1b40848973558c737aebe800c46e93a3d (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>
Diffstat (limited to 'libavcodec/pgssubdec.c')
-rw-r--r--libavcodec/pgssubdec.c28
1 files changed, 18 insertions, 10 deletions
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:
/*