]> git.sesse.net Git - nageru/blobdiff - theme.lua
Hook up ResampleEffect, and generalize things a bit.
[nageru] / theme.lua
index fbe2cbf4e0b0c7f3b31da707e0514a1757b5375c..d7c624a79d674f6bef683c01d42069d8108693a9 100644 (file)
--- a/theme.lua
+++ b/theme.lua
@@ -15,7 +15,10 @@ 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 wb_effect = main_chain:add_effect(WhiteBalanceEffect.new(), resample_effect);
 main_chain:finalize(true);
 -- local input1 = main_chain.add_input(Inputs.create(1));
 -- local resample_effect = main_chain.add_effect(ResampleEffect.new(), input0);
@@ -30,7 +33,7 @@ simple_chain:finalize(false);
 -- Returns the number of outputs in addition to the live (0) and preview (1).
 -- Called only once, at the start of the program.
 function num_channels()
-       return 0;
+       return 2;
 end
 
 -- Called every frame.
@@ -56,6 +59,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.
 --