- // The preview frame shows the first input. Note that the textures
- // are owned by the input frame, not the display frame.
- if (bmusb_current_rendering_frame[0] != nullptr) {
- const PBOFrameAllocator::Userdata *input0_userdata = (const PBOFrameAllocator::Userdata *)bmusb_current_rendering_frame[0]->userdata;
- GLuint input0_y_tex = input0_userdata->tex_y;
- GLuint input0_cbcr_tex = input0_userdata->tex_cbcr;
- DisplayFrame preview0_frame;
- preview0_frame.chain = preview0_chain.get();
- preview0_frame.setup_chain = [this, input0_y_tex, input0_cbcr_tex]{
- preview0_input->set_texture_num(0, input0_y_tex);
- preview0_input->set_texture_num(1, input0_cbcr_tex);
- };
- preview0_frame.ready_fence = fence;
- preview0_frame.input_frames = { bmusb_current_rendering_frame[0] };
- preview0_frame.temp_textures = {};
- output_channel[OUTPUT_PREVIEW].output_frame(preview0_frame);
- output_channel[OUTPUT_INPUT0].output_frame(preview0_frame);
- }
-
- // Same for the other preview.
- // TODO: Use a for loop. Gah.
- if (bmusb_current_rendering_frame[1] != nullptr) {
- const PBOFrameAllocator::Userdata *input1_userdata = (const PBOFrameAllocator::Userdata *)bmusb_current_rendering_frame[1]->userdata;
- GLuint input1_y_tex = input1_userdata->tex_y;
- GLuint input1_cbcr_tex = input1_userdata->tex_cbcr;
- DisplayFrame preview1_frame;
- preview1_frame.chain = preview1_chain.get();
- preview1_frame.setup_chain = [this, input1_y_tex, input1_cbcr_tex]{
- preview1_input->set_texture_num(0, input1_y_tex);
- preview1_input->set_texture_num(1, input1_cbcr_tex);
- };
- preview1_frame.ready_fence = fence;
- preview1_frame.input_frames = { bmusb_current_rendering_frame[1] };
- preview1_frame.temp_textures = {};
- output_channel[OUTPUT_INPUT1].output_frame(preview1_frame);
+ // Set up non-live inputs.
+ for (unsigned i = 1; i < 4; ++i) { // FIXME: Don't lock to 4, ask Lua.
+ DisplayFrame display_frame;
+ pair<EffectChain *, function<void()>> chain = theme->get_chain(i, frame / 60.0f, WIDTH, HEIGHT); // FIXME: dimensions
+ display_frame.chain = chain.first;
+ display_frame.setup_chain = chain.second;
+ display_frame.ready_fence = fence;
+ display_frame.input_frames = { bmusb_current_rendering_frame[0], bmusb_current_rendering_frame[1] }; // FIXME: possible to do better?
+ display_frame.temp_textures = {};
+ output_channel[i].output_frame(display_frame);