diff libmpcodecs/vd_ffmpeg.c @ 34161:64a0c61c6f18

Add a vd_ffmpeg option to make the decoder discard frames until the first keyframe after startup or seek. Restore the previous default behaviour since in actual playback scenarios long delays are far more annoying than seeing a few broken frames.
author reimar
date Mon, 24 Oct 2011 17:44:13 +0000
parents fab5ae1132e7
children 66cdad95f543
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Mon Oct 24 16:22:10 2011 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Mon Oct 24 17:44:13 2011 +0000
@@ -91,6 +91,7 @@
 static int lavc_param_idct_algo=0;
 static int lavc_param_debug=0;
 static int lavc_param_vismv=0;
+static int lavc_param_wait_keyframe=0;
 static int lavc_param_skip_top=0;
 static int lavc_param_skip_bottom=0;
 static int lavc_param_fast=0;
@@ -119,6 +120,9 @@
     {"vstats"        , &lavc_param_vstats               , CONF_TYPE_FLAG    , 0, 0, 1, NULL},
     {"debug"         , &lavc_param_debug                , CONF_TYPE_INT     , CONF_RANGE, 0, 9999999, NULL},
     {"vismv"         , &lavc_param_vismv                , CONF_TYPE_INT     , CONF_RANGE, 0, 9999999, NULL},
+#ifdef CODEC_FLAG2_SHOW_ALL
+    {"wait_keyframe" , &lavc_param_wait_keyframe        , CONF_TYPE_FLAG    , 0, 0, CODEC_FLAG_PART, NULL},
+#endif
     {"st"            , &lavc_param_skip_top             , CONF_TYPE_INT     , CONF_RANGE, 0, 999, NULL},
     {"sb"            , &lavc_param_skip_bottom          , CONF_TYPE_INT     , CONF_RANGE, 0, 999, NULL},
     {"fast"          , &lavc_param_fast                 , CONF_TYPE_FLAG    , 0, 0, CODEC_FLAG2_FAST, NULL},
@@ -261,6 +265,9 @@
     avctx->workaround_bugs= lavc_param_workaround_bugs;
     avctx->error_recognition= lavc_param_error_resilience;
     if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY;
+#ifdef CODEC_FLAG2_SHOW_ALL
+    if(!lavc_param_wait_keyframe) avctx->flags2 |= CODEC_FLAG2_SHOW_ALL;
+#endif
     avctx->flags2|= lavc_param_fast;
     avctx->codec_tag= sh->format;
     avctx->stream_codec_tag= sh->video.fccHandler;