5 #include <movit/flat_input.h>
6 #include <movit/ycbcr_input.h>
14 #include "bmusb/bmusb.h"
15 #include "ref_counted_frame.h"
16 #include "tweaked_inputs.h"
28 Theme(const std::string &filename, const std::vector<std::string> &search_dirs, movit::ResourcePool *resource_pool, unsigned num_cards);
32 movit::EffectChain *chain;
33 std::function<void()> setup_chain;
35 // May have duplicates.
36 std::vector<RefCountedFrame> input_frames;
39 Chain get_chain(unsigned num, float t, unsigned width, unsigned height, InputState input_state);
41 int get_num_channels() const { return num_channels; }
42 int map_signal(int signal_num);
43 void set_signal_mapping(int signal_num, int card_num);
44 std::string get_channel_name(unsigned channel);
45 int get_channel_signal(unsigned channel);
46 bool get_supports_set_wb(unsigned channel);
47 void set_wb(unsigned channel, double r, double g, double b);
48 std::string get_channel_color(unsigned channel);
50 std::vector<std::string> get_transition_names(float t);
52 void transition_clicked(int transition_num, float t);
53 void channel_clicked(int preview_num);
55 movit::ResourcePool *get_resource_pool() const { return resource_pool; }
58 void register_class(const char *class_name, const luaL_Reg *funcs);
61 lua_State *L; // Protected by <m>.
62 const InputState *input_state; // Protected by <m>. Only set temporarily, during chain setup.
63 movit::ResourcePool *resource_pool;
68 std::map<int, int> signal_to_card_mapping; // Protected by <map_m>.
70 friend class LiveInputWrapper;
73 // LiveInputWrapper is a facade on top of an YCbCrInput, exposed to
74 // the Lua code. It contains a function (connect_signal()) intended
75 // to be called during chain setup, that picks out the current frame
76 // (in the form of a set of textures) from the input state given by
77 // the mixer, and communicates that state over to the actual YCbCrInput.
78 class LiveInputWrapper {
80 // Note: <override_bounce> is irrelevant for PixelFormat_8BitRGBA.
81 LiveInputWrapper(Theme *theme, movit::EffectChain *chain, bmusb::PixelFormat pixel_format, bool override_bounce, bool deinterlace);
83 void connect_signal(int signal_num);
84 movit::Effect *get_effect() const
87 return deinterlace_effect;
88 } else if (pixel_format == bmusb::PixelFormat_8BitRGBA) {
89 return rgba_inputs[0];
91 return ycbcr_inputs[0];
96 Theme *theme; // Not owned by us.
97 bmusb::PixelFormat pixel_format;
98 std::vector<movit::YCbCrInput *> ycbcr_inputs; // Multiple ones if deinterlacing. Owned by the chain.
99 std::vector<movit::FlatInput *> rgba_inputs; // Multiple ones if deinterlacing. Owned by the chain.
100 movit::Effect *deinterlace_effect = nullptr; // Owned by the chain.
104 #endif // !defined(_THEME_H)