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

reimar subversion at mplayerhq.hu
Fri Oct 22 19:36:12 CEST 2010


Author: reimar
Date: Fri Oct 22 19:36:11 2010
New Revision: 32525

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

Modified:
   trunk/libmpcodecs/vd_ffmpeg.c

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Thu Oct 21 20:19:30 2010	(r32524)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Fri Oct 22 19:36:11 2010	(r32525)
@@ -559,9 +559,13 @@ static int init_vo(sh_video_t *sh, enum 
         // 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;


More information about the MPlayer-cvslog mailing list