summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-21 15:51:50 +0200
committerwm4 <wm4@nowhere>2015-08-21 15:53:24 +0200
commit8565073f6825e8ea9b2b9b120f6995029a7db445 (patch)
tree75ea84064af36e3080723703c14cb46b512c07ce /player
parent2e3ce738f566cfa8fbb8b7eb5826fe2fe6b8b8f6 (diff)
downloadmpv-8565073f6825e8ea9b2b9b120f6995029a7db445.tar.bz2
mpv-8565073f6825e8ea9b2b9b120f6995029a7db445.tar.xz
command: make the playback-time property writable
Provides a simplistic way to seek without having to care about weird situations like timestamp vs. playback time. This is good, because the seek command is currently timestamp based, so when using the seek command the user _does_ have to care.
Diffstat (limited to 'player')
-rw-r--r--player/command.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index a74cde2b23..8514be98f7 100644
--- a/player/command.c
+++ b/player/command.c
@@ -686,6 +686,11 @@ static int mp_property_playback_time(void *ctx, struct m_property *prop,
if (!mpctx->playback_initialized)
return M_PROPERTY_UNAVAILABLE;
+ if (action == M_PROPERTY_SET) {
+ double target = get_start_time(mpctx) + *(double *)arg;
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, target, MPSEEK_DEFAULT, true);
+ return M_PROPERTY_OK;
+ }
return property_time(action, arg, get_playback_time(mpctx));
}