diff options
author | wm4 <wm4@nowhere> | 2014-07-31 04:25:39 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-07-31 04:25:39 +0200 |
commit | c1b64cc6937327ab12fcd128bcc6b64d43572c8a (patch) | |
tree | 69b156c472440073e35701878fafa32c45f92367 /player | |
parent | b4f24544bbfdd2bec765db08f5d745fadeb4d111 (diff) | |
download | mpv-c1b64cc6937327ab12fcd128bcc6b64d43572c8a.tar.bz2 mpv-c1b64cc6937327ab12fcd128bcc6b64d43572c8a.tar.xz |
command: add cache-idle property
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/player/command.c b/player/command.c index 27fcadcb29..bd6445e5c7 100644 --- a/player/command.c +++ b/player/command.c @@ -1181,6 +1181,18 @@ static int mp_property_cache_free(void *ctx, struct m_property *prop, return property_int_kb_size((size - size_used) / 1024, action, arg); } +static int mp_property_cache_idle(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + int idle = -1; + if (mpctx->demuxer) + demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_IDLE, &idle); + if (idle < 0) + return M_PROPERTY_UNAVAILABLE; + return m_property_flag_ro(action, arg, !!idle); +} + static int mp_property_paused_for_cache(void *ctx, struct m_property *prop, int action, void *arg) { @@ -2663,6 +2675,7 @@ static const struct m_property mp_properties[] = { {"cache-free", mp_property_cache_free}, {"cache-used", mp_property_cache_used}, {"cache-size", mp_property_cache_size}, + {"cache-idle", mp_property_cache_idle}, {"paused-for-cache", mp_property_paused_for_cache}, {"pts-association-mode", mp_property_generic_option}, {"hr-seek", mp_property_generic_option}, @@ -2792,7 +2805,7 @@ static const char *const *const mp_event_property_change[] = { "samplerate", "channels", "audio"), E(MPV_EVENT_METADATA_UPDATE, "metadata"), E(MPV_EVENT_CHAPTER_CHANGE, "chapter", "chapter-metadata"), - E(MP_EVENT_CACHE_UPDATE, "cache", "cache-free", "cache-used"), + E(MP_EVENT_CACHE_UPDATE, "cache", "cache-free", "cache-used", "cache-idle"), }; #undef E |