Commit 98ca3fb9 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '757d5e8e'

* commit '757d5e8e':
  vp8: stop using deprecated avcodec_set_dimensions
  vp56: stop using deprecated avcodec_set_dimensions
  vp3: stop using deprecated avcodec_set_dimensions
  txd: stop using deprecated avcodec_set_dimensions
  truemotion1: stop using deprecated avcodec_set_dimensions

Conflicts:
	libavcodec/txd.c
	libavcodec/vp56.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents ffd100b1 757d5e8e
......@@ -397,15 +397,16 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
new_pix_fmt = AV_PIX_FMT_RGB555; // RGB565 is supported as well
s->w >>= width_shift;
if ((ret = av_image_check_size(s->w, s->h, 0, s->avctx)) < 0)
return ret;
if (s->w != s->avctx->width || s->h != s->avctx->height ||
new_pix_fmt != s->avctx->pix_fmt) {
av_frame_unref(&s->frame);
s->avctx->sample_aspect_ratio = (AVRational){ 1 << width_shift, 1 };
s->avctx->pix_fmt = new_pix_fmt;
avcodec_set_dimensions(s->avctx, s->w, s->h);
if ((ret = ff_set_dimensions(s->avctx, s->w, s->h)) < 0)
return ret;
av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int));
if (!s->vert_pred)
return AVERROR(ENOMEM);
......
......@@ -63,10 +63,9 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return AVERROR_PATCHWELCOME;
}
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;
......
......@@ -2196,6 +2196,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
Vp3DecodeContext *s = avctx->priv_data;
int visible_width, visible_height, colorspace;
int offset_x = 0, offset_y = 0;
int ret;
AVRational fps, aspect;
s->theora = get_bits_long(gb, 24);
......@@ -2212,12 +2213,6 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
visible_width = s->width = get_bits(gb, 16) << 4;
visible_height = s->height = get_bits(gb, 16) << 4;
if(av_image_check_size(s->width, s->height, 0, avctx)){
av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s->height);
s->width= s->height= 0;
return -1;
}
if (s->theora >= 0x030200) {
visible_width = get_bits_long(gb, 24);
visible_height = get_bits_long(gb, 24);
......@@ -2268,9 +2263,11 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
if ( visible_width <= s->width && visible_width > s->width-16
&& visible_height <= s->height && visible_height > s->height-16
&& !offset_x && (offset_y == s->height - visible_height))
avcodec_set_dimensions(avctx, visible_width, visible_height);
ret = ff_set_dimensions(avctx, visible_width, visible_height);
else
avcodec_set_dimensions(avctx, s->width, s->height);
ret = ff_set_dimensions(avctx, s->width, s->height);
if (ret < 0)
return ret;
if (colorspace == 1) {
avctx->color_primaries = AVCOL_PRI_BT470M;
......
......@@ -28,6 +28,7 @@
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
#include "vp56.h"
#include "vp56data.h"
......@@ -66,7 +67,9 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size)
if (!s->macroblocks || /* first frame */
16*cols != s->avctx->coded_width ||
16*rows != s->avctx->coded_height) {
avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
int ret = ff_set_dimensions(s->avctx, 16 * cols, 16 * rows);
if (ret < 0)
return ret;
return VP56_SIZE_CHANGE;
}
} else if (!s->macroblocks)
......
......@@ -470,7 +470,7 @@ static int vp56_size_changed(VP56Context *s)
s->mb_height = (avctx->coded_height+15) / 16;
if (s->mb_width > 1000 || s->mb_height > 1000) {
avcodec_set_dimensions(avctx, 0, 0);
ff_set_dimensions(avctx, 0, 0);
av_log(avctx, AV_LOG_ERROR, "picture too big\n");
return -1;
}
......
......@@ -32,6 +32,7 @@
#include "avcodec.h"
#include "get_bits.h"
#include "huffman.h"
#include "internal.h"
#include "vp56.h"
#include "vp56data.h"
......@@ -92,7 +93,10 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size)
s->avctx->coded_width = 16 * cols;
s->avctx->coded_height = 16 * rows;
} else {
avcodec_set_dimensions(s->avctx, 16 * cols, 16 * rows);
int ret = ff_set_dimensions(s->avctx, 16 * cols, 16 * rows);
if (ret < 0)
return ret;
if (s->avctx->extradata_size == 1) {
s->avctx->width -= s->avctx->extradata[0] >> 4;
s->avctx->height -= s->avctx->extradata[0] & 0x0F;
......@@ -154,7 +158,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size)
buf_size -= coeff_offset;
if (buf_size < 0) {
if (s->frames[VP56_FRAME_CURRENT]->key_frame)
avcodec_set_dimensions(s->avctx, 0, 0);
ff_set_dimensions(s->avctx, 0, 0);
return AVERROR_INVALIDDATA;
}
if (s->use_huffman) {
......
......@@ -113,16 +113,15 @@ static void vp8_decode_flush(AVCodecContext *avctx)
static int update_dimensions(VP8Context *s, int width, int height)
{
AVCodecContext *avctx = s->avctx;
int i;
int i, ret;
if (width != s->avctx->width || ((width+15)/16 != s->mb_width || (height+15)/16 != s->mb_height) && s->macroblocks_base ||
height != s->avctx->height) {
if (av_image_check_size(width, height, 0, s->avctx))
return AVERROR_INVALIDDATA;
vp8_decode_flush_impl(s->avctx, 1);
avcodec_set_dimensions(s->avctx, width, height);
ret = ff_set_dimensions(s->avctx, width, height);
if (ret < 0)
return ret;
}
s->mb_width = (s->avctx->coded_width +15) / 16;
......
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