[FFmpeg-cvslog] lavc: dont call set_dimensions() on h264 codec init.

Michael Niedermayer git at videolan.org
Tue Nov 29 17:34:33 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Nov 29 17:23:05 2011 +0100| [4b4a02b8474bc669eaed8eab496d9cd25a08ab7f] | committer: Michael Niedermayer

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 at ecce.se>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4b4a02b8474bc669eaed8eab496d9cd25a08ab7f
---

 libavcodec/utils.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 04a8a1e..979b27a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -575,10 +575,13 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
     if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)
         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)
         avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
     else if(avctx->width && avctx->height)
         avcodec_set_dimensions(avctx, 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



More information about the ffmpeg-cvslog mailing list