mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
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>
This commit is contained in:
commit
a897ba33e8
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
/*
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user