| @@ -44,6 +44,7 @@ local user_opts = { · 43 unmodified lines |
| 44 | timems = false, -- display timecodes with milliseconds? | 44 | timems = false, -- display timecodes with milliseconds? |
| 45 | tcspace = 100, -- timecode spacing (compensate font size estimation) | 45 | tcspace = 100, -- timecode spacing (compensate font size estimation) |
| 46 | visibility = "auto", -- only used at init to set visibility_mode(...) | 46 | visibility = "auto", -- only used at init to set visibility_mode(...) |
| | 47 | visibility_modes = "never_auto_always", -- visibility modes to cycle through |
| 47 | boxmaxchars = 80, -- title crop threshold for box layout | 48 | boxmaxchars = 80, -- title crop threshold for box layout |
| 48 | boxvideo = false, -- apply osc_param.video_margins to video | 49 | boxvideo = false, -- apply osc_param.video_margins to video |
| 49 | windowcontrols = "auto", -- whether to show window controls | 50 | windowcontrols = "auto", -- whether to show window controls |
| @@ -255,6 +256,7 @@ local state = { · 205 unmodified lines |
| 255 | maximized = false, | 256 | maximized = false, |
| 256 | osd = mp.create_osd_overlay("ass-events"), | 257 | osd = mp.create_osd_overlay("ass-events"), |
| 257 | chapter_list = {}, -- sorted by time | 258 | chapter_list = {}, -- sorted by time |
| | 259 | visibility_modes = {}, -- visibility_modes to cycle through |
| 258 | osc_message_warned = false, -- deprecation warnings | 260 | osc_message_warned = false, -- deprecation warnings |
| 259 | osc_chapterlist_warned = false, | 261 | osc_chapterlist_warned = false, |
| 260 | osc_playlist_warned = false, | 262 | osc_playlist_warned = false, |
| @@ -2774,12 +2776,14 @@ end · 2513 unmodified lines |
| 2774 | -- the modes only affect internal variables and not stored on its own. | 2776 | -- the modes only affect internal variables and not stored on its own. |
| 2775 | local function visibility_mode(mode, no_osd) | 2777 | local function visibility_mode(mode, no_osd) |
| 2776 | if mode == "cycle" then | 2778 | if mode == "cycle" then |
| 2777 | if not state.enabled then | 2779 | for i, allowed_mode in ipairs(state.visibility_modes) do |
| 2778 | mode = "auto" | 2780 | if i == #state.visibility_modes then |
| 2779 | elseif user_opts.visibility ~= "always" then | 2781 | mode = state.visibility_modes[1] |
| 2780 | mode = "always" | 2782 | break |
| 2781 | else | 2783 | elseif user_opts.visibility == allowed_mode then |
| 2782 | mode = "never" | 2784 | mode = state.visibility_modes[i + 1] |
| | 2785 | break |
| | 2786 | end |
| 2783 | end | 2787 | end |
| 2784 | end | 2788 | end |
| 2785 | | 2789 | |
| @@ -2907,6 +2911,14 @@ local function validate_user_opts() · 121 unmodified lines |
| 2907 | msg.warn("'" .. color .. "' is not a valid color") | 2911 | msg.warn("'" .. color .. "' is not a valid color") |
| 2908 | end | 2912 | end |
| 2909 | end | 2913 | end |
| | 2914 | |
| | 2915 | for str in string.gmatch(user_opts.visibility_modes, "([^_]+)") do |
| | 2916 | if str ~= "auto" and str ~= "always" and str ~= "never" then |
| | 2917 | msg.warn("Ignoring unknown visibility mode '" .. str .."' in list") |
| | 2918 | else |
| | 2919 | table.insert(state.visibility_modes, str) |
| | 2920 | end |
| | 2921 | end |
| 2910 | end | 2922 | end |
| 2911 | | 2923 | |
| 2912 | -- read options from config and command-line | 2924 | -- read options from config and command-line |