lv2 rework, sams ffmpeg icons, elision patch
[goodguy/history.git] / cinelerra-5.1 / cinelerra / pluginlv2.h
1 #ifndef __PLUGINLV2_H__
2 #define __PLUGINLV2_H__
3
4 #define LV2_SEQ_SIZE  9624
5 #include "forkbase.h"
6 #include "pluginlv2config.h"
7 #include "samples.inc"
8
9 #include <lilv/lilv.h>
10 #define NS_EXT "http://lv2plug.in/ns/ext/"
11
12 typedef struct {
13         int64_t sz;
14         int samples, done;
15         int nb_inputs, nb_outputs;
16 } shm_bfr_t;
17
18 #define TYP_AUDIO   1
19 #define TYP_CONTROL 2
20 #define TYP_ATOM    4
21 #define TYP_ALL    ~0
22
23 class PluginLV2
24 {
25 public:
26         PluginLV2();
27         virtual ~PluginLV2();
28
29         shm_bfr_t *shm_bfr;
30         int use_shm, shmid;
31         float **in_buffers, **out_buffers;
32         int *iport, *oport;
33         int nb_inputs, nb_outputs;
34         int max_bufsz, ui_features;
35
36         void reset_lv2();
37         int load_lv2(const char *path,char *title=0);
38         int init_lv2(PluginLV2ClientConfig &conf, int sample_rate);
39
40         static LV2_URID uri_table_map(LV2_URID_Map_Handle handle, const char *uri);
41         static const char *uri_table_unmap(LV2_URID_Map_Handle handle, LV2_URID urid);
42         void connect_ports(PluginLV2ClientConfig &conf, int typ=TYP_ALL);
43         void del_buffer();
44         void new_buffer(int64_t sz);
45         shm_bfr_t *shm_buffer(int shmid);
46         void init_buffer(int samples);
47         void map_buffer();
48
49         LilvWorld         *world;
50         const LilvPlugin  *lilv;
51         LilvUIs           *lilv_uis;
52
53         PluginLV2UriTable  uri_table;
54         LV2_URID_Map       map;
55         LV2_Feature        map_feature;
56         LV2_URID_Unmap     unmap;
57         LV2_Feature        unmap_feature;
58         Lv2Features        features;
59         LV2_Atom_Sequence  seq_in[2];
60         LV2_Atom_Sequence  *seq_out;
61
62         LilvInstance *inst;
63         SuilInstance *sinst;
64         SuilHost *ui_host;
65
66         LilvNode *atom_AtomPort;
67         LilvNode *atom_Sequence;
68         LilvNode *lv2_AudioPort;
69         LilvNode *lv2_CVPort;
70         LilvNode *lv2_ControlPort;
71         LilvNode *lv2_Optional;
72         LilvNode *lv2_InputPort;
73         LilvNode *lv2_OutputPort;
74         LilvNode *powerOf2BlockLength;
75         LilvNode *fixedBlockLength;
76         LilvNode *boundedBlockLength;
77 };
78
79 typedef struct { int sample_rate;  char path[1]; } open_bfr_t;
80 typedef struct { int idx;  float value; } control_bfr_t;
81
82 enum { NO_COMMAND,
83         LV2_OPEN,
84         LV2_LOAD,
85         LV2_UPDATE,
86         LV2_SHOW,
87         LV2_HIDE,
88         LV2_SET,
89         LV2_SHMID,
90         NB_COMMANDS };
91
92 #endif