mirror of
https://github.com/mpv-player/mpv
synced 2025-01-02 04:42:10 +00:00
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.
This commit is contained in:
parent
2e3ce738f5
commit
8565073f68
@ -933,8 +933,10 @@ Property list
|
||||
``playtime-remaining``
|
||||
``time-remaining`` scaled by the current ``speed``.
|
||||
|
||||
``playback-time``
|
||||
Return the playback time, which is the time difference between start PTS and current PTS.
|
||||
``playback-time`` (RW)
|
||||
The playback time, which is the time relative to playback start. (This can
|
||||
be different from the ``time-pos`` property if the file does not start at
|
||||
position ``0``, in which case ``time-pos`` is the source timestamp.)
|
||||
|
||||
``chapter`` (RW)
|
||||
Current chapter number. The number of the first chapter is 0.
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user