[FFmpeg-cvslog] pgssubdec: stop using deprecated avcodec_set_dimensions
Anton Khirnov
git at videolan.org
Fri Nov 1 15:33:44 CET 2013
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Oct 27 10:02:26 2013 +0100| [41ad353dcffc02803c5ccf98307f0c468ee0313a] | committer: Anton Khirnov
pgssubdec: stop using deprecated avcodec_set_dimensions
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41ad353dcffc02803c5ccf98307f0c468ee0313a
---
libavcodec/pgssubdec.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 874493c..2102a51 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:
/*
More information about the ffmpeg-cvslog
mailing list