From 6337bc27ffb4d89b0c2a4a97c712e2b97a05bcd4 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Sun, 2 Jun 2024 18:56:48 -0400 Subject: [PATCH] osc.lua: add option to make rendering smoother OSC rendering used to be smooth (up to OSD rendering fps) before 48f906249ef359c66fc6c5bf4cc5885c8293bf8e, but after that commit the frame duration is hardcoded to 30 ms. This is too high and results in choppy OSC rendering, which is very noticeable with the progress bar while moving mouse over it or playing a short 60 fps video. This makes the duration an option so that it can be decreased to make OSC rendering smoother. --- DOCS/man/osc.rst | 6 ++++++ player/lua/osc.lua | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst index 978dc4647d..1d33065f14 100644 --- a/DOCS/man/osc.rst +++ b/DOCS/man/osc.rst @@ -472,6 +472,12 @@ Configurable Options Sets the colors of the elements that are being pressed or held down. +``tick_delay`` + Default: 1/60 + + Sets the minimum interval between OSC redraws in seconds. This can be + decreased on fast systems to make OSC rendering smoother. + Script Commands ~~~~~~~~~~~~~~~ diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 0cf86694e7..d828547f3e 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -69,7 +69,9 @@ local user_opts = { top_buttons_color = "#FFFFFF", -- color of top buttons held_element_color = "#999999", -- color of an element while held down - time_pos_outline_color = "#000000" -- color of the border timecodes in slimbox and TimePosBar + time_pos_outline_color = "#000000", -- color of the border timecodes in slimbox and TimePosBar + + tick_delay = 1 / 60, -- minimum interval between OSC redraws in seconds } local osc_param = { -- calculated by osc_init() @@ -90,7 +92,7 @@ local margins_opts = { {"b", "video-margin-ratio-bottom"}, } -local tick_delay = 0.03 +local tick_delay = 1 / 60 local tracks_osc = {} local tracks_mpv = {} local window_control_box_width = 80 @@ -2980,6 +2982,7 @@ end opt.read_options(user_opts, "osc", function() validate_user_opts() set_osc_styles() + tick_delay = user_opts.tick_delay request_tick() visibility_mode(user_opts.visibility, true) update_duration_watch()