1 -- The theme is what decides what's actually shown on screen, what kind of
2 -- transitions are available (if any), and what kind of inputs there are,
3 -- if any. In general, it drives the entire display logic by creating Movit
4 -- chains, setting their parameters and then deciding which to show when.
6 -- Themes are written in Lua, which reflects a simplified form of the Movit API
7 -- where all the low-level details (such as texture formats) are handled by the
8 -- C++ side and you generally just build chains.
9 io.write("hello from lua\n");
11 -- The main live chain. Currently just about input 0 with some color correction.
12 local main_chain = EffectChain.new(16, 9);
13 local input0 = main_chain:add_live_input();
14 input0:connect_signal(0);
15 local wb_effect = main_chain:add_effect(WhiteBalanceEffect.new(), input0);
16 wb_effect:set_float("output_color_temperature", 1234.0);
17 main_chain:finalize(true);
18 -- local input1 = main_chain.add_input(Inputs.create(1));
19 -- local resample_effect = main_chain.add_effect(ResampleEffect.new(), input0);
20 -- local padding_effect = main_chain.add_effect(IntegralPaddingEffect.new());
22 -- A chain to show a single input on screen.
23 local simple_chain = EffectChain.new(16, 9);
24 local simple_chain_input = simple_chain:add_live_input();
25 simple_chain_input:connect_signal(0); -- First input card. Can be changed whenever you want.
26 simple_chain:finalize(false);
28 -- Returns the number of outputs in addition to the live (0) and preview (1).
29 -- Called only once, at the start of the program.
30 function num_channels()
34 -- Called every frame.
35 function get_transitions()
36 return {"Cut", "Fade", "Zoom!"};
39 function transition_clicked(num, t)
40 -- Presumably do some sort of transition here.
41 io.write("STUB: transition_clicked\n");
44 function channel_clicked(num, t)
45 -- Presumably change the preview here.
46 io.write("STUB: channel_clicked\n");
49 -- Called every frame. Get the chain for displaying at input <num>,
50 -- where 0 is live, 1 is preview, 2 is the first channel to display
51 -- in the bottom bar, and so on up to num_channels()+1. t is the
52 -- current time in seconds. width and height are the dimensions of
53 -- the output, although you can ignore them if you don't need them
54 -- (they're useful if you want to e.g. know what to resample by).
55 -- If you want to change any parameters in the chain, this is also
58 -- NOTE: The chain returned must be finalized with the Y'CbCr flag
59 -- if and only if num==0.
60 function get_chain(num, t, width, height)
61 if num == 0 then -- Live.
63 input0:connect_signal(1);
64 wb_effect:set_float("output_color_temperature", 3500.0 + t * 100.0);
66 return main_chain, prepare;
68 if num == 1 then -- Preview.
70 simple_chain_input:connect_signal(0);
72 return simple_chain, prepare;
76 simple_chain_input:connect_signal(0);
78 return simple_chain, prepare;
82 simple_chain_input:connect_signal(1);
84 return simple_chain, prepare;