player/command: alias playback-time to time-pos

Since 7fc4bac29f, playback-time and
time-pos will now always have exactly the same values. Both properties
are commonly used, so just make playback-time an alias for
time-pos and document it.
This commit is contained in:
Dudemanguy 2024-06-18 09:39:46 -05:00
parent 42a4c306ec
commit bab9b2cf4e
2 changed files with 8 additions and 22 deletions

View File

@ -2112,11 +2112,11 @@ Property list
``time-remaining`` with milliseconds.
``audio-pts``
Current audio playback position in current file in seconds. Unlike time-pos,
Current audio playback position in current file in seconds. Unlike ``time-pos``,
this updates more often than once per frame. This is mostly equivalent to
time-pos for audio-only files however it also takes into account the audio
``time-pos`` for audio-only files however it also takes into account the audio
driver delay. This can lead to negative values in certain cases, so in
general you probably want to simply use time-pos.
general you probably want to simply use ``time-pos``.
This has a sub-property:
@ -2132,10 +2132,10 @@ Property list
``playtime-remaining`` with milliseconds.
``playback-time`` (RW)
Position in current file in seconds. Unlike ``time-pos``, the time is
clamped to the range of the file. (Inaccurate file durations etc. could
make it go out of range. Useful on attempts to seek outside of the file,
as the seek target time is considered the current position during seeking.)
Alias for ``time-pos``.
Prior to mpv 0.39.0, ``time-pos`` and ``playback-time`` could report
different values in certain edge cases.
This has a sub-property:

View File

@ -870,20 +870,6 @@ static int mp_property_playtime_remaining(void *ctx, struct m_property *prop,
return property_time(action, arg, remaining / speed);
}
static int mp_property_playback_time(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
if (!mpctx->playback_initialized)
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_SET) {
queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, MPSEEK_DEFAULT, 0);
return M_PROPERTY_OK;
}
return property_time(action, arg, get_playback_time(mpctx));
}
/// Current chapter (RW)
static int mp_property_chapter(void *ctx, struct m_property *prop,
int action, void *arg)
@ -4009,7 +3995,7 @@ static const struct m_property mp_properties_base[] = {
{"time-remaining", mp_property_remaining},
{"audio-pts", mp_property_audio_pts},
{"playtime-remaining", mp_property_playtime_remaining},
{"playback-time", mp_property_playback_time},
M_PROPERTY_ALIAS("playback-time", "time-pos"),
{"chapter", mp_property_chapter},
{"edition", mp_property_edition},
{"current-edition", mp_property_current_edition},