Browse Source

Merge commit '0f6c1d6d64c9f6255ea579dace27d0dd695f0213'

* commit '0f6c1d6d64c9f6255ea579dace27d0dd695f0213':
  lavc/utils: stop using deprecated avcodec_set_dimensions

Conflicts:
	libavcodec/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.2-rc1
Michael Niedermayer 11 years ago
parent
commit
66f436adf5
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      libavcodec/utils.c

+ 10
- 6
libavcodec/utils.c View File

@@ -1230,20 +1230,22 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)
goto free_and_end;

// only call avcodec_set_dimensions() for non H.264/VP6F codecs so as not to overwrite previously setup dimensions
// only call ff_set_dimensions() for non H.264/VP6F codecs so as not to overwrite previously setup dimensions
if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&
(avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F))) {
if (avctx->coded_width && avctx->coded_height)
avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
else if (avctx->width && avctx->height)
avcodec_set_dimensions(avctx, avctx->width, avctx->height);
ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
if (ret < 0)
goto free_and_end;
}

if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)
&& ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0
|| av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) {
av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n");
avcodec_set_dimensions(avctx, 0, 0);
ff_set_dimensions(avctx, 0, 0);
}

/* if the decoder init function was already called previously,
@@ -1970,7 +1972,7 @@ static int64_t guess_correct_pts(AVCodecContext *ctx,

static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
{
int size = 0;
int size = 0, ret;
const uint8_t *data;
uint32_t flags;

@@ -2013,8 +2015,10 @@ static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
goto fail;
avctx->width = bytestream_get_le32(&data);
avctx->height = bytestream_get_le32(&data);
avcodec_set_dimensions(avctx, avctx->width, avctx->height);
size -= 8;
ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
if (ret < 0)
return ret;
}

return 0;


Loading…
Cancel
Save