summaryrefslogtreecommitdiffstats
path: root/player/lua/osc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'player/lua/osc.lua')
-rw-r--r--player/lua/osc.lua23
1 files changed, 18 insertions, 5 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index c30e7e3b32..c7d155d0f0 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -116,6 +116,7 @@ local state = {
using_video_margins = false,
border = true,
maximized = false,
+ osd = mp.create_osd_overlay("ass-events"),
}
local window_control_box_width = 80
@@ -127,6 +128,18 @@ local is_december = os.date("*t").month == 12
-- Helperfunctions
--
+function set_osd(res_x, res_y, text)
+ if state.osd.res_x == res_x and
+ state.osd.res_y == res_y and
+ state.osd.data == text then
+ return
+ end
+ state.osd.res_x = res_x
+ state.osd.res_y = res_y
+ state.osd.data = text
+ state.osd:update()
+end
+
local margins_opts = {
{"l", "video-margin-ratio-left"},
{"r", "video-margin-ratio-right"},
@@ -2180,7 +2193,7 @@ end
function render_wipe()
msg.trace("render_wipe()")
- mp.set_osd_ass(0, 0, "{}")
+ state.osd:remove()
end
function render()
@@ -2329,8 +2342,8 @@ function render()
end
-- submit
- mp.set_osd_ass(osc_param.playresy * osc_param.display_aspect,
- osc_param.playresy, ass.text)
+ set_osd(osc_param.playresy * osc_param.display_aspect,
+ osc_param.playresy, ass.text)
end
--
@@ -2466,7 +2479,7 @@ function tick()
ass:pos(320, icon_y+65)
ass:an(8)
ass:append("Drop files or URLs to play here.")
- mp.set_osd_ass(640, 360, ass.text)
+ set_osd(640, 360, ass.text)
if state.showhide_enabled then
mp.disable_key_bindings("showhide")
@@ -2482,7 +2495,7 @@ function tick()
render()
else
-- Flush OSD
- mp.set_osd_ass(osc_param.playresy, osc_param.playresy, "")
+ set_osd(osc_param.playresy, osc_param.playresy, "")
end
state.tick_last_time = mp.get_time()