changeset 28766:4725b3ebdba3

Add another hack to work-around the currently completely inconsistent way in which libavcodec sets AVCodecContext::pix_fmt.
author reimar
date Tue, 03 Mar 2009 13:38:33 +0000
parents 771dce7d5e82
children 8134ffd057d7
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Tue Mar 03 09:19:35 2009 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Tue Mar 03 13:38:33 2009 +0000
@@ -409,7 +409,8 @@
         uninit(sh);
         return 0;
     }
-    // this is necessary in case get_format was never called
+    // this is necessary in case get_format was never called and init_vo is
+    // too late e.g. for H.264 VDPAU
     set_format_params(avctx, avctx->pix_fmt);
     mp_msg(MSGT_DECVIDEO, MSGL_V, "INFO: libavcodec init OK!\n");
     return 1; //mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, IMGFMT_YV12);
@@ -504,6 +505,9 @@
         pix_fmt != ctx->pix_fmt ||
         !ctx->vo_initialized)
     {
+        // this is a special-case HACK for MPEG-1/2 VDPAU that uses neither get_format nor
+        // 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,