Commit 4a356512 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'd6da3729'

* commit 'd6da3729':
  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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents f016a23c d6da3729
...@@ -111,11 +111,9 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -111,11 +111,9 @@ static int decode_frame(AVCodecContext *avctx,
buf = avpkt->data + 0x304; buf = avpkt->data + 0x304;
w = read32(&buf, endian); w = read32(&buf, endian);
h = 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) if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
avcodec_set_dimensions(avctx, w, h); return ret;
// Need to end in 0x320 to read the descriptor // Need to end in 0x320 to read the descriptor
buf += 20; buf += 20;
......
...@@ -319,7 +319,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, ...@@ -319,7 +319,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
int buf_size = avpkt->size; int buf_size = avpkt->size;
DVVideoContext *s = avctx->priv_data; DVVideoContext *s = avctx->priv_data;
const uint8_t* vsc_pack; 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); 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)) { 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, ...@@ -331,7 +331,11 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
s->picture.pict_type = AV_PICTURE_TYPE_I; s->picture.pict_type = AV_PICTURE_TYPE_I;
avctx->pix_fmt = s->sys->pix_fmt; avctx->pix_fmt = s->sys->pix_fmt;
avctx->time_base = s->sys->time_base; 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) if ((ret = ff_get_buffer(avctx, &s->picture, 0)) < 0)
return ret; return ret;
s->picture.interlaced_frame = 1; s->picture.interlaced_frame = 1;
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include "avcodec.h" #include "avcodec.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h" #include "dsputil.h"
#include "internal.h"
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/colorspace.h" #include "libavutil/colorspace.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
...@@ -598,9 +600,11 @@ static int dvdsub_parse_extradata(AVCodecContext *avctx) ...@@ -598,9 +600,11 @@ static int dvdsub_parse_extradata(AVCodecContext *avctx)
parse_palette(ctx, data + 8); parse_palette(ctx, data + 8);
} else if (strncmp("size:", data, 5) == 0) { } else if (strncmp("size:", data, 5) == 0) {
int w, h; int w, h;
if (sscanf(data + 5, "%dx%d", &w, &h) == 2 && if (sscanf(data + 5, "%dx%d", &w, &h) == 2) {
av_image_check_size(w, h, 0, avctx) >= 0) int ret = ff_set_dimensions(avctx, w, h);
avcodec_set_dimensions(avctx, w, h); if (ret < 0)
return ret;
}
} }
data += pos; data += pos;
......
...@@ -130,21 +130,23 @@ static void cmv_decode_inter(CmvContext *s, AVFrame *frame, const uint8_t *buf, ...@@ -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) { if(buf_end - buf < 16) {
av_log(s->avctx, AV_LOG_WARNING, "truncated header\n"); av_log(s->avctx, AV_LOG_WARNING, "truncated header\n");
return; return AVERROR_INVALIDDATA;
} }
s->width = AV_RL16(&buf[4]); s->width = AV_RL16(&buf[4]);
s->height = AV_RL16(&buf[6]); s->height = AV_RL16(&buf[6]);
if (s->avctx->width!=s->width || s->avctx->height!=s->height) { 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->last_frame);
av_frame_unref(s->last2_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; s->avctx->time_base.num = 1;
...@@ -158,6 +160,8 @@ static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t ...@@ -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); s->palette[i] = 0xFFU << 24 | AV_RB24(buf);
buf += 3; buf += 3;
} }
return 0;
} }
#define EA_PREAMBLE_SIZE 8 #define EA_PREAMBLE_SIZE 8
...@@ -179,7 +183,9 @@ static int cmv_decode_frame(AVCodecContext *avctx, ...@@ -179,7 +183,9 @@ static int cmv_decode_frame(AVCodecContext *avctx,
if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) { if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) {
unsigned size = AV_RL32(buf + 4); 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) if (size > buf_end - buf - EA_PREAMBLE_SIZE)
return -1; return -1;
buf += size; buf += size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment