osc.lua: add auto value to vidscale option

This adds auto to vidscale script option, which lets the scale be
inherited from OSD --osd-scale-by-window option.
This commit is contained in:
nanahi 2024-05-16 09:54:34 -04:00 committed by Kacper Michajłow
parent e61911c513
commit 0c74199a8f
3 changed files with 14 additions and 4 deletions

View File

@ -0,0 +1 @@
change `vidscale` script option type to string for osc.lua

View File

@ -250,8 +250,10 @@ Configurable Options
``vidscale``
Default: yes
Scale the OSC with the video
``no`` tries to keep the OSC size constant as much as the window size allows
Scale the OSC with the video.
``no`` tries to keep the OSC size constant as much as the window size allows.
``auto`` scales the OSC with the OSD, which is scaled with the window or kept at a
constant size, depending on the ``--osd-scale-by-window`` option.
``valign``
Default: 0.8

View File

@ -14,7 +14,7 @@ local user_opts = {
idlescreen = true, -- show mpv logo on idle
scalewindowed = 1, -- scaling of the controller when windowed
scalefullscreen = 1, -- scaling of the controller when fullscreen
vidscale = true, -- scale the controller with the video?
vidscale = "yes", -- scale the controller with the video?
valign = 0.8, -- vertical alignment, -1 (top) to 1 (bottom)
halign = 0, -- horizontal alignment, -1 (left) to 1 (right)
barmargin = 0, -- vertical margin of top/bottombar
@ -1785,7 +1785,14 @@ function osc_init()
scale = user_opts.scalewindowed
end
if user_opts.vidscale then
local scale_with_video
if user_opts.vidscale == "auto" then
scale_with_video = mp.get_property_native("osd-scale-by-window")
else
scale_with_video = user_opts.vidscale == "yes"
end
if scale_with_video then
osc_param.unscaled_y = baseResY
else
osc_param.unscaled_y = display_h