1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-11 17:39:38 +00:00

options, core/hrseek: add --hr-seek-demuxer-offset

Some demuxers do not accurately seek to a keyframe before a given
time but instead start too late. This means that precise seeks cannot
work either. Most notably the libavformat mpeg demuxer exhibits this
behavior depending on the file being played (with the internal mpeg
demuxer precise seeks don't work at all). Add new option
--hr-seek-demuxer-offset which can be used as a workaround with such
demuxers. The value of the option is subtracted from the seek target
position given to the demuxer when doing a precise seek.
This commit is contained in:
Uoti Urpala 2011-11-06 16:54:57 +02:00
parent 0aa8df2b7d
commit 7b9908dda8
3 changed files with 4 additions and 0 deletions

View File

@ -901,6 +901,7 @@ const m_option_t mplayer_opts[]={
OPT_MAKE_FLAGS("initial-audio-sync", initial_audio_sync, 0),
OPT_CHOICE("hr-seek", hr_seek, 0,
({"off", -1}, {"absolute", 0}, {"always", 1}, {"on", 1})),
OPT_FLOATRANGE("hr-seek-demuxer-offset", hr_seek_demuxer_offset, 0, -9, 99),
OPT_FLAG_CONSTANTS("noautosync", autosync, 0, 0, -1),
OPT_INTRANGE("autosync", autosync, 0, 0, 10000),

View File

@ -3306,6 +3306,8 @@ static int seek(MPContext *mpctx, struct seek_params seek,
else if (seek.direction > 0)
demuxer_style |= SEEK_FORWARD;
if (hr_seek)
demuxer_amount -= opts->hr_seek_demuxer_offset;
int seekresult = demux_seek(mpctx->demuxer, demuxer_amount, audio_delay,
demuxer_style);
if (need_reset)

View File

@ -54,6 +54,7 @@ typedef struct MPOpts {
int user_pts_assoc_mode;
int initial_audio_sync;
int hr_seek;
float hr_seek_demuxer_offset;
int autosync;
int softsleep;
int rtc;