History

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.

nanahi committed 2 years ago

Commit 0c741991 parent e61911c3 files · +14 −4Browse files

Unified · Split

3 files
  1. DOCS/interface-changes/osdscale.txt +1 −0
  2. DOCS/man/osc.rst +4 −2
  3. player/lua/osc.lua +9 −2
DOCS/interface-changes/osdscale.txt+1−0
@@ -0,0 +1 @@
1+change `vidscale` script option type to string for osc.lua
DOCS/man/osc.rst+4−2
@@ -250,8 +250,10 @@ Configurable Options · 249 unmodified lines
250250 ``vidscale``
251251 Default: yes
252252
253− Scale the OSC with the video
254− ``no`` tries to keep the OSC size constant as much as the window size allows
253+ Scale the OSC with the video.
254+ ``no`` tries to keep the OSC size constant as much as the window size allows.
255+ ``auto`` scales the OSC with the OSD, which is scaled with the window or kept at a
256+ constant size, depending on the ``--osd-scale-by-window`` option.
255257
256258 ``valign``
257259 Default: 0.8
player/lua/osc.lua+9−2
@@ -14,7 +14,7 @@ local user_opts = { · 13 unmodified lines
1414 idlescreen = true, -- show mpv logo on idle
1515 scalewindowed = 1, -- scaling of the controller when windowed
1616 scalefullscreen = 1, -- scaling of the controller when fullscreen
17− vidscale = true, -- scale the controller with the video?
17+ vidscale = "yes", -- scale the controller with the video?
1818 valign = 0.8, -- vertical alignment, -1 (top) to 1 (bottom)
1919 halign = 0, -- horizontal alignment, -1 (left) to 1 (right)
2020 barmargin = 0, -- vertical margin of top/bottombar
@@ -1785,7 +1785,14 @@ function osc_init() · 1764 unmodified lines
17851785 scale = user_opts.scalewindowed
17861786 end
17871787
1788− if user_opts.vidscale then
1788+ local scale_with_video
1789+ if user_opts.vidscale == "auto" then
1790+ scale_with_video = mp.get_property_native("osd-scale-by-window")
1791+ else
1792+ scale_with_video = user_opts.vidscale == "yes"
1793+ end
1794+
1795+ if scale_with_video then
17891796 osc_param.unscaled_y = baseResY
17901797 else
17911798 osc_param.unscaled_y = display_h

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t