mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit 'd6da372984c87fd6288c148c291065d6032ceda3'
* commit 'd6da372984c87fd6288c148c291065d6032ceda3': eacmv: stop using deprecated avcodec_set_dimensions dvdsubdec: stop using deprecated avcodec_set_dimensions dvdec: stop using deprecated avcodec_set_dimensions dpx: stop using deprecated avcodec_set_dimensions Conflicts: libavcodec/dpx.c libavcodec/dvdec.c libavcodec/dvdsubdec.c libavcodec/eacmv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
4a35651267
@ -111,11 +111,9 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
buf = avpkt->data + 0x304;
|
||||
w = read32(&buf, endian);
|
||||
h = read32(&buf, endian);
|
||||
if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)
|
||||
return ret;
|
||||
|
||||
if (w != avctx->width || h != avctx->height)
|
||||
avcodec_set_dimensions(avctx, w, h);
|
||||
if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
|
||||
return ret;
|
||||
|
||||
// Need to end in 0x320 to read the descriptor
|
||||
buf += 20;
|
||||
|
@ -319,7 +319,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
|
||||
int buf_size = avpkt->size;
|
||||
DVVideoContext *s = avctx->priv_data;
|
||||
const uint8_t* vsc_pack;
|
||||
int ret, apt, is16_9;
|
||||
int apt, is16_9, ret;
|
||||
|
||||
s->sys = avpriv_dv_frame_profile2(avctx, s->sys, buf, buf_size);
|
||||
if (!s->sys || buf_size < s->sys->frame_size || ff_dv_init_dynamic_tables(s->sys)) {
|
||||
@ -331,7 +331,11 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
|
||||
s->picture.pict_type = AV_PICTURE_TYPE_I;
|
||||
avctx->pix_fmt = s->sys->pix_fmt;
|
||||
avctx->time_base = s->sys->time_base;
|
||||
avcodec_set_dimensions(avctx, s->sys->width, s->sys->height);
|
||||
|
||||
ret = ff_set_dimensions(avctx, s->sys->width, s->sys->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, &s->picture, 0)) < 0)
|
||||
return ret;
|
||||
s->picture.interlaced_frame = 1;
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "avcodec.h"
|
||||
#include "get_bits.h"
|
||||
#include "dsputil.h"
|
||||
#include "internal.h"
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/colorspace.h"
|
||||
#include "libavutil/opt.h"
|
||||
@ -598,9 +600,11 @@ static int dvdsub_parse_extradata(AVCodecContext *avctx)
|
||||
parse_palette(ctx, data + 8);
|
||||
} else if (strncmp("size:", data, 5) == 0) {
|
||||
int w, h;
|
||||
if (sscanf(data + 5, "%dx%d", &w, &h) == 2 &&
|
||||
av_image_check_size(w, h, 0, avctx) >= 0)
|
||||
avcodec_set_dimensions(avctx, w, h);
|
||||
if (sscanf(data + 5, "%dx%d", &w, &h) == 2) {
|
||||
int ret = ff_set_dimensions(avctx, w, h);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
data += pos;
|
||||
|
@ -130,21 +130,23 @@ static void cmv_decode_inter(CmvContext *s, AVFrame *frame, const uint8_t *buf,
|
||||
}
|
||||
}
|
||||
|
||||
static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end)
|
||||
static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end)
|
||||
{
|
||||
int pal_start, pal_count, i;
|
||||
int pal_start, pal_count, i, ret;
|
||||
|
||||
if(buf_end - buf < 16) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "truncated header\n");
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->width = AV_RL16(&buf[4]);
|
||||
s->height = AV_RL16(&buf[6]);
|
||||
if (s->avctx->width!=s->width || s->avctx->height!=s->height) {
|
||||
avcodec_set_dimensions(s->avctx, s->width, s->height);
|
||||
av_frame_unref(s->last_frame);
|
||||
av_frame_unref(s->last2_frame);
|
||||
ret = ff_set_dimensions(s->avctx, s->width, s->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s->avctx->time_base.num = 1;
|
||||
@ -158,6 +160,8 @@ static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t
|
||||
s->palette[i] = 0xFFU << 24 | AV_RB24(buf);
|
||||
buf += 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define EA_PREAMBLE_SIZE 8
|
||||
@ -179,7 +183,9 @@ static int cmv_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) {
|
||||
unsigned size = AV_RL32(buf + 4);
|
||||
cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
|
||||
ret = cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (size > buf_end - buf - EA_PREAMBLE_SIZE)
|
||||
return -1;
|
||||
buf += size;
|
||||
|
Loading…
Reference in New Issue
Block a user