From c57660fbf77eb29ddd2187f84b7450f601069b05 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 7 May 2014 22:01:17 +0200 Subject: options: add --hr-seek-framedrop option This allows disabling of decoder framedrop during hr-seek. It's basically another useless option, but it will help exploring whether this framedropping really makes seeking faster, or whether disabling it helps with precise seeking (especially frame backstepping). --- DOCS/man/en/input.rst | 3 ++- DOCS/man/en/options.rst | 9 +++++++++ options/options.c | 2 ++ options/options.h | 1 + player/video.c | 3 ++- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/DOCS/man/en/input.rst b/DOCS/man/en/input.rst index 0e98731d96..568d7e737e 100644 --- a/DOCS/man/en/input.rst +++ b/DOCS/man/en/input.rst @@ -110,7 +110,8 @@ List of Input Commands see the ``--hr-seek-demuxer-offset`` option). Video filters or other video postprocessing that modifies timing of frames (e.g. deinterlacing) should usually work, but might make backstepping silently behave incorrectly in - corner cases. + corner cases. Using ``--hr-seek-framedrop=no`` should help, although it + might make precise seeking slower. This does not work with audio-only playback. diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index bb178ce448..d4e51d172a 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -1078,6 +1078,15 @@ OPTIONS the earlier demuxer position and the real target may be unnecessarily decoded. +``--hr-seek-framedrop=`` + Allow the video decoder to drop frames during seek, if these frames are + before the seek target. If this is enabled, precise seeking can be faster, + but if you're using video filters which modify timestamps or add new + frames, it can lead to precise seeking skipping the target frame. This + e.g. can break frame backstepping when deinterlacing is enabled. + + Default: ``yes`` + ``--http-header-fields=`` Set custom HTTP fields when accessing HTTP stream. diff --git a/options/options.c b/options/options.c index e589bf8d61..5674c7dc0d 100644 --- a/options/options.c +++ b/options/options.c @@ -578,6 +578,7 @@ const m_option_t mp_opts[] = { OPT_CHOICE("hr-seek", hr_seek, 0, ({"no", -1}, {"absolute", 0}, {"always", 1}, {"yes", 1})), OPT_FLOATRANGE("hr-seek-demuxer-offset", hr_seek_demuxer_offset, 0, -9, 99), + OPT_FLAG("hr-seek-framedrop", hr_seek_framedrop, 0), OPT_CHOICE_OR_INT("autosync", autosync, 0, 0, 10000, ({"no", -1})), @@ -685,6 +686,7 @@ const struct MPOpts mp_default_opts = { .ordered_chapters = 1, .chapter_merge_threshold = 100, .chapter_seek_threshold = 5.0, + .hr_seek_framedrop = 1, .load_config = 1, .position_resume = 1, .stream_cache_min_percent = 20.0, diff --git a/options/options.h b/options/options.h index 6cad8b4e87..c9d0d82cf7 100644 --- a/options/options.h +++ b/options/options.h @@ -121,6 +121,7 @@ typedef struct MPOpts { int initial_audio_sync; int hr_seek; float hr_seek_demuxer_offset; + int hr_seek_framedrop; float audio_delay; float default_max_pts_correction; int autosync; diff --git a/player/video.c b/player/video.c index 688384d1de..128e2916ae 100644 --- a/player/video.c +++ b/player/video.c @@ -318,7 +318,8 @@ static int decode_image(struct MPContext *mpctx) if (pkt && pkt->pts != MP_NOPTS_VALUE) pkt->pts += mpctx->video_offset; if ((pkt && pkt->pts >= mpctx->hrseek_pts - .005) || - d_video->has_broken_packet_pts) + d_video->has_broken_packet_pts || + !mpctx->opts->hr_seek_framedrop) { mpctx->hrseek_framedrop = false; } -- cgit v1.2.3