summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-17 22:19:38 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2017-12-23 00:32:59 +0100
commit62cf960ef0a6050e8718197320ab47ce037cee8e (patch)
treef73a05c8c2f106fbbbd8fbc005f038fc11952be5
parent822b247d10fe14c83e8d31223a3922f68695a196 (diff)
downloadmpv-62cf960ef0a6050e8718197320ab47ce037cee8e.tar.bz2
mpv-62cf960ef0a6050e8718197320ab47ce037cee8e.tar.xz
osc: show demuxer cache buffered amount in bytes
Same as previous commit, but for the OSC. (A bit of a waste to request demuxer-cache-state at least twice per frame, but the OSC queries so many properties it probably doesn't matter anymore.)
-rw-r--r--player/lua/osc.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index b0e0638730..a0f37f445f 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -1835,12 +1835,16 @@ function osc_init()
ne.content = function ()
local dmx_cache = mp.get_property_number("demuxer-cache-duration")
- local cache_used = mp.get_property_number("cache-used")
+ local cache_used = mp.get_property_number("cache-used", 0)
+ local dmx_cache_state = mp.get_property_native("demuxer-cache-state", {})
local is_network = mp.get_property_native("demuxer-via-network")
if dmx_cache then
dmx_cache = string.format("%3.0fs", dmx_cache)
end
- if cache_used then
+ if dmx_cache_state["fw-bytes"] then
+ cache_used = cache_used + dmx_cache_state["fw-bytes"] / 1024
+ end
+ if cache_used > 0 then
local suffix = " KiB"
if (cache_used >= 1024) then
cache_used = cache_used/1024