[MPlayer-cvslog] r36558 - trunk/libmpcodecs/vd_ffmpeg.c

reimar subversion at mplayerhq.hu
Sun Dec 22 21:36:52 CET 2013


Author: reimar
Date: Sun Dec 22 21:36:52 2013
New Revision: 36558

Log:
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).

Modified:
   trunk/libmpcodecs/vd_ffmpeg.c

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Tue Dec 17 23:57:00 2013	(r36557)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sun Dec 22 21:36:52 2013	(r36558)
@@ -570,13 +570,14 @@ static void draw_slice(struct AVCodecCon
 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 @@ static void update_configuration(sh_vide
         // 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;


More information about the MPlayer-cvslog mailing list