summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-07 22:07:07 +0200
committerwm4 <wm4@nowhere>2014-10-07 22:13:36 +0200
commit3cbd79b35b6c17ea35f23ae8820a22778e507b71 (patch)
tree6e8e9506ef64eb2a4044f4e44b5104db9572ea7f /player/command.c
parent5feec17ca8ef7c0959b8a0cc17b7937c44a29378 (diff)
downloadmpv-3cbd79b35b6c17ea35f23ae8820a22778e507b71.tar.bz2
mpv-3cbd79b35b6c17ea35f23ae8820a22778e507b71.tar.xz
command: add cache-buffering-state property
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 4b1f37288c..758a62a8d9 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1198,6 +1198,16 @@ static int mp_property_paused_for_cache(void *ctx, struct m_property *prop,
return m_property_flag_ro(action, arg, mpctx->paused_for_cache);
}
+static int mp_property_cache_buffering(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ double state = get_cache_buffering_percentage(mpctx);
+ if (state < 0)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_int_ro(action, arg, state * 100);
+}
+
static int mp_property_clock(void *ctx, struct m_property *prop,
int action, void *arg)
{
@@ -2757,6 +2767,7 @@ static const struct m_property mp_properties[] = {
{"cache-idle", mp_property_cache_idle},
{"demuxer-cache-duration", mp_property_demuxer_cache_duration},
{"demuxer-cache-idle", mp_property_demuxer_cache_idle},
+ {"cache-buffering-state", mp_property_cache_buffering},
{"paused-for-cache", mp_property_paused_for_cache},
{"pts-association-mode", mp_property_generic_option},
{"hr-seek", mp_property_generic_option},