# HG changeset patch # User reimar # Date 1287768971 0 # Node ID 2f1ccd169a7f62af7521e6e888fec0d0fe383e9c # Parent faefba58f41303a7823e34ae49cb72353f0e5dac Improve vd_ffmpeg aspect handling to respect container aspect if possible (i.e. until the first resolution or aspect change) and to use correct aspect if only resolution changes but not the pixel aspect. diff -r faefba58f413 -r 2f1ccd169a7f libmpcodecs/vd_ffmpeg.c --- a/libmpcodecs/vd_ffmpeg.c Thu Oct 21 18:19:30 2010 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Fri Oct 22 17:36:11 2010 +0000 @@ -559,9 +559,13 @@ // sets the value correctly in avcodec_open. set_format_params(avctx, avctx->pix_fmt); mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", aspect); - if (sh->aspect == 0 || - av_cmp_q(avctx->sample_aspect_ratio, - ctx->last_sample_aspect_ratio)) + + // Do not overwrite s->aspect on the first call, so that a container + // aspect if available is preferred. + // But set it even if the sample aspect did not change, since a + // resolution change can cause an aspect change even if the + // _sample_ aspect is unchanged. + if (sh->aspect == 0 || ctx->last_sample_aspect_ratio.den) sh->aspect = aspect; ctx->last_sample_aspect_ratio = avctx->sample_aspect_ratio; sh->disp_w = width;