summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-17 22:56:45 +0100
committerwm4 <wm4@nowhere>2014-12-17 22:56:45 +0100
commitc721948efe497d0e1951bddeec9e7a60c6763945 (patch)
treee8fff959abf30a04d97ce96a0749a3dbc0d19b74 /player
parent649e337f4d5efce70211de22b6573230f5b77f0a (diff)
downloadmpv-c721948efe497d0e1951bddeec9e7a60c6763945.tar.bz2
mpv-c721948efe497d0e1951bddeec9e7a60c6763945.tar.xz
command: extend revert_seek command
"revert_seek mark" basically forces the seekback point. It's basically a one-way bookmark.
Diffstat (limited to 'player')
-rw-r--r--player/command.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c
index dc26c354ae..52eebe12ec 100644
--- a/player/command.c
+++ b/player/command.c
@@ -76,6 +76,7 @@ struct command_ctx {
double last_seek_time;
double last_seek_pts;
+ double marked_pts;
double prev_pts;
@@ -4054,8 +4055,13 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (!mpctx->num_sources)
return -1;
double oldpts = cmdctx->last_seek_pts;
- if (oldpts != MP_NOPTS_VALUE) {
+ if (cmdctx->marked_pts != MP_NOPTS_VALUE)
+ oldpts = cmdctx->marked_pts;
+ if (cmd->args[0].v.i == 1) {
+ cmdctx->marked_pts = get_current_time(mpctx);
+ } else if (oldpts != MP_NOPTS_VALUE) {
cmdctx->last_seek_pts = get_current_time(mpctx);
+ cmdctx->marked_pts = MP_NOPTS_VALUE;
queue_seek(mpctx, MPSEEK_ABSOLUTE, oldpts, 1, false);
set_osd_function(mpctx, OSD_REW);
if (bar_osd)
@@ -4685,8 +4691,10 @@ static void command_event(struct MPContext *mpctx, int event, void *arg)
struct command_ctx *ctx = mpctx->command_ctx;
struct MPOpts *opts = mpctx->opts;
- if (event == MPV_EVENT_START_FILE)
+ if (event == MPV_EVENT_START_FILE) {
ctx->last_seek_pts = MP_NOPTS_VALUE;
+ ctx->marked_pts = MP_NOPTS_VALUE;
+ }
if (event == MPV_EVENT_TICK) {
double now =