]> git.sesse.net Git - ultimatescore/commitdiff
Add a multiviewer output that may or may not be useful for debugging purposes.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 17 Feb 2020 23:46:55 +0000 (00:46 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 17 Feb 2020 23:49:53 +0000 (00:49 +0100)
nageru/ultimate.lua
nageru/white.png [new file with mode: 0644]

index 4fff536b3973037e5979aa91b28f34c90431800e..566b465c65c1be8784e4ff258ccc252819752414 100644 (file)
@@ -62,6 +62,7 @@ iptv_video:change_rate(10.0)
 
 local static_image = ImageInput.new(cef_path .. "/nageru/dsn-bg.png")
 local first_frame = true
+local multiviewer_enabled = false
 
 function reload_cef()
        cef_input:reload()
@@ -72,6 +73,10 @@ function disconnect_iptv()
        iptv_video:disconnect()
 end
 
+function toggle_multiviewer()
+       multiviewer_enabled = not multiviewer_enabled
+end
+
 -- An overlay with variable alpha.
 function make_overlay(scene, base)
        local image = scene:add_input(cef_input)
@@ -192,7 +197,6 @@ function make_simple_scene()
        scene.scene:finalize()
        return scene
 end
-
 local simple_scene = make_simple_scene()
 
 -- Load all the stinger frames.
@@ -223,6 +227,36 @@ local overlay_scene_lq = Scene.new(16, 9)
 local overlay_scene_lq_input = overlay_scene_lq:add_input(cef_input)
 overlay_scene_lq:finalize(false)
 
+-- A debugging scene to show a simple multiviewer. HQ only, since there is no preview.
+function make_multiview_scene()
+       local scene = Scene.new(16, 9)
+       local bg = scene:add_input(ImageInput.new(cef_path .. "/nageru/white.png"))
+       local mv_width = 1280 / 3
+       local mv_height = 720 / 3
+       local mv_offset = (720 - mv_height * 2) / 2
+
+       for input_idx=0,5 do
+               local input = scene:add_input(input_idx)
+
+               local resize = scene:add_effect(ResizeEffect.new())
+               resize:set_int("width", mv_width)
+               resize:set_int("height", mv_height)
+
+               local padding = scene:add_effect(IntegralPaddingEffect.new())
+               padding:set_int("width", 1280)
+               padding:set_int("height", 720)
+               padding:set_int("left", (input_idx % 3) * mv_width)
+               padding:set_int("top", math.floor(input_idx / 3) * mv_height + mv_offset)
+
+               local overlay = scene:add_effect(OverlayEffect.new(), bg, padding)
+               bg = overlay
+       end
+
+       scene:finalize(true)
+       return scene
+end
+local multiview_scene_hq = make_multiview_scene()
+
 function needs_scale(signals, signal_num, width, height)
        if signal_num == STATIC_SIGNAL_NUM then
                -- We assume this is already correctly scaled at load time.
@@ -754,6 +788,10 @@ function get_scene(num, t, width, height, signals)
                last_rate = new_rate
        end
 
+       if num == 0 and multiviewer_enabled then  -- Live, with debugging on.
+               return multiview_scene_hq
+       end
+
        if num == 0 then  -- Live.
                -- See if we're in a transition.
                finish_transitions(t)
@@ -1096,5 +1134,6 @@ end
 
 ThemeMenu.set(
        { "Reload overlay", reload_cef },
-       { "Disconnect IPTV", disconnect_iptv }
+       { "Disconnect IPTV", disconnect_iptv },
+       { "Toggle multiviewer", toggle_multiviewer }
 )
diff --git a/nageru/white.png b/nageru/white.png
new file mode 100644 (file)
index 0000000..b962125
Binary files /dev/null and b/nageru/white.png differ