]> git.sesse.net Git - nageru/blob - theme.h
Make Theme::register_class() private.
[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 NonBouncingYCbCrInput : public movit::YCbCrInput {
16 public:
17         NonBouncingYCbCrInput(const movit::ImageFormat &image_format,
18                               const movit::YCbCrFormat &ycbcr_format,
19                               unsigned width, unsigned height,
20                               movit::YCbCrInputSplitting ycbcr_input_splitting = movit::YCBCR_INPUT_PLANAR)
21             : movit::YCbCrInput(image_format, ycbcr_format, width, height, ycbcr_input_splitting) {}
22
23         bool override_disable_bounce() const override { return true; }
24 };
25
26 class Theme {
27 public:
28         Theme(const char *filename, movit::ResourcePool *resource_pool);
29
30         std::pair<movit::EffectChain *, std::function<void()>>
31         get_chain(unsigned num, float t, unsigned width, unsigned height);
32
33         void set_input_textures(int signal_num, GLuint tex_y, GLuint tex_cbcr) {
34                 input_textures[signal_num].tex_y = tex_y;
35                 input_textures[signal_num].tex_cbcr = tex_cbcr;
36         }
37         int get_num_channels() { return num_channels; }
38
39         std::vector<std::string> get_transition_names(float t);
40
41         void connect_signal(movit::YCbCrInput *input, int signal_num);
42         void transition_clicked(int transition_num, float t);
43         void channel_clicked(int preview_num);
44
45 private:
46         void register_class(const char *class_name, const luaL_Reg *funcs);
47
48         std::mutex m;
49         lua_State *L;
50         movit::ResourcePool *resource_pool;
51         struct {
52                 GLuint tex_y = 0, tex_cbcr = 0;
53         } input_textures[16];  // FIXME
54         int num_channels;
55 };
56
57 class LiveInputWrapper {
58 public:
59         LiveInputWrapper(Theme *theme, movit::EffectChain *chain, bool override_bounce);
60
61         void connect_signal(int signal_num);
62         movit::YCbCrInput *get_input() const
63         {
64                 return input;
65         }
66
67 private:
68         Theme *theme;  // Not owned by us.
69         movit::YCbCrInput *input;  // Owned by the chain.
70         int connected_signal_num = 0;
71 };
72
73 #endif  // !defined(_THEME_H)