From 953983ad31ddb63418d9d2ab55c978eaf69fd12a Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 26 Mar 2020 22:50:21 +0100 Subject: 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.) --- player/command.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'player/command.c') 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); -- cgit v1.2.3