From f3556356b79848ae54232c93aa9e404c1fde6f4d Mon Sep 17 00:00:00 2001 From: ChrisK2 Date: Mon, 7 Oct 2013 00:04:35 +0200 Subject: 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. --- mpvcore/lua/osc.lua | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'mpvcore') diff --git a/mpvcore/lua/osc.lua b/mpvcore/lua/osc.lua index aa3bb44ea5..7a5c582e1a 100644 --- a/mpvcore/lua/osc.lua +++ b/mpvcore/lua/osc.lua @@ -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 = {} -- cgit v1.2.3