]> git.sesse.net Git - nageru/blobdiff - theme.lua
Hook over OverlayEffect, and make add_effect() take a variable number of parameters.
[nageru] / theme.lua
index 82339f8d33db7c03d9fb8c51f1b6060373cef6b9..a0e3862766f3a3ccc0a20bd60d5fe74fc9e227f1 100644 (file)
--- a/theme.lua
+++ b/theme.lua
@@ -15,11 +15,19 @@ local preview_signal_num = 1;
 local main_chain = EffectChain.new(16, 9);
 local input0 = main_chain:add_live_input();
 input0:connect_signal(0);
-local wb_effect = main_chain:add_effect(WhiteBalanceEffect.new(), input0);
+local resample_effect = main_chain:add_effect(ResampleEffect.new(), input0);
+resample_effect:set_int("width", 320);
+resample_effect:set_int("height", 180);
+local padding_effect = main_chain:add_effect(IntegralPaddingEffect.new(), resample_effect);
+padding_effect:set_int("width", 1280);
+padding_effect:set_int("height", 720);
+padding_effect:set_int("left", 30);
+padding_effect:set_int("top", 60);
+local input1 = main_chain:add_live_input();
+input1:connect_signal(1);
+local wb_effect = main_chain:add_effect(WhiteBalanceEffect.new(), input1);
+local overlay_effect = main_chain:add_effect(OverlayEffect.new(), wb_effect, padding_effect);
 main_chain:finalize(true);
--- local input1 = main_chain.add_input(Inputs.create(1));
--- local resample_effect = main_chain.add_effect(ResampleEffect.new(), input0);
--- local padding_effect = main_chain.add_effect(IntegralPaddingEffect.new());
 
 -- A chain to show a single input on screen.
 local simple_chain = EffectChain.new(16, 9);
@@ -56,6 +64,13 @@ end
 -- current time in seconds. width and height are the dimensions of
 -- the output, although you can ignore them if you don't need them
 -- (they're useful if you want to e.g. know what to resample by).
+--
+-- You should return two objects; the chain itself, and then a
+-- function (taking no parameters) that is run just before rendering.
+-- The function needs to call connect_signal on any inputs, so that
+-- it gets updated video data for the given frame. (You are allowed
+-- to switch which input your input is getting from between frames,
+-- but not calling connect_signal results in undefined behavior.)
 -- If you want to change any parameters in the chain, this is also
 -- the right place.
 --
@@ -65,6 +80,7 @@ function get_chain(num, t, width, height)
        if num == 0 then  -- Live.
                prepare = function()
                        input0:connect_signal(live_signal_num);
+                       input1:connect_signal(1);
                        wb_effect:set_float("output_color_temperature", 3500.0 + t * 100.0);
                end
                return main_chain, prepare;