diff options
author | wm4 <wm4@nowhere> | 2014-04-14 22:03:43 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-04-14 22:08:33 +0200 |
commit | 1e3e7bb7f4dd87d767c519c73a0ac6e26bd19c15 (patch) | |
tree | bce7f08b6d5e768aa8b20720bde6de71c16a39f1 | |
parent | e1f1b0c275401c96c5ce776d74aff144359e6495 (diff) | |
download | mpv-1e3e7bb7f4dd87d767c519c73a0ac6e26bd19c15.tar.bz2 mpv-1e3e7bb7f4dd87d767c519c73a0ac6e26bd19c15.tar.xz |
command: add a property to indicate core pause state
Currently this is (probably) equivalent to "paused-for-cache", but the
latter is a bit special, while this new property is a bit more general.
One case where they might actually be different is dvdnav menus, but I
haven't checked.
Also add property change notifications for these two properties.
-rw-r--r-- | DOCS/man/en/input.rst | 5 | ||||
-rw-r--r-- | player/command.c | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/DOCS/man/en/input.rst b/DOCS/man/en/input.rst index d6e3affcad..6b3caa1ec0 100644 --- a/DOCS/man/en/input.rst +++ b/DOCS/man/en/input.rst @@ -754,6 +754,11 @@ Property list ``pause`` (RW) Pause status. This is usually ``yes`` or ``no``. See ``--pause``. +``core-idle`` + Return ``yes`` if the playback core is paused, otherwise ``no``. This can + be different ``pause`` in special situations, such as when the player + pauses itself due to low network cache. + ``cache`` Network cache fill state (0-100). diff --git a/player/command.c b/player/command.c index f9f25efdc3..1bf05bf56e 100644 --- a/player/command.c +++ b/player/command.c @@ -984,6 +984,13 @@ static int mp_property_pause(m_option_t *prop, int action, void *arg, return mp_property_generic_option(prop, action, arg, ctx); } +static int mp_property_core_idle(m_option_t *prop, int action, void *arg, + void *ctx) +{ + MPContext *mpctx = ctx; + return m_property_int_ro(prop, action, arg, mpctx->paused); +} + static int mp_property_cache(m_option_t *prop, int action, void *arg, void *ctx) { @@ -2243,6 +2250,8 @@ static const m_option_t mp_properties[] = { M_PROPERTY("chapter-metadata", mp_property_chapter_metadata), M_PROPERTY( "vf-metadata", mp_property_vf_metadata), M_OPTION_PROPERTY_CUSTOM("pause", mp_property_pause), + { "core-idle", mp_property_core_idle, CONF_TYPE_FLAG, + M_OPT_RANGE, 0, 1, NULL }, { "cache", mp_property_cache, CONF_TYPE_INT }, { "cache-size", mp_property_cache_size, CONF_TYPE_INT, M_OPT_MIN, 0 }, { "paused-for-cache", mp_property_paused_for_cache, CONF_TYPE_FLAG, @@ -2380,8 +2389,8 @@ const char **mp_event_property_change[] = { E(MPV_EVENT_TRACK_SWITCHED, "vid", "video", "aid", "audio", "sid", "sub", "secondary-sid"), E(MPV_EVENT_IDLE, "*"), - E(MPV_EVENT_PAUSE, "pause"), - E(MPV_EVENT_UNPAUSE, "pause"), + E(MPV_EVENT_PAUSE, "pause", "paused-on-cache", "core-idle"), + E(MPV_EVENT_UNPAUSE, "pause", "paused-on-cache", "core-idle"), E(MPV_EVENT_TICK, "time-pos", "stream-pos", "stream-time-pos", "avsync", "percent-pos", "time-remaining", "playtime-remaining"), E(MPV_EVENT_VIDEO_RECONFIG, "video-out-params", "video-params", |