]> git.sesse.net Git - nageru/blob - theme.h
Hook up the cut button to Lua, so that it actually does something.
[nageru] / theme.h
1 #ifndef _THEME_H
2 #define _THEME_H 1
3
4 #include <stdio.h>
5 #include <lua.h>
6 #include <lauxlib.h>
7
8 #include <functional>
9 #include <mutex>
10 #include <utility>
11
12 #include <movit/effect_chain.h>
13 #include <movit/ycbcr_input.h>
14
15 class Theme {
16 public:
17         Theme(const char *filename, movit::ResourcePool *resource_pool);
18         void register_class(const char *class_name, const luaL_Reg *funcs);
19
20         std::pair<movit::EffectChain *, std::function<void()>>
21         get_chain(unsigned num, float t, unsigned width, unsigned height);
22
23         void set_input_textures(int signal_num, GLuint tex_y, GLuint tex_cbcr) {
24                 input_textures[signal_num].tex_y = tex_y;
25                 input_textures[signal_num].tex_cbcr = tex_cbcr;
26         }
27
28         void connect_signal(movit::YCbCrInput *input, int signal_num);
29         void transition_clicked(int transition_num, float t);
30
31 private:
32         std::mutex m;
33         lua_State *L;
34         movit::ResourcePool *resource_pool;
35         struct {
36                 GLuint tex_y = 0, tex_cbcr = 0;
37         } input_textures[16];  // FIXME
38 };
39
40 class LiveInputWrapper {
41 public:
42         LiveInputWrapper(Theme *theme, movit::EffectChain *chain);
43
44         void connect_signal(int signal_num);
45 #if 0
46         {
47                 connected_signal_num = signal_num;
48         }
49
50         int get_connected_signal_num() const {
51                 return connected_signal_num;
52         }
53 #endif
54
55         movit::YCbCrInput *get_input() const
56         {
57                 return input;
58         }
59
60 private:
61         Theme *theme;  // Not owned by us.
62         movit::YCbCrInput *input;  // Owned by the chain.
63         int connected_signal_num = 0;
64 };
65
66 #endif  // !defined(_THEME_H)