diff options
author | wm4 <wm4@nowhere> | 2013-02-17 20:24:59 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-02-17 21:06:28 +0100 |
commit | 8a60122f80af3eb4a5b1110f5377abe6c7137d90 (patch) | |
tree | 47a9106ef860e8758b8fba5e95c56a1ca08c03fc /core/command.c | |
parent | 32500b5e11ad9cae6de8d31e8d51ee98a3cff690 (diff) | |
download | mpv-8a60122f80af3eb4a5b1110f5377abe6c7137d90.tar.bz2 mpv-8a60122f80af3eb4a5b1110f5377abe6c7137d90.tar.xz |
command: add "cache" read-only property
Diffstat (limited to 'core/command.c')
-rw-r--r-- | core/command.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/command.c b/core/command.c index 6baa6f92e5..50fe09c555 100644 --- a/core/command.c +++ b/core/command.c @@ -532,6 +532,15 @@ static int mp_property_pause(m_option_t *prop, int action, void *arg, return M_PROPERTY_NOT_IMPLEMENTED; } +static int mp_property_cache(m_option_t *prop, int action, void *arg, + void *ctx) +{ + MPContext *mpctx = ctx; + int cache = mp_get_cache_percent(mpctx); + if (cache < 0) + return M_PROPERTY_UNAVAILABLE; + return m_property_int_ro(prop, action, arg, cache); +} /// Volume (RW) static int mp_property_volume(m_option_t *prop, int action, void *arg, @@ -1344,6 +1353,7 @@ static const m_option_t mp_properties[] = { 0, 0, 0, NULL }, { "pause", mp_property_pause, CONF_TYPE_FLAG, M_OPT_RANGE, 0, 1, NULL }, + { "cache", mp_property_cache, CONF_TYPE_INT }, M_OPTION_PROPERTY("pts-association-mode"), M_OPTION_PROPERTY("hr-seek"), |