diff options
author | ChrisK2 <spam@kalania.de> | 2013-10-07 00:04:35 +0200 |
---|---|---|
committer | ChrisK2 <spam@kalania.de> | 2013-10-07 00:04:35 +0200 |
commit | f3556356b79848ae54232c93aa9e404c1fde6f4d (patch) | |
tree | 0cbc769c3aa97c5941b3f63a87be3866bbb4fb4e /mpvcore | |
parent | 99adbe1e7ca136f98ba542a86bfbd5907ac0fc09 (diff) | |
download | mpv-f3556356b79848ae54232c93aa9e404c1fde6f4d.tar.bz2 mpv-f3556356b79848ae54232c93aa9e404c1fde6f4d.tar.xz |
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.
Diffstat (limited to 'mpvcore')
-rw-r--r-- | mpvcore/lua/osc.lua | 22 |
1 files changed, 21 insertions, 1 deletions
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 = {} |