]> git.sesse.net Git - ultimatescore/commitdiff
Integrate the stinger in the theme.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 17 Oct 2018 23:01:26 +0000 (01:01 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 17 Oct 2018 23:01:26 +0000 (01:01 +0200)
26 files changed:
nageru/ultimate.lua
stinger/blur000.png [new file with mode: 0644]
stinger/blur001.png [new file with mode: 0644]
stinger/blur002.png [new file with mode: 0644]
stinger/blur003.png [new file with mode: 0644]
stinger/blur004.png [new file with mode: 0644]
stinger/blur005.png [new file with mode: 0644]
stinger/blur006.png [new file with mode: 0644]
stinger/blur007.png [new file with mode: 0644]
stinger/blur008.png [new file with mode: 0644]
stinger/blur009.png [new file with mode: 0644]
stinger/blur010.png [new file with mode: 0644]
stinger/blur011.png [new file with mode: 0644]
stinger/blur012.png [new file with mode: 0644]
stinger/blur013.png [new file with mode: 0644]
stinger/blur014.png [new file with mode: 0644]
stinger/blur015.png [new file with mode: 0644]
stinger/blur016.png [new file with mode: 0644]
stinger/blur017.png [new file with mode: 0644]
stinger/blur018.png [new file with mode: 0644]
stinger/blur019.png [new file with mode: 0644]
stinger/blur020.png [new file with mode: 0644]
stinger/blur021.png [new file with mode: 0644]
stinger/blur022.png [new file with mode: 0644]
stinger/blur023.png [new file with mode: 0644]
stinger/blur024.png [new file with mode: 0644]

index 277c333056096aafb258ae8aa9afabfeba39262c..57436cfc0dc50502f60d6b38763809e8177dc05d 100644 (file)
@@ -23,6 +23,11 @@ local state = {
        overlay_alpha_dst = 1.0,
        overlay_enabled = false,
 
+       stinger_in_progress = false,
+       stinger_frame = 0,
+       stinger_src_signal = 0,
+       stinger_dst_signal = 0,
+
        live_signal_num = 0,
        preview_signal_num = 1
 }
@@ -270,8 +275,7 @@ local sbs_chains = make_cartesian_product({
        return make_sbs_chain(input0_type, input0_overlay, input1_type, hq)
 end)
 
--- A chain to show a single input on screen.
-function make_simple_chain(input_deint, input_video, input_scale, has_overlay, hq)
+function make_simple_chain_no_finalize(input_deint, input_video, input_scale, has_overlay, hq)
        local chain = EffectChain.new(16, 9)
 
        local input
@@ -294,8 +298,6 @@ function make_simple_chain(input_deint, input_video, input_scale, has_overlay, h
        local wb_effect = chain:add_effect(WhiteBalanceEffect.new())
        local overlay = possibly_make_overlay(has_overlay, chain, wb_effect)
 
-       chain:finalize(hq)
-
        return {
                chain = chain,
                input = input,
@@ -306,6 +308,13 @@ function make_simple_chain(input_deint, input_video, input_scale, has_overlay, h
        }
 end
 
+-- A chain to show a single input on screen.
+function make_simple_chain(input_deint, input_video, input_scale, has_overlay, hq)
+       local chain = make_simple_chain_no_finalize(input_deint, input_video, input_scale, has_overlay, hq)
+       chain.chain:finalize(hq)
+       return chain
+end
+
 -- Make all possible combinations of single-input chains.
 local simple_chains = make_cartesian_product({
        {"video", "live", "livedeint"},  -- input_type
@@ -318,6 +327,36 @@ local simple_chains = make_cartesian_product({
        return make_simple_chain(input_deint, input_video, input_scale, has_overlay, hq)
 end)
 
+-- A chain to show a single input on screen, with a stinger on top.
+function make_stinger_chain(input_deint, input_video, input_scale, has_overlay, stinger_frame, hq)
+       local chain = make_simple_chain_no_finalize(input_deint, input_video, input_scale, has_overlay, hq)
+       local filename = cef_path .. "/stinger/blur" .. string.rep("0", 3 - string.len(tostring(stinger_frame))) .. stinger_frame .. ".png"
+
+       local last
+       if has_overlay then
+               last = chain.overlay.overlay_effect
+       else
+               last = chain.wb_effect
+       end
+       local input = chain.chain:add_effect(ImageInput.new(filename))
+       chain.chain:add_effect(OverlayEffect.new(), last, input)
+       chain.chain:finalize(hq)
+       return chain
+end
+
+-- Single-input chains with various stinger frames on top.
+local stinger_chains = make_cartesian_product({
+       {"video", "live", "livedeint"},  -- input_type
+       {true, false},          -- input_scale
+       {true, false},          -- has_overlay
+       {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24},  -- stinger_frame
+       {true, false}           -- hq
+}, function(input_type, input_scale, has_overlay, stinger_frame, hq)
+       local input_deint = (input_type == "livedeint")
+       local input_video = (input_type == "video")
+       return make_stinger_chain(input_deint, input_video, input_scale, has_overlay, stinger_frame, hq)
+end)
+
 -- A chain to show a single static picture on screen. Never with HTML overlay.
 local static_chains = make_cartesian_product({
        {true, false}            -- hq
@@ -574,6 +613,11 @@ function get_transitions(t)
                return {}
        end
 
+       if (is_plain_signal(state.live_signal_num) and state.preview_signal_num == VIDEO_SIGNAL_NUM) or
+          (is_plain_signal(state.preview_signal_num) and state.live_signal_num == VIDEO_SIGNAL_NUM) then
+               return {"Cut", "Sting", "Fade"}
+       end
+
        if (is_plain_signal(state.live_signal_num) or state.live_signal_num == STATIC_SIGNAL_NUM) and
           (is_plain_signal(state.preview_signal_num) or state.preview_signal_num == STATIC_SIGNAL_NUM) then
                return {"Cut", "", "Fade"}
@@ -601,6 +645,7 @@ function start_transition(type_, t, duration)
        state.transition_type = type_
        state.transition_src_signal = state.live_signal_num
        state.transition_dst_signal = state.preview_signal_num
+       state.stinger_in_progress = false
        swap_preview_live()
 end
 
@@ -645,8 +690,9 @@ function transition_clicked(num, t)
                end
 
                swap_preview_live()
+               state.stinger_in_progress = false
        elseif num == 1 then
-               -- Zoom.
+               -- Zoom or sting.
                finish_transitions(t)
 
                if state.live_signal_num == state.preview_signal_num then
@@ -654,10 +700,26 @@ function transition_clicked(num, t)
                        return
                end
 
+               if (is_plain_signal(state.live_signal_num) and state.preview_signal_num == VIDEO_SIGNAL_NUM) or
+                  (is_plain_signal(state.preview_signal_num) and state.live_signal_num == VIDEO_SIGNAL_NUM) then
+                       -- Sting.
+                       if stinger_in_progress then
+                               return
+                       end
+
+                       io.write("Inserting stinger from " .. state.live_signal_num .. " to " .. state.live_signal_num .. "\n")
+                       state.stinger_in_progress = true
+                       state.stinger_frame = 0
+                       state.stinger_src_signal = state.live_signal_num
+                       state.stinger_dst_signal = state.preview_signal_num
+                       return
+               end
+
                if is_plain_signal(state.live_signal_num) and is_plain_signal(state.preview_signal_num) then
                        -- We can't zoom between these. Just make a cut.
                        io.write("Cutting from " .. state.live_signal_num .. " to " .. state.live_signal_num .. "\n")
                        swap_preview_live()
+                       state.stinger_in_progress = false
                        return
                end
 
@@ -838,7 +900,18 @@ function get_chain(num, t, width, height, signals)
                        local input_type = get_input_type(signals, state.live_signal_num)
                        local input_scale = needs_scale(signals, state.live_signal_num, width, height)
                        local overlay_really_enabled = state.overlay_enabled and simple_signal_has_overlay(state.live_signal_num)
-                       local chain = simple_chains[input_type][input_scale][overlay_really_enabled][true]
+                       local chain
+                       if state.stinger_in_progress then
+                               chain = stinger_chains[input_type][input_scale][overlay_really_enabled][state.stinger_frame][true]
+                               state.stinger_frame = state.stinger_frame + 1
+                               if state.stinger_frame >= 25 then
+                                       state.stinger_in_progress = false
+                                       state.preview_signal_num = state.stinger_src_signal
+                                       state.live_signal_num = state.stinger_dst_signal
+                               end
+                       else
+                               chain = simple_chains[input_type][input_scale][overlay_really_enabled][true]
+                       end
                        local prepare = function()
                                if input_type ~= "video" then
                                        chain.input:connect_signal(state.live_signal_num)
diff --git a/stinger/blur000.png b/stinger/blur000.png
new file mode 100644 (file)
index 0000000..13729e1
Binary files /dev/null and b/stinger/blur000.png differ
diff --git a/stinger/blur001.png b/stinger/blur001.png
new file mode 100644 (file)
index 0000000..de0860a
Binary files /dev/null and b/stinger/blur001.png differ
diff --git a/stinger/blur002.png b/stinger/blur002.png
new file mode 100644 (file)
index 0000000..2cbed03
Binary files /dev/null and b/stinger/blur002.png differ
diff --git a/stinger/blur003.png b/stinger/blur003.png
new file mode 100644 (file)
index 0000000..bddef10
Binary files /dev/null and b/stinger/blur003.png differ
diff --git a/stinger/blur004.png b/stinger/blur004.png
new file mode 100644 (file)
index 0000000..aac495b
Binary files /dev/null and b/stinger/blur004.png differ
diff --git a/stinger/blur005.png b/stinger/blur005.png
new file mode 100644 (file)
index 0000000..e35e1f8
Binary files /dev/null and b/stinger/blur005.png differ
diff --git a/stinger/blur006.png b/stinger/blur006.png
new file mode 100644 (file)
index 0000000..8f9d022
Binary files /dev/null and b/stinger/blur006.png differ
diff --git a/stinger/blur007.png b/stinger/blur007.png
new file mode 100644 (file)
index 0000000..6733c7c
Binary files /dev/null and b/stinger/blur007.png differ
diff --git a/stinger/blur008.png b/stinger/blur008.png
new file mode 100644 (file)
index 0000000..cf39687
Binary files /dev/null and b/stinger/blur008.png differ
diff --git a/stinger/blur009.png b/stinger/blur009.png
new file mode 100644 (file)
index 0000000..7fa1cd5
Binary files /dev/null and b/stinger/blur009.png differ
diff --git a/stinger/blur010.png b/stinger/blur010.png
new file mode 100644 (file)
index 0000000..0de701b
Binary files /dev/null and b/stinger/blur010.png differ
diff --git a/stinger/blur011.png b/stinger/blur011.png
new file mode 100644 (file)
index 0000000..19295ce
Binary files /dev/null and b/stinger/blur011.png differ
diff --git a/stinger/blur012.png b/stinger/blur012.png
new file mode 100644 (file)
index 0000000..07b328a
Binary files /dev/null and b/stinger/blur012.png differ
diff --git a/stinger/blur013.png b/stinger/blur013.png
new file mode 100644 (file)
index 0000000..9cc3324
Binary files /dev/null and b/stinger/blur013.png differ
diff --git a/stinger/blur014.png b/stinger/blur014.png
new file mode 100644 (file)
index 0000000..c1c5a93
Binary files /dev/null and b/stinger/blur014.png differ
diff --git a/stinger/blur015.png b/stinger/blur015.png
new file mode 100644 (file)
index 0000000..96ef0b1
Binary files /dev/null and b/stinger/blur015.png differ
diff --git a/stinger/blur016.png b/stinger/blur016.png
new file mode 100644 (file)
index 0000000..78999bb
Binary files /dev/null and b/stinger/blur016.png differ
diff --git a/stinger/blur017.png b/stinger/blur017.png
new file mode 100644 (file)
index 0000000..a7d432e
Binary files /dev/null and b/stinger/blur017.png differ
diff --git a/stinger/blur018.png b/stinger/blur018.png
new file mode 100644 (file)
index 0000000..d8fe731
Binary files /dev/null and b/stinger/blur018.png differ
diff --git a/stinger/blur019.png b/stinger/blur019.png
new file mode 100644 (file)
index 0000000..4058e4e
Binary files /dev/null and b/stinger/blur019.png differ
diff --git a/stinger/blur020.png b/stinger/blur020.png
new file mode 100644 (file)
index 0000000..a916cc7
Binary files /dev/null and b/stinger/blur020.png differ
diff --git a/stinger/blur021.png b/stinger/blur021.png
new file mode 100644 (file)
index 0000000..c7a5ef7
Binary files /dev/null and b/stinger/blur021.png differ
diff --git a/stinger/blur022.png b/stinger/blur022.png
new file mode 100644 (file)
index 0000000..0ac091c
Binary files /dev/null and b/stinger/blur022.png differ
diff --git a/stinger/blur023.png b/stinger/blur023.png
new file mode 100644 (file)
index 0000000..2ee6a8e
Binary files /dev/null and b/stinger/blur023.png differ
diff --git a/stinger/blur024.png b/stinger/blur024.png
new file mode 100644 (file)
index 0000000..532d73c
Binary files /dev/null and b/stinger/blur024.png differ