movit_texel_subpixel_precision /= 2.0;
resource_pool.reset(new ResourcePool);
- theme.reset(new Theme("theme.lua", resource_pool.get()));
+ theme.reset(new Theme("theme.lua", resource_pool.get(), num_cards));
output_channel[OUTPUT_LIVE].parent = this;
output_channel[OUTPUT_PREVIEW].parent = this;
output_channel[OUTPUT_INPUT0].parent = this;
#include "httpd.h"
#include "ebu_r128_proc.h"
-#define MAX_CARDS 16
-
namespace movit {
class YCbCrInput;
}
theme->connect_signal(input, signal_num);
}
-Theme::Theme(const char *filename, ResourcePool *resource_pool)
- : resource_pool(resource_pool)
+Theme::Theme(const char *filename, ResourcePool *resource_pool, unsigned num_cards)
+ : resource_pool(resource_pool), num_cards(num_cards)
{
L = luaL_newstate();
luaL_openlibs(L);
void Theme::connect_signal(YCbCrInput *input, int signal_num)
{
+ if (signal_num >= int(num_cards)) {
+ fprintf(stderr, "WARNING: Theme asked for input %d, but we only have %u card(s).\n", signal_num, num_cards);
+ fprintf(stderr, "Mapping to card %d instead.\n", signal_num % num_cards);
+ signal_num %= num_cards;
+ }
input->set_texture_num(0, input_textures[signal_num].tex_y);
input->set_texture_num(1, input_textures[signal_num].tex_cbcr);
}
#include <movit/effect_chain.h>
#include <movit/ycbcr_input.h>
+#define MAX_CARDS 16
+
class NonBouncingYCbCrInput : public movit::YCbCrInput {
public:
NonBouncingYCbCrInput(const movit::ImageFormat &image_format,
class Theme {
public:
- Theme(const char *filename, movit::ResourcePool *resource_pool);
+ Theme(const char *filename, movit::ResourcePool *resource_pool, unsigned num_cards);
std::pair<movit::EffectChain *, std::function<void()>>
get_chain(unsigned num, float t, unsigned width, unsigned height);
movit::ResourcePool *resource_pool;
struct {
GLuint tex_y = 0, tex_cbcr = 0;
- } input_textures[16]; // FIXME
+ } input_textures[MAX_CARDS];
int num_channels;
+ unsigned num_cards;
};
class LiveInputWrapper {