live_frame.temp_textures = { rgba_tex };
output_channel[OUTPUT_LIVE].output_frame(live_frame);
- // Set up non-live inputs.
- for (unsigned i = 1; i < 4; ++i) { // FIXME: Don't lock to 4, ask Lua.
+ // Set up preview and any additional channels.
+ for (unsigned i = 1; i < theme->get_num_channels() + 2; ++i) {
DisplayFrame display_frame;
pair<EffectChain *, function<void()>> chain = theme->get_chain(i, frame / 60.0f, WIDTH, HEIGHT); // FIXME: dimensions
display_frame.chain = chain.first;
register_class("LiveInputWrapper", LiveInputWrapper_funcs);
register_class("WhiteBalanceEffect", WhiteBalanceEffect_funcs);
- // Run script.
- lua_settop(L, 0);
- if (luaL_dofile(L, filename)) {
- fprintf(stderr, "error: %s\n", lua_tostring(L, -1));
- lua_pop(L, 1);
- exit(1);
- }
- assert(lua_gettop(L) == 0);
+ // Run script.
+ lua_settop(L, 0);
+ if (luaL_dofile(L, filename)) {
+ fprintf(stderr, "error: %s\n", lua_tostring(L, -1));
+ lua_pop(L, 1);
+ exit(1);
+ }
+ assert(lua_gettop(L) == 0);
+
+ // Ask it for the number of channels.
+ lua_getglobal(L, "num_channels");
+
+ if (lua_pcall(L, 0, 1, 0) != 0) {
+ fprintf(stderr, "error running function `num_channels': %s", lua_tostring(L, -1));
+ exit(1);
+ }
+
+ num_channels = luaL_checknumber(L, 1);
}
void Theme::register_class(const char *class_name, const luaL_Reg *funcs)
input_textures[signal_num].tex_y = tex_y;
input_textures[signal_num].tex_cbcr = tex_cbcr;
}
+ int get_num_channels() { return num_channels; }
void connect_signal(movit::YCbCrInput *input, int signal_num);
void transition_clicked(int transition_num, float t);
struct {
GLuint tex_y = 0, tex_cbcr = 0;
} input_textures[16]; // FIXME
+ int num_channels;
};
class LiveInputWrapper {