Browse Source

lavc: dont call set_dimensions() on h264 codec init.

This fixes ffprobe showing an incorrect width with
http://panda-test-harness-videos.s3.amazonaws.com/panda.mp4

Idea-by: Joakim Plate <elupus@ecce.se>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n0.9
Michael Niedermayer 13 years ago
parent
commit
4b4a02b847
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      libavcodec/utils.c

+ 3
- 0
libavcodec/utils.c View File

@@ -575,10 +575,13 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)
goto free_and_end; goto free_and_end;


//We only call avcodec_set_dimensions() for non h264 codecs so as not to overwrite previously setup dimensions
if(!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == CODEC_ID_H264)){
if(avctx->coded_width && avctx->coded_height) if(avctx->coded_width && avctx->coded_height)
avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
else if(avctx->width && avctx->height) else if(avctx->width && avctx->height)
avcodec_set_dimensions(avctx, avctx->width, avctx->height); avcodec_set_dimensions(avctx, avctx->width, avctx->height);
}


if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) 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->coded_width, avctx->coded_height, 0, avctx) < 0


Loading…
Cancel
Save