summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-26 22:50:21 +0100
committerwm4 <wm4@nowhere>2020-03-26 22:50:21 +0100
commit953983ad31ddb63418d9d2ab55c978eaf69fd12a (patch)
tree813bd1c855f4513ac0ab2b5b02c21361672c9c53
parent537f011c6d07eb56116f44e6bd4f841b392d97f6 (diff)
downloadmpv-953983ad31ddb63418d9d2ab55c978eaf69fd12a.tar.bz2
mpv-953983ad31ddb63418d9d2ab55c978eaf69fd12a.tar.xz
command: make revert seek command use time from end of seek
This time is set on every seek (but when initiating it). A new seek longer than 2 seconds after this is counted as separate seek for the sake of the revert seek command. If a seek takes a bit longer, this removes time from these 2 seconds. This commits resets it on the end of the seek. (Doing anything special for seeks that take longer than 2 seconds is out of scope of this commit.)
-rw-r--r--player/command.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 242e7e2836..5984d6c5b3 100644
--- a/player/command.c
+++ b/player/command.c
@@ -6109,6 +6109,9 @@ static void command_event(struct MPContext *mpctx, int event, void *arg)
ctx->marked_pts = MP_NOPTS_VALUE;
}
+ if (event == MPV_EVENT_PLAYBACK_RESTART)
+ ctx->last_seek_time = mp_time_sec();
+
if (event == MPV_EVENT_END_FILE || event == MPV_EVENT_FILE_LOADED) {
// Update chapters - does nothing if something else is visible.
set_osd_bar_chapters(mpctx, OSD_BAR_SEEK);