-#include <stdio.h>
+#include "theme.h"
+
+#include <assert.h>
+#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
-#include <lauxlib.h>
-#include <new>
-#include <utility>
-
+#include <movit/effect.h>
#include <movit/effect_chain.h>
-#include <movit/ycbcr_input.h>
-#include <movit/white_balance_effect.h>
-#include <movit/resample_effect.h>
-#include <movit/padding_effect.h>
+#include <movit/image_format.h>
+#include <movit/mix_effect.h>
#include <movit/overlay_effect.h>
+#include <movit/padding_effect.h>
+#include <movit/resample_effect.h>
#include <movit/resize_effect.h>
-#include <movit/mix_effect.h>
+#include <movit/white_balance_effect.h>
+#include <movit/ycbcr.h>
+#include <movit/ycbcr_input.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <cstddef>
+#include <new>
+#include <utility>
-#include "theme.h"
+namespace movit {
+class ResourcePool;
+} // namespace movit
#define WIDTH 1280 // FIXME
#define HEIGHT 720 // FIXME
});
}
+std::string Theme::get_channel_name(unsigned channel)
+{
+ unique_lock<mutex> lock(m);
+ lua_getglobal(L, "channel_name");
+ lua_pushnumber(L, channel);
+ if (lua_pcall(L, 1, 1, 0) != 0) {
+ fprintf(stderr, "error running function `channel_nam': %s\n", lua_tostring(L, -1));
+ exit(1);
+ }
+
+ std::string ret = lua_tostring(L, -1);
+ lua_pop(L, 1);
+ assert(lua_gettop(L) == 0);
+ return ret;
+}
+
+bool Theme::get_supports_set_wb(unsigned channel)
+{
+ unique_lock<mutex> lock(m);
+ lua_getglobal(L, "supports_set_wb");
+ lua_pushnumber(L, channel);
+ if (lua_pcall(L, 1, 1, 0) != 0) {
+ fprintf(stderr, "error running function `supports_set_wb': %s\n", lua_tostring(L, -1));
+ exit(1);
+ }
+
+ bool ret = checkbool(L, -1);
+ lua_pop(L, 1);
+ assert(lua_gettop(L) == 0);
+ return ret;
+}
+
std::vector<std::string> Theme::get_transition_names(float t)
{
unique_lock<mutex> lock(m);
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);
+ if (signals_warned_about.insert(signal_num).second) {
+ 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);