osc: Display cache fill status

The OSC will now display cache fill status between the timecodes, but only if it's below 48% to not clutter the interface with erratically changing values.

By default, the displayed value is multiplied by 2 to not confuse users who are unfamillar with the inner workings of the caching system. This can be disabled using the iAmAProgrammer=true setting.
This commit is contained in:
ChrisK2 2013-10-07 00:04:35 +02:00
parent 99adbe1e7c
commit f3556356b7
1 changed files with 21 additions and 1 deletions

View File

@ -20,7 +20,7 @@ local user_opts = {
halign = 0, -- horizontal alignment, -1 (left) to 1 (right)
fadeduration = 200, -- duration of fade out in ms, 0 = no fade
deadzonedist = 0.15, -- distance between OSC and deadzone
iAmAProgrammer = false, -- use native mpv counting and disable OSC internal playlist management (and some functions that depend on it)
iAmAProgrammer = false, -- use native mpv values and disable OSC internal playlist management (and some functions that depend on it)
}
local osc_param = {
@ -954,6 +954,26 @@ function osc_init()
eventresponder.mouse_btn0_up = function () state.tc_ms = not state.tc_ms end
register_button(posX - pos_offsetX, bottomrowY, 4, 110, 18, osc_styles.timecodes, contentF, eventresponder, metainfo)
-- center (Cache)
local metainfo = {}
local eventresponder = {}
local contentF = function (ass)
local cache = mp.property_get("cache")
if not (cache == nil) then
cache = tonumber(mp.property_get("cache"))
if (cache < 48) then
if not (user_opts.iAmAProgrammer) then
ass:append("Cache: " .. (cache*2) .."%")
else
ass:append("Cache: " .. (cache) .."%")
end
end
end
end
register_button(posX, bottomrowY, 5, 110, 18, osc_styles.timecodes, contentF, eventresponder, metainfo)
-- right (total/remaining time)
-- do we have a usuable duration?
local metainfo = {}