Mercurial > mplayer.hg
changeset 36462:b72daec4e223
Only update aspect when there was an actual change.
Fixes playback of e.g. mkv files where SPS/stream and mkv header aspect
information mismatch (or actually even if the SPS/stream aspect value
is simply missing).
author | reimar |
---|---|
date | Sun, 22 Dec 2013 20:36:52 +0000 |
parents | ed153683310d |
children | c6843e5bf166 |
files | libmpcodecs/vd_ffmpeg.c |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c Tue Dec 17 22:57:00 2013 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Sun Dec 22 20:36:52 2013 +0000 @@ -570,13 +570,14 @@ static void update_configuration(sh_video_t *sh, enum AVPixelFormat pix_fmt) { vd_ffmpeg_ctx *ctx = sh->context; AVCodecContext *avctx = ctx->avctx; + int aspect_change = av_cmp_q(avctx->sample_aspect_ratio, ctx->last_sample_aspect_ratio); if (!avctx->sample_aspect_ratio.den) { mp_msg(MSGT_DECVIDEO, MSGL_WARN, "FFmpeg bug: Invalid aspect\n"); avctx->sample_aspect_ratio.den = 1; } // it is possible another vo buffers to be used after vo config() // lavc reset its buffers on width/heigh change but not on aspect change!!! - if (av_cmp_q(avctx->sample_aspect_ratio, ctx->last_sample_aspect_ratio) || + if (aspect_change || pix_fmt != ctx->pix_fmt || !ctx->vo_initialized) { @@ -592,7 +593,7 @@ // 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->original_aspect == 0 || ctx->last_sample_aspect_ratio.den) + if (sh->original_aspect == 0 || (aspect_change && ctx->last_sample_aspect_ratio.den)) sh->original_aspect = aspect; ctx->last_sample_aspect_ratio = avctx->sample_aspect_ratio; ctx->pix_fmt = pix_fmt;