1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

pgssubdec: stop using deprecated avcodec_set_dimensions

This commit is contained in:
Anton Khirnov 2013-10-27 10:02:26 +01:00
parent 0679416269
commit 41ad353dcf

View File

@ -27,6 +27,8 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "bytestream.h" #include "bytestream.h"
#include "internal.h"
#include "libavutil/colorspace.h" #include "libavutil/colorspace.h"
#include "libavutil/imgutils.h" #include "libavutil/imgutils.h"
@ -272,13 +274,13 @@ static void parse_palette_segment(AVCodecContext *avctx,
* @todo TODO: Implement cropping * @todo TODO: Implement cropping
* @todo TODO: Implement forcing of subtitles * @todo TODO: Implement forcing of subtitles
*/ */
static void parse_presentation_segment(AVCodecContext *avctx, static int parse_presentation_segment(AVCodecContext *avctx,
const uint8_t *buf, int buf_size, const uint8_t *buf, int buf_size,
int64_t pts) int64_t pts)
{ {
PGSSubContext *ctx = avctx->priv_data; PGSSubContext *ctx = avctx->priv_data;
int x, y; int x, y, ret;
int w = bytestream_get_be16(&buf); int w = bytestream_get_be16(&buf);
int h = 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", av_dlog(avctx, "Video Dimensions %dx%d\n",
w, h); w, h);
if (av_image_check_size(w, h, 0, avctx) >= 0) ret = ff_set_dimensions(avctx, w, h);
avcodec_set_dimensions(avctx, w, h); if (ret < 0)
return ret;
/* Skip 1 bytes of unknown, frame rate? */ /* Skip 1 bytes of unknown, frame rate? */
buf++; buf++;
@ -306,7 +309,7 @@ static void parse_presentation_segment(AVCodecContext *avctx,
ctx->presentation.object_number = bytestream_get_byte(&buf); ctx->presentation.object_number = bytestream_get_byte(&buf);
ctx->presentation.composition_flag = 0; ctx->presentation.composition_flag = 0;
if (!ctx->presentation.object_number) if (!ctx->presentation.object_number)
return; return 0;
/* /*
* Skip 3 bytes of unknown: * Skip 3 bytes of unknown:
@ -332,6 +335,8 @@ static void parse_presentation_segment(AVCodecContext *avctx,
/* Fill in dimensions */ /* Fill in dimensions */
ctx->presentation.x = x; ctx->presentation.x = x;
ctx->presentation.y = y; 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; const uint8_t *buf_end;
uint8_t segment_type; uint8_t segment_type;
int segment_length; int segment_length;
int i; int i, ret;
av_dlog(avctx, "PGS sub packet:\n"); 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); parse_picture_segment(avctx, buf, segment_length);
break; break;
case PRESENTATION_SEGMENT: 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; break;
case WINDOW_SEGMENT: case WINDOW_SEGMENT:
/* /*