stats.lua: add 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 10:08:06 -04:00 committed by Kacper Michajłow
parent 0c74199a8f
commit 1f29d037a0
3 changed files with 12 additions and 2 deletions

View File

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

View File

@ -203,6 +203,8 @@ Configurable Options
Scale the text and graphs with the video.
``no`` tries to keep the sizes constant.
``auto`` scales the text and graphs with the OSD, which is scaled with the
window or kept at a constant size, depending on the ``--osd-scale-by-window`` option.
Note: colors are given as hexadecimal values and use ASS tag order: BBGGRR
(blue green red).

View File

@ -60,7 +60,7 @@ local o = {
shadow_y_offset = 0.0,
shadow_color = "",
alpha = "11",
vidscale = true,
vidscale = "yes",
-- Custom header for ASS tags to style the text output.
-- Specifying this will ignore the text style values above and just
@ -1354,9 +1354,16 @@ local function print_page(page, after_scroll)
end
local function update_scale(_, value)
local scale_with_video
if o.vidscale == "auto" then
scale_with_video = mp.get_property_native("osd-scale-by-window")
else
scale_with_video = o.vidscale == "yes"
end
-- Calculate scaled metrics.
local scale = 1
if not o.vidscale and value > 0 then
if not scale_with_video and value > 0 then
scale = 720 / value
end
font_size = o.font_size * scale