]> git.sesse.net Git - nageru/blob - theme.h
Remove unused member.
[nageru] / theme.h
1 #ifndef _THEME_H
2 #define _THEME_H 1
3
4 #include <epoxy/gl.h>
5 #include <lauxlib.h>
6 #include <lua.h>
7 #include <movit/effect_chain.h>
8 #include <movit/ycbcr_input.h>
9 #include <stdbool.h>
10 #include <stdio.h>
11 #include <functional>
12 #include <mutex>
13 #include <set>
14 #include <string>
15 #include <utility>
16 #include <vector>
17
18 #include "defs.h"
19 #include "input_state.h"
20 #include "ref_counted_frame.h"
21
22 namespace movit {
23 class ResourcePool;
24 struct ImageFormat;
25 struct YCbCrFormat;
26 }  // namespace movit
27
28 class NonBouncingYCbCrInput : public movit::YCbCrInput {
29 public:
30         NonBouncingYCbCrInput(const movit::ImageFormat &image_format,
31                               const movit::YCbCrFormat &ycbcr_format,
32                               unsigned width, unsigned height,
33                               movit::YCbCrInputSplitting ycbcr_input_splitting = movit::YCBCR_INPUT_PLANAR)
34             : movit::YCbCrInput(image_format, ycbcr_format, width, height, ycbcr_input_splitting) {}
35
36         bool override_disable_bounce() const override { return true; }
37 };
38
39 class Theme {
40 public:
41         Theme(const char *filename, movit::ResourcePool *resource_pool, unsigned num_cards);
42
43         struct Chain {
44                 movit::EffectChain *chain;
45                 std::function<void()> setup_chain;
46
47                 // May have duplicates.
48                 std::vector<RefCountedFrame> input_frames;
49         };
50
51         Chain get_chain(unsigned num, float t, unsigned width, unsigned height, InputState input_state);
52
53         int get_num_channels() const { return num_channels; }
54         int map_signal(int signal_num);
55         std::string get_channel_name(unsigned channel);
56         bool get_supports_set_wb(unsigned channel);
57         void set_wb(unsigned channel, double r, double g, double b);
58
59         std::vector<std::string> get_transition_names(float t);
60
61         void connect_signal(movit::YCbCrInput *input, int signal_num);
62         void transition_clicked(int transition_num, float t);
63         void channel_clicked(int preview_num);
64
65 private:
66         void register_class(const char *class_name, const luaL_Reg *funcs);
67
68         std::mutex m;
69         lua_State *L;  // Protected by <m>.
70         const InputState *input_state;  // Protected by <m>. Only set temporarily, during chain setup.
71         movit::ResourcePool *resource_pool;
72         int num_channels;
73         unsigned num_cards;
74         std::set<int> signals_warned_about;
75
76         friend class LiveInputWrapper;
77 };
78
79 class LiveInputWrapper {
80 public:
81         LiveInputWrapper(Theme *theme, movit::EffectChain *chain, bool override_bounce);
82
83         void connect_signal(int signal_num);
84         movit::YCbCrInput *get_input() const
85         {
86                 return input;
87         }
88
89 private:
90         Theme *theme;  // Not owned by us.
91         movit::YCbCrInput *input;  // Owned by the chain.
92 };
93
94 #endif  // !defined(_THEME_H)