1 // effects-data.h
2 // LiVES (lives-exe)
3 // (c) G. Finch 2005 - 2012 (salsaman@gmail.com)
4 // Released under the GPL 3 or later
5 // see file ../COPYING for licensing details
6 
7 #define FX_DATA_WILDCARD -1000000
8 #define FX_DATA_WILDCARD_KEEP_ACTIVATED -1000001
9 
10 // special input keys
11 #define FX_DATA_KEY_SUBTITLES -1
12 #define FX_DATA_KEY_PLAYBACK_PLUGIN -2
13 #define FX_DATA_KEY_OMC_MACRO -3
14 
15 #define EXTRA_PARAMS_OUT 1 ///< Activate
16 #define EXTRA_PARAMS_IN 1 ///< Activated
17 
18 #define FX_DATA_PARAM_ACTIVE -1 ///< activate || activated
19 
20 // struct for connecting out params to in params
21 
22 typedef struct _lives_pconnect_t lives_pconnect_t;
23 
24 // when an out parameter is mapped/updated, we add it to here
25 
26 // when unmapped we delete it
27 
28 struct _lives_pconnect_t {
29   int okey; ///< okey is 0 based
30   int omode;
31 
32   int nparams; ///< number of parameters which are linked
33 
34   // index to parameters which are to be copied (|params|)
35   int *params;
36 
37   // previous vals, so we can see when state changed
38   int *last_boolval;
39 
40   // number of connections for each param
41   int *nconns;
42 
43   // each param is mapped to nconns[i] of these
44   int *ikey;  ///< ikey is 0 based :: values < 0 indicate an FX_DATA_KEY_*
45   int *imode;
46   int *ipnum;
47   boolean *autoscale;
48 
49   lives_pconnect_t *next;
50 };
51 
52 /// add a new connection from out_param okey/omode/opnum to in_param ikey/imode/ipnum
53 void pconx_add_connection(int okey, int omode, int opnum, int ikey, int imode, int ipnum, boolean autoscale);
54 
55 // free all connections (and set mainw->pconx to NULL)
56 void pconx_delete_all();
57 
58 void pconx_delete(int okey, int omode, int ocnum, int ikey, int imode, int icnum);
59 
60 void pconx_remap_mode(int key, int omode, int nmode);
61 
62 // chain any output data into fx key/mode (pull)
63 boolean pconx_chain_data(int key, int mode, boolean is_audio_thread);
64 
65 // chain any output data into OMC Macros (push)
66 int pconx_chain_data_omc(weed_plant_t *instance, int key, int mode);
67 
68 // return list of in keys/modes/params/autoscale
69 char *pconx_list(int okey, int omode, int opnum);
70 
71 // special version for compound fx internal connections
72 boolean pconx_chain_data_internal(weed_plant_t *inst);
73 
74 // alpha channels
75 
76 // struct for connecting out alphas to in alphas
77 
78 typedef struct _lives_cconnect_t lives_cconnect_t;
79 
80 // when an out alpha is mapped/updated, we add it to here
81 
82 // when unmapped we delete it
83 
84 struct _lives_cconnect_t {
85   int okey; ///< okey is 0 based
86   int omode;
87 
88   int nchans; ///< number of alpha channels which are linked (|chans|)
89 
90   // index to chans which are to be copied
91   int *chans;
92 
93   // number of connections for each channel
94   int *nconns;
95 
96   // each param is mapped to nconns[i] of these
97   int *ikey;  ///< ikey is 0 based
98   int *imode;
99   int *icnum;
100 
101   lives_cconnect_t *next;
102 };
103 
104 /// add a new connection from out_chan okey/omode/ocnum to in_chan ikey/imode/icnum
105 void cconx_add_connection(int okey, int omode, int ocnum, int ikey, int imode, int icnum);
106 
107 // free all connections (and set mainw->cconx to NULL)
108 void cconx_delete_all();
109 
110 void cconx_delete(int okey, int omode, int ocnum, int ikey, int imode, int icnum);
111 
112 void cconx_remap_mode(int key, int omode, int nmode);
113 
114 // chain any output data into fx key/mode
115 boolean cconx_chain_data(int key, int mode);
116 
117 // return list of in chaannels/modes/params
118 char *cconx_list(int okey, int omode, int ocnum);
119 
120 boolean cconx_chain_data_internal(weed_plant_t *ichan);
121 
122 //////////////////////////////////////////////////////////
123 
124 void override_if_active_input(int hotkey);
125 void end_override_if_activate_output(int hotkey);
126 
127 ////////////////////////////////////////////////////////////
128 
129 typedef struct {
130   weed_plant_t *filter;
131 
132   int okey;
133   int omode;
134   int num_alpha;
135   int num_params;
136   int ntabs;
137 
138   lives_cconnect_t *cconx;
139   lives_pconnect_t *pconx;
140 
141   LiVESWidget *conx_dialog;
142   LiVESWidget *acbutton;
143   LiVESWidget *apbutton;
144   LiVESWidget *disconbutton;
145 
146   LiVESWidget **clabel;
147   LiVESWidget **pclabel;
148   LiVESWidget **cfxcombo;
149   LiVESWidget **pfxcombo;
150   LiVESWidget **pcombo;
151   LiVESWidget **ccombo;
152   LiVESWidget **acheck;
153   LiVESWidget **add_button;
154   LiVESWidget **del_button;
155   LiVESWidget *allcheckc;
156   LiVESWidget *allcheck_label;
157 
158   LiVESWidget *tablec;
159   LiVESWidget *tablep;
160 
161   // table row counts
162   int trowsc;
163   int trowsp;
164 
165   // # dislay rows for each param/channel
166   int *dispc;
167   int *dispp;
168 
169   int *ikeys;
170   int *imodes;
171   int *idx;
172 
173   ulong *dpc_func;
174   ulong *dpp_func;
175   ulong *acheck_func;
176 } lives_conx_w;
177 
178 LiVESWidget *make_datacon_window(int key, int mode);
179 
180 int pconx_check_connection(weed_plant_t *ofilter, int opnum, int ikey, int imode, int ipnum, boolean setup,
181                            weed_plant_t **iparam_ret,
182                            int *idx_ret,
183                            int *okey, int *omode, int *oopnum);
184 
185 int cconx_check_connection(int ikey, int imode, int icnum, boolean setup, weed_plant_t **ichan_ret, int *idx_ret, int *okey,
186                            int *omode,
187                            int *ocnum);
188 
189 boolean feeds_to_video_filters(int okey, int omode);
190 boolean feeds_to_audio_filters(int okey, int omode);
191 
192