1
mirror of https://github.com/mpv-player/mpv synced 2024-10-22 08:51:57 +02:00

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.)
This commit is contained in:
wm4 2017-12-17 22:19:38 +01:00 committed by Stefano Pigozzi
parent 822b247d10
commit 62cf960ef0

View File

@ -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