1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

command: add a "seeking" property

The client API exports this state via events already, but maybe it's
better to explicitly provide this property in order to facilitate use on
OSD and similar cases.
This commit is contained in:
wm4 2014-08-08 00:13:27 +02:00
parent 5f042864f5
commit fa682af6ee
2 changed files with 16 additions and 0 deletions

View File

@ -830,6 +830,12 @@ Property list
or enter idle mode), and in these cases the ``eof-reached`` property will or enter idle mode), and in these cases the ``eof-reached`` property will
logically be cleared immediately after it's set. logically be cleared immediately after it's set.
``seeking``
Returns ``yes`` if the player is currently seeking, or otherwise trying
to restart playback. (It's possible that it returns ``yes`` while a file
is loaded, or when switching ordered chapter segments. This is because
the same underlying code is used for seeking and resyncing.)
``pts-association-mode`` (RW) ``pts-association-mode`` (RW)
See ``--pts-association-mode``. See ``--pts-association-mode``.

View File

@ -1084,6 +1084,13 @@ static int mp_property_eof_reached(void *ctx, struct m_property *prop,
return m_property_flag_ro(action, arg, eof); return m_property_flag_ro(action, arg, eof);
} }
static int mp_property_seeking(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
return m_property_flag_ro(action, arg, !mpctx->restart_complete);
}
static int mp_property_cache(void *ctx, struct m_property *prop, static int mp_property_cache(void *ctx, struct m_property *prop,
int action, void *arg) int action, void *arg)
{ {
@ -2695,6 +2702,7 @@ static const struct m_property mp_properties[] = {
{"pause", mp_property_pause}, {"pause", mp_property_pause},
{"core-idle", mp_property_core_idle}, {"core-idle", mp_property_core_idle},
{"eof-reached", mp_property_eof_reached}, {"eof-reached", mp_property_eof_reached},
{"seeking", mp_property_seeking},
{"cache", mp_property_cache}, {"cache", mp_property_cache},
{"cache-free", mp_property_cache_free}, {"cache-free", mp_property_cache_free},
{"cache-used", mp_property_cache_used}, {"cache-used", mp_property_cache_used},
@ -2828,6 +2836,8 @@ static const char *const *const mp_event_property_change[] = {
"width", "height", "fps", "aspect"), "width", "height", "fps", "aspect"),
E(MPV_EVENT_AUDIO_RECONFIG, "audio-format", "audio-codec", "audio-bitrate", E(MPV_EVENT_AUDIO_RECONFIG, "audio-format", "audio-codec", "audio-bitrate",
"samplerate", "channels", "audio"), "samplerate", "channels", "audio"),
E(MPV_EVENT_SEEK, "seeking"),
E(MPV_EVENT_PLAYBACK_RESTART, "seeking"),
E(MPV_EVENT_METADATA_UPDATE, "metadata"), E(MPV_EVENT_METADATA_UPDATE, "metadata"),
E(MPV_EVENT_CHAPTER_CHANGE, "chapter", "chapter-metadata"), E(MPV_EVENT_CHAPTER_CHANGE, "chapter", "chapter-metadata"),
E(MP_EVENT_CACHE_UPDATE, "cache", "cache-free", "cache-used", "cache-idle"), E(MP_EVENT_CACHE_UPDATE, "cache", "cache-free", "cache-used", "cache-idle"),