LiVES  3.0.2
effects-weed.h
Go to the documentation of this file.
1 // effects-weed.h
2 // LiVES (lives-exe)
3 // (c) G. Finch 2005 - 2016 <salsaman@gmail.com>
4 // Released under the GPL 3 or later
5 // see file ../COPYING for licensing details
6 
7 #ifndef HAS_LIVES_EFFECTS_WEED_H
8 #define HAS_LIVES_EFFECTS_WEED_H
9 
11 typedef enum {
33 
37 
38 typedef enum {
43 
44 #ifndef WEED_PLANT_LAYER
45 #define WEED_PLANT_LAYER WEED_PLANT_CHANNEL
46 #endif
47 
48 #define WEED_LEAF_TYPE "type"
49 #define WEED_LEAF_PLUGIN_INFO "plugin_info"
50 #define WEED_LEAF_FILTERS "filters"
51 #define WEED_LEAF_MAINTAINER "maintainer"
52 #define WEED_LEAF_HOST_INFO "host_info"
53 
54 // host info
55 #define WEED_LEAF_API_VERSION "api_version"
56 #define WEED_LEAF_GET_FUNC "weed_leaf_get_func"
57 #define WEED_LEAF_SET_FUNC "weed_leaf_set_func"
58 #define WEED_PLANT_NEW_FUNC "weed_plant_new_func"
59 #define WEED_PLANT_LIST_LEAVES_FUNC "weed_plant_list_leaves_func"
60 #define WEED_LEAF_NUM_ELEMENTS_FUNC "weed_leaf_num_elements_func"
61 #define WEED_LEAF_ELEMENT_SIZE_FUNC "weed_leaf_element_size_func"
62 #define WEED_LEAF_SEED_TYPE_FUNC "weed_leaf_seed_type_func"
63 #define WEED_LEAF_GET_FLAGS_FUNC "weed_leaf_get_flags_func"
64 #define WEED_LEAF_MALLOC_FUNC "weed_malloc_func"
65 #define WEED_LEAF_FREE_FUNC "weed_free_func"
66 #define WEED_LEAF_MEMSET_FUNC "weed_memset_func"
67 #define WEED_LEAF_MEMCPY_FUNC "weed_memcpy_func"
68 
69 // filter_class
70 #define WEED_LEAF_INIT_FUNC "init_func"
71 #define WEED_LEAF_DEINIT_FUNC "deinit_func"
72 #define WEED_LEAF_PROCESS_FUNC "process_func"
73 #define WEED_LEAF_DISPLAY_FUNC "display_func"
74 #define WEED_LEAF_INTERPOLATE_FUNC "interpolate_func"
75 #define WEED_LEAF_TARGET_FPS "target_fps"
76 #define WEED_LEAF_GUI "gui"
77 #define WEED_LEAF_DESCRIPTION "description"
78 #define WEED_LEAF_AUTHOR "author"
79 #define WEED_LEAF_EXTRA_AUTHORS "extra_authors"
80 #define WEED_LEAF_URL "url"
81 #define WEED_LEAF_ICON "icon"
82 #define WEED_LEAF_LICENSE "license"
83 #define WEED_LEAF_COPYRIGHT "copyright"
84 #define WEED_LEAF_VERSION "version"
85 
86 // instance
87 #define WEED_LEAF_FILTER_CLASS "filter_class"
88 #define WEED_LEAF_TIMECODE "timecode"
89 #define WEED_LEAF_FPS "fps"
90 
91 // channels / chan template
92 #define WEED_LEAF_PIXEL_DATA "pixel_data"
93 #define WEED_LEAF_WIDTH "width"
94 #define WEED_LEAF_HEIGHT "height"
95 #define WEED_LEAF_PALETTE_LIST "palette_list"
96 #define WEED_LEAF_CURRENT_PALETTE "current_palette"
97 #define WEED_LEAF_ROWSTRIDES "rowstrides"
98 #define WEED_LEAF_YUV_SUBSPACE "YUV_subspace"
99 #define WEED_LEAF_YUV_SAMPLING "YUV_sampling"
100 #define WEED_LEAF_YUV_CLAMPING "YUV_clamping"
101 #define WEED_LEAF_IN_CHANNELS "in_channels"
102 #define WEED_LEAF_OUT_CHANNELS "out_channels"
103 #define WEED_LEAF_IN_CHANNEL_TEMPLATES "in_channel_templates"
104 #define WEED_LEAF_OUT_CHANNEL_TEMPLATES "out_channel_templates"
105 #define WEED_LEAF_OFFSET "offset"
106 #define WEED_LEAF_HSTEP "hstep"
107 #define WEED_LEAF_VSTEP "vstep"
108 #define WEED_LEAF_MAXWIDTH "maxwidth"
109 #define WEED_LEAF_MAXHEIGHT "maxheight"
110 #define WEED_LEAF_OPTIONAL "optional"
111 #define WEED_LEAF_DISABLED "disabled"
112 #define WEED_LEAF_ALIGNMENT "alignment"
113 #define WEED_LEAF_TEMPLATE "template"
114 #define WEED_LEAF_PIXEL_ASPECT_RATIO "pixel_aspect_ratio"
115 #define WEED_LEAF_ROWSTRIDE_ALIGNMENT_HINT "rowstride_alignment_hint"
116 #define WEED_LEAF_MAX_REPEATS "max_repeats"
117 #ifdef TEST_GAMMA
118 #define WEED_LEAF_GAMMA_TYPE "gamma_type"
119 // values will be WEED_GAMMA_TYPE_SRGB, WEED_GAMMA_TYPE_LINEAR, WEED_GAMMA_TYPE_MONITOR
120 #endif
121 
122 // params / param tmpl
123 #define WEED_LEAF_IN_PARAMETERS "in_parameters"
124 #define WEED_LEAF_OUT_PARAMETERS "out_parameters"
125 #define WEED_LEAF_VALUE "value"
126 #define WEED_LEAF_FLAGS "flags"
127 #define WEED_LEAF_HINT "hint"
128 #define WEED_LEAF_GROUP "group"
129 #define WEED_LEAF_NAME "name"
130 #define WEED_LEAF_DEFAULT "default"
131 #define WEED_LEAF_MIN "min"
132 #define WEED_LEAF_MAX "max"
133 #define WEED_LEAF_IGNORE "ignore"
134 #define WEED_LEAF_NEW_DEFAULT "new_default"
135 #define WEED_LEAF_COLORSPACE "colorspace"
136 #define WEED_LEAF_IN_PARAMETER_TEMPLATES "in_parameter_templates"
137 #define WEED_LEAF_OUT_PARAMETER_TEMPLATES "out_parameter_templates"
138 #define WEED_LEAF_TRANSITION "transition"
139 #define WEED_LEAF_IS_VOLUME_MASTER "is_volume_master"
140 
141 // audio
142 #define WEED_LEAF_IS_AUDIO "is_audio"
143 #define WEED_LEAF_AUDIO_DATA "audio_data"
144 #define WEED_LEAF_AUDIO_DATA_LENGTH "audio_data_length"
145 #define WEED_LEAF_AUDIO_RATE "audio_rate"
146 #define WEED_LEAF_AUDIO_CHANNELS "audio_channels"
147 #define WEED_LEAF_AUDIO_INTERLEAF "audio_interleaf"
148 
149 // param gui
150 #define WEED_LEAF_WRAP "wrap"
151 #define WEED_LEAF_MAXCHARS "maxchars"
152 #define WEED_LEAF_LABEL "label"
153 #define WEED_LEAF_DECIMALS "decimals"
154 #define WEED_LEAF_STEP_SIZE "step_size"
155 #define WEED_LEAF_CHOICES "choices"
156 #define WEED_LEAF_USE_MNEMONIC "use_mnemonic"
157 #define WEED_LEAF_HIDDEN "hidden"
158 #define WEED_LEAF_DISPLAY_VALUE "display_value"
159 #define WEED_LEAF_COPY_VALUE_TO "copy_value_to"
160 
161 // plugin gui: layout
162 #define WEED_LEAF_LAYOUT_SCHEME "layout_scheme"
163 #define WEED_LEAF_RFX_STRINGS "rfx_strings"
164 #define WEED_LEAF_RFX_DELIM "rfx_delim"
165 
166 // plugin specific values
167 #define WEED_LEAF_PLUGIN_UNSTABLE "plugin_unstable" // plugin hint to host
168 
169 // internal values
170 #define WEED_LEAF_HOST_AUDIO_PLAYER "host_audio_player" // exported to plugins
171 
172 #define WEED_LEAF_HOST_ORIG_PDATA "host_orig_pdata" // set if we "steal" an alpha channel to chain
173 #define WEED_LEAF_HOST_MENU_HIDE "host_menu_hide" // hide from menus
174 #define WEED_LEAF_HOST_DEFAULT "host_default" // user set default
175 #define WEED_LEAF_HOST_WIDTH "host_width" // user set width
176 #define WEED_LEAF_HOST_HEIGHT "host_height" // user set height
177 #define WEED_LEAF_HOST_FPS "host_fps" // user set fps
178 #define WEED_LEAF_HOST_TAG "host_tag" // internal key mapping (for higher keys)
179 #define WEED_LEAF_HOST_KEY "host_key" // internal key mapping
180 #define WEED_LEAF_HOST_MODE "host_mode" // internal mode mapping
181 #define WEED_LEAF_HOST_INPLACE "host_inplace" // inplace effect
182 #define WEED_LEAF_HOST_DISABLED "host_disabled" // channel is disabled
183 #define WEED_LEAF_HOST_TEMP_DISABLED "host_temp_disabled" // channel is temp disabled
184 #define WEED_LEAF_HOST_REFS "host_refs" // host ref counting
185 #define WEED_LEAF_HOST_REPEATS "host_repeats" // host channel repeats
186 #define WEED_LEAF_HOST_INITED "host_inited" // inited or not
187 #define WEED_LEAF_HOST_PLUGIN_PATH "host_plugin_path" // plugin path
188 #define WEED_LEAF_HOST_HANDLE "host_handle" // dll handle
189 #define WEED_LEAF_HOST_FILTER_LIST "host_filter_list" // host usable filters
190 #define WEED_LEAF_HOST_NORECORD "host_norecord" // do not record parameter changes for this instance
191 
192 #define WEED_LEAF_HOST_INSTANCE "host_instance" // special value for text widgets
193 #define WEED_LEAF_HOST_IDX "host_idx" // special value for text widgets
194 
195 #define WEED_LEAF_HOST_SCRAP_FILE_OFFSET "scrap_file_offset" // special value for scrap_file
196 
197 // compound plugins
198 #define WEED_LEAF_HOST_INTERNAL_CONNECTION "host_internal_connection" // for chain plugins
199 #define WEED_LEAF_HOST_INTERNAL_CONNECTION_AUTOSCALE "host_internal_connection_autoscale" // for chain plugins
200 #define WEED_LEAF_HOST_NEXT_INSTANCE "host_next_instance" // for chain plugins
201 #define WEED_LEAF_HOST_COMPOUND_CLASS "host_compound_class" // for chain plugins
202 #define WEED_LEAF_HOST_CHANNEL_CONNECTION "host_channel_connection" // special value for text widgets
203 
204 
205 // layer only values
206 
207 #define WEED_LEAF_CLIP "clip"
208 #define WEED_LEAF_FRAME "frame"
209 
211 weed_plant_t *weed_bootstrap_func(weed_default_getter_f *value, int num_versions, int *plugin_versions);
212 
213 weed_plant_t *get_weed_filter(int filter_idx); // TODO: make const
214 char *weed_filter_idx_get_name(int filter_idx) WARN_UNUSED;
215 char *weed_instance_get_filter_name(weed_plant_t *inst, boolean get_compound_parent) WARN_UNUSED;
216 char *make_weed_hashname(int filter_idx, boolean fullname,
217  boolean use_extra_authors) WARN_UNUSED;
218 int weed_get_idx_for_hashname(const char *hashname, boolean fullname);
219 int *weed_get_indices_from_template(const char *package_name, const char *filter_name, const char *author, int version);
220 int enabled_in_channels(weed_plant_t *plant, boolean count_repeats);
221 int enabled_out_channels(weed_plant_t *plant, boolean count_repeats);
222 weed_plant_t *get_enabled_channel(weed_plant_t *inst, int which, boolean is_in);
223 weed_plant_t *get_enabled_audio_channel(weed_plant_t *inst, int which, boolean is_in);
224 weed_plant_t *get_mandatory_channel(weed_plant_t *filter, int which, boolean is_in);
225 boolean weed_filter_is_resizer(weed_plant_t *filt);
226 boolean weed_instance_is_resizer(weed_plant_t *filt);
227 weed_plant_t *weed_instance_get_filter(weed_plant_t *inst, boolean get_compound_parent);
228 
229 #define PLUGIN_COMPOUND_EFFECTS_BUILTIN "effects/compound/"
230 #define PLUGIN_COMPOUND_EFFECTS_CUSTOM "plugins/effects/compound/"
231 
232 int num_compound_fx(weed_plant_t
233  *plant);
234 void load_compound_fx(void);
235 
236 boolean has_non_alpha_palette(weed_plant_t *ctmpl);
237 boolean has_alpha_palette(weed_plant_t *ctmpl);
238 
239 boolean is_audio_channel_in(weed_plant_t *inst, int chnum);
240 boolean has_video_chans_in(weed_plant_t *filter, boolean count_opt);
241 boolean has_audio_chans_in(weed_plant_t *filter, boolean count_opt);
242 boolean is_audio_channel_out(weed_plant_t *inst, int chnum);
243 boolean has_video_chans_out(weed_plant_t *filter, boolean count_opt);
244 boolean has_audio_chans_out(weed_plant_t *filter, boolean count_opt);
245 boolean is_pure_audio(weed_plant_t *filter_or_instance, boolean count_opt);
246 
247 boolean has_video_filters(boolean analysers_only);
248 
249 #ifdef HAS_LIVES_EFFECTS_H
250 lives_fx_cat_t weed_filter_categorise(weed_plant_t *pl, int in_channels, int out_channels);
251 lives_fx_cat_t weed_filter_subcategorise(weed_plant_t *pl, lives_fx_cat_t category, boolean count_opt);
252 boolean has_audio_filters(lives_af_t af_type);
253 #endif
254 
255 char *weed_seed_type_to_text(int seed_type);
256 char *weed_error_to_text(int error);
257 
258 boolean has_usable_palette(weed_plant_t *chantmpl);
259 int check_weed_palette_list(int *palette_list, int num_palettes, int palette);
260 
261 int weed_call_init_func(weed_plant_t *instance);
262 int weed_call_deinit_func(weed_plant_t *instance);
263 
264 char *cd_to_plugin_dir(weed_plant_t *filter);
265 boolean weed_init_effect(int hotkey);
266 void weed_deinit_effect(int hotkey);
267 weed_plant_t *weed_instance_from_filter(weed_plant_t *filter);
268 int _wood_instance_ref(weed_plant_t *inst);
269 int _wood_instance_unref(weed_plant_t *inst);
270 weed_plant_t *_wood_instance_obtain(int line, char *file, int key, int mode);
271 void weed_in_parameters_free(weed_plant_t *inst);
272 void weed_in_params_free(weed_plant_t **parameters, int num_parameters);
273 void add_param_connections(weed_plant_t *inst);
274 lives_filter_error_t weed_reinit_effect(weed_plant_t *inst, boolean reinit_compound);
275 void weed_reinit_all(void);
276 
277 int weed_flagset_array_count(weed_plant_t **array, boolean set_readonly);
278 
279 int num_alpha_channels(weed_plant_t *filter, boolean out);
280 
281 int num_in_params(weed_plant_t *, boolean skip_hidden, boolean skip_internal);
282 int num_out_params(weed_plant_t *);
283 weed_plant_t *weed_inst_in_param(weed_plant_t *inst, int param_num, boolean skip_hidden, boolean skip_internal);
284 weed_plant_t *weed_inst_out_param(weed_plant_t *inst, int param_num);
285 weed_plant_t *weed_filter_in_paramtmpl(weed_plant_t *filter, int param_num, boolean skip_internal);
286 weed_plant_t *weed_filter_out_paramtmpl(weed_plant_t *filter, int param_num);
287 boolean is_hidden_param(weed_plant_t *, int i);
288 int get_nth_simple_param(weed_plant_t *, int pnum);
289 int count_simple_params(weed_plant_t *);
290 weed_plant_t **weed_params_create(weed_plant_t *filter, boolean in);
291 int get_transition_param(weed_plant_t *filter, boolean skip_internal);
292 int get_master_vol_param(weed_plant_t *filter, boolean skip_internal);
293 boolean is_perchannel_multiw(weed_plant_t *param);
294 boolean has_perchannel_multiw(weed_plant_t *filter);
295 boolean weed_parameter_has_variable_elements_strict(weed_plant_t *inst, weed_plant_t *ptmpl);
296 
298 boolean interpolate_param(weed_plant_t *inst, int i, void *pchain, weed_timecode_t tc);
299 boolean interpolate_params(weed_plant_t *inst, void **pchains, weed_timecode_t tc);
300 
301 int filter_mutex_lock(int key); // 0 based key
302 int filter_mutex_trylock(int key); // 0 based key
303 int filter_mutex_unlock(int key); // 0 based key
304 
305 size_t weed_plant_serialise(int fd, weed_plant_t *plant, unsigned char **mem);
306 weed_plant_t *weed_plant_deserialise(int fd, unsigned char **mem, weed_plant_t *plant);
307 
309 void rec_param_change(weed_plant_t *inst, int pnum);
310 
311 // copy values for "copy_value_to" params
312 int set_copy_to(weed_plant_t *inst, int pnum, boolean update);
313 
314 weed_plant_t *get_textparm();
315 
316 void weed_set_blend_factor(int hotkey); // 0 based key
317 int weed_get_blend_factor(int hotkey); // 0 based key
318 
319 void weed_memory_init(void);
320 
321 void weed_load_all(void);
322 void weed_unload_all(void);
323 int get_next_free_key(void);
324 
325 void weed_deinit_all(boolean shutdown);
326 
327 weed_plant_t *weed_apply_effects(weed_plant_t **layers, weed_plant_t *filter_map, weed_timecode_t tc, int opwidth, int opheight,
328  void ***pchains);
329 lives_filter_error_t weed_apply_instance(weed_plant_t *inst, weed_plant_t *init_event, weed_plant_t **layers,
330  int opwidth, int opheight, weed_timecode_t tc);
331 void weed_apply_audio_effects(weed_plant_t *filter_map, float **abuf, int nbtracks, int nchans, int64_t nsamps, double arate,
332  weed_timecode_t tc, double *vis);
333 void weed_apply_audio_effects_rt(float **abuf, int nchans, int64_t nsamps, double arate, weed_timecode_t tc, boolean analysers_only);
334 
335 lives_filter_error_t weed_apply_audio_instance(weed_plant_t *init_event, float **abuf, int nbtracks, int nchans, int64_t nsamps,
336  double arate, weed_timecode_t tc, double *vis);
337 
338 boolean weed_generator_start(weed_plant_t *inst, int key); // 0 based key
339 void weed_generator_end(weed_plant_t *inst);
340 boolean weed_playback_gen_start(void);
341 void weed_bg_generator_end(weed_plant_t *inst);
342 void wge_inner(weed_plant_t *inst, boolean unref);
343 
344 // layers
345 weed_plant_t *weed_layer_create_from_generator(weed_plant_t *inst, weed_timecode_t tc);
346 weed_plant_t *weed_layer_new();
347 weed_plant_t *weed_layer_new_for_frame();
348 void **weed_layer_get_pixel_data(weed_plant_t *layer);
349 int *weed_layer_get_rowstrides(weed_plant_t *layer);
350 int weed_layer_get_width(weed_plant_t *layer);
351 int weed_layer_get_height(weed_plant_t *layer);
352 int weed_layer_current_palette(weed_plant_t *layer);
353 
355 void backup_weed_instances(void);
356 void restore_weed_instances(void);
357 
359 // WARNING !! "key" here starts at 1, "mode" starts at 0
360 
361 boolean rte_key_valid(int key, boolean is_userkey);
362 boolean rte_keymode_valid(int key, int mode,
363  boolean is_userkey);
364 int rte_keymode_get_filter_idx(int key, int mode);
366 char *rte_keymode_get_filter_name(int key, int mode) WARN_UNUSED;
367 char *rte_keymode_get_plugin_name(int key, int mode) WARN_UNUSED;
368 char *rte_keymode_get_type(int key, int mode) WARN_UNUSED;
369 
370 #ifdef HAS_LIVES_EFFECTS_H
371 lives_fx_cat_t rte_keymode_get_category(int key, int mode);
372 #endif
373 
374 weed_plant_t *rte_keymode_get_instance(int key, int mode);
375 weed_plant_t *rte_keymode_get_filter(int key, int mode);
376 
377 boolean weed_delete_effectkey(int key, int mode);
378 int weed_add_effectkey(int key, const char *hashname, boolean fullname);
379 
380 int weed_add_effectkey_by_idx(int key, int idx);
381 
382 int rte_key_getmode(int key);
383 int rte_key_getmaxmode(int key);
384 
385 weed_plant_t *get_new_inst_for_keymode(int key, int mode);
386 
387 boolean rte_key_setmode(int key, int newmode);
388 
390 int rte_switch_keymode(int key, int mode, const char *hashname);
391 
393 
394 LiVESList *weed_get_all_names(lives_fx_list_t list_type);
395 int rte_get_numfilters(boolean inc_dupes);
396 
398 // key starts at 0
399 
400 void free_key_defaults(int key, int mode);
401 void apply_key_defaults(weed_plant_t *inst, int key, int mode);
402 void write_key_defaults(int fd, int key, int mode);
403 boolean read_key_defaults(int fd, int nparams, int key, int mode, int version);
404 void set_key_defaults(weed_plant_t *inst, int key, int mode);
405 boolean has_key_defaults(void);
406 
408 // 0 based keys
409 void rte_swap_fg_bg(void);
410 
411 int rte_bg_gen_key(void) GNU_PURE;
412 
413 int rte_fg_gen_key(void) GNU_PURE;
414 
415 int rte_bg_gen_mode(void) GNU_PURE;
416 int rte_fg_gen_mode(void) GNU_PURE;
417 
419 
420 char *get_weed_display_string(weed_plant_t *inst, int pnum);
421 weed_plant_t *add_filter_deinit_events(weed_plant_t *event_list);
422 weed_plant_t *add_filter_init_events(weed_plant_t *event_list, weed_timecode_t tc);
423 void deinit_render_effects(void);
424 
425 boolean write_filter_defaults(int fd, int idx);
426 boolean read_filter_defaults(int fd);
427 
428 boolean write_generator_sizes(int fd, int idx);
429 boolean read_generator_sizes(int fd);
430 
431 int step_val(int val, int step);
432 
433 void set_param_gui_readwrite(weed_plant_t *inst);
434 void set_param_gui_readonly(weed_plant_t *inst);
435 
436 void weed_add_plant_flags(weed_plant_t *plant, int flags);
437 
438 void update_host_info(weed_plant_t *inst);
439 
441 void fill_param_vals_to(weed_plant_t *param, weed_plant_t *ptmpl, int fill_slot);
442 
443 // some general utilities
444 
445 #define WEED_PLANT_IS_PLUGIN_INFO(plant) (weed_get_plant_type(plant) == WEED_PLANT_PLUGIN_INFO ? 1 : 0)
446 #define WEED_PLANT_IS_HOST_INFO(plant) (weed_get_plant_type(plant) == WEED_PLANT_HOST_INFO ? 1 : 0)
447 #define WEED_PLANT_IS_FILTER_CLASS(plant) (weed_get_plant_type(plant) == WEED_PLANT_FILTER_CLASS ? 1 : 0)
448 #define WEED_PLANT_IS_FILTER_INSTANCE(plant) (weed_get_plant_type(plant) == WEED_PLANT_FILTER_INSTANCE ? 1 : 0)
449 #define WEED_PLANT_IS_CHANNEL(plant) (weed_get_plant_type(plant) == WEED_PLANT_CHANNEL ? 1 : 0)
450 #define WEED_PLANT_IS_CHANNEL_TEMPLATE(plant) (weed_get_plant_type(plant) == WEED_PLANT_CHANNEL_TEMPLATE ? 1 : 0)
451 #define WEED_PLANT_IS_PARAMETER(plant) (weed_get_plant_type(plant) == WEED_PLANT_PARAMETER ? 1 : 0)
452 #define WEED_PLANT_IS_PARAMETER_TEMPLATE(plant) (weed_get_plant_type(plant) == WEED_PLANT_PARAMETER_TEMPLATE ? 1 : 0)
453 #define WEED_PLANT_IS_GUI(plant) (weed_get_plant_type(plant) == WEED_PLANT_GUI ? 1 : 0)
454 
456 
457 //#define DEBUG_FILTER_MUTEXES
458 #ifdef DEBUG_FILTER_MUTEXES
459 #define filter_mutex_lock(key) {g_print ("lock %d at line %d in file %s\n",key,__LINE__,__FILE__); if (key >= 0 && key < FX_KEYS_MAX) pthread_mutex_lock(&mainw->fx_mutex[key]); g_print("done\n");}
460 #define filter_mutex_unlock(key) {g_print ("unlock %d at line %d in file %s\n\n",key,__LINE__,__FILE__); if (key >= 0 && key < FX_KEYS_MAX) pthread_mutex_unlock(&mainw->fx_mutex[key]); g_print("done\n");}
461 #endif
462 
463 //#define DEBUG_REFCOUNT
464 #ifdef DEBUG_REFCOUNT
465 #define weed_instance_ref(a) {g_print ("ref %p at line %d in file %s\n",a,__LINE__,__FILE__); _weed_instance_ref(a);}
466 #define weed_instance_unref(a) {g_print ("unref %p at line %d in file %s\n",a,__LINE__,__FILE__); _weed_instance_unref(a);}
467 #define weed_instance_obtain(a,b) _weed_instance_obtain(__LINE__, __FILE__, a, b)
468 #endif
469 
470 int _weed_instance_ref(weed_plant_t *inst);
471 int _weed_instance_unref(weed_plant_t *inst);
472 weed_plant_t *_weed_instance_obtain(int line, char *file, int key, int mode);
473 
474 #ifndef DEBUG_REFCOUNT
475 int weed_instance_ref(weed_plant_t *inst);
476 int weed_instance_unref(weed_plant_t *inst);
477 weed_plant_t *weed_instance_obtain(int key, int mode);
478 #endif
479 
480 #endif
lives_fx_cat_t weed_filter_categorise(weed_plant_t *pl, int in_channels, int out_channels)
Definition: effects-weed.c:446
weed_plant_t * weed_layer_new()
Definition: effects-weed.c:1279
int _wood_instance_unref(weed_plant_t *inst)
boolean is_audio_channel_out(weed_plant_t *inst, int chnum)
Definition: effects-weed.c:898
int weed_flagset_array_count(weed_plant_t **array, boolean set_readonly)
Definition: effects-weed.c:1397
void rte_swap_fg_bg(void)
Definition: effects-weed.c:9448
boolean weed_instance_is_resizer(weed_plant_t *filt)
Definition: effects-weed.c:802
int * weed_layer_get_rowstrides(weed_plant_t *layer)
Definition: effects-weed.c:10628
weed_plant_t ** weed_params_create(weed_plant_t *filter, boolean in)
Definition: effects-weed.c:6214
boolean has_audio_filters(lives_af_t af_type)
Definition: effects-weed.c:4022
int rte_key_getmaxmode(int key)
returns highest mode which is set
Definition: effects-weed.c:9073
void deinit_render_effects(void)
Definition: effects-weed.c:7238
void wge_inner(weed_plant_t *inst, boolean unref)
deinit instance(s) for generator
Definition: effects-weed.c:7801
weed_plant_t * get_mandatory_channel(weed_plant_t *filter, int which, boolean is_in)
for FILTER_CLASS
Definition: effects-weed.c:765
lives_fx_cat_t
Definition: effects.h:17
Definition: effects-weed.h:12
boolean has_audio_chans_in(weed_plant_t *filter, boolean count_opt)
Definition: effects-weed.c:876
void weed_add_plant_flags(weed_plant_t *plant, int flags)
Definition: effects-weed.c:145
int step_val(int val, int step)
Definition: effects-weed.c:648
int weed_layer_get_width(weed_plant_t *layer)
Definition: effects-weed.c:10633
boolean is_hidden_param(weed_plant_t *, int i)
Definition: effects-weed.c:8200
LiVESList * weed_get_all_names(lives_fx_list_t list_type)
Definition: effects-weed.c:9465
boolean weed_delete_effectkey(int key, int mode)
unbinds a filter_class from a key/mode
Definition: effects-weed.c:8971
int filter_mutex_trylock(int key)
Definition: effects-weed.c:262
int weed_call_init_func(weed_plant_t *instance)
Definition: effects-weed.c:6990
int rte_fg_gen_key(void) GNU_PURE
Definition: effects-weed.c:9170
char * cd_to_plugin_dir(weed_plant_t *filter)
Definition: effects-weed.c:1445
Definition: effects-weed.h:27
int weed_general_error
Definition: effects-weed.h:455
boolean weed_playback_gen_start(void)
Definition: effects-weed.c:7968
Definition: effects-weed.h:13
weed_plant_t * rte_keymode_get_filter(int key, int mode)
returns filter_class bound to key/mode (or NULL)
Definition: effects-weed.c:9105
void load_compound_fx(void)
Definition: effects-weed.c:5823
char * get_weed_display_string(weed_plant_t *inst, int pnum)
Definition: effects-weed.c:8539
void free_key_defaults(int key, int mode)
Definition: effects-weed.c:11638
void add_param_connections(weed_plant_t *inst)
Definition: effects-weed.c:6375
int _weed_instance_unref(weed_plant_t *inst)
Definition: effects-weed.c:6077
boolean is_perchannel_multiw(weed_plant_t *param)
Definition: effects-weed.c:8309
weed_plant_t * _weed_instance_obtain(int line, char *file, int key, int mode)
Definition: effects-weed.c:6119
int weed_add_effectkey(int key, const char *hashname, boolean fullname)
bind a filter_class to key/mode using its hashname
Definition: effects-weed.c:9391
boolean rte_key_valid(int key, boolean is_userkey)
returns TRUE if there is a filter bound to active mode of hotkey
Definition: effects-weed.c:9037
int rte_switch_keymode(int key, int mode, const char *hashname)
Definition: effects-weed.c:9398
boolean rte_key_setmode(int key, int newmode)
set mode for a given key; if key==0 then the active key is used
Definition: effects-weed.c:9232
int weed_get_idx_for_hashname(const char *hashname, boolean fullname)
fullname includes author and version
Definition: effects-weed.c:10465
weed_plant_t * get_weed_filter(int filter_idx)
Definition: effects-weed.c:10617
lives_filter_error_t weed_apply_instance(weed_plant_t *inst, weed_plant_t *init_event, weed_plant_t **layers, int opwidth, int opheight, weed_timecode_t tc)
Definition: effects-weed.c:1801
void weed_in_parameters_free(weed_plant_t *inst)
Definition: effects-weed.c:6031
boolean write_filter_defaults(int fd, int idx)
Definition: effects-weed.c:11115
Definition: effects-weed.h:24
int weed_add_effectkey_by_idx(int key, int idx)
see description
Definition: effects-weed.c:9349
int set_copy_to(weed_plant_t *inst, int pnum, boolean update)
Definition: effects-weed.c:8576
int weed_instance_ref(weed_plant_t *inst)
Definition: effects-weed.c:6137
int check_weed_palette_list(int *palette_list, int num_palettes, int palette)
Definition: effects-weed.c:1103
weed_plant_t * weed_instance_from_filter(weed_plant_t *filter)
Definition: effects-weed.c:6420
int get_nth_simple_param(weed_plant_t *, int pnum)
Definition: effects-weed.c:8470
int weed_call_deinit_func(weed_plant_t *instance)
Definition: effects-weed.c:7018
void rec_param_change(weed_plant_t *inst, int pnum)
record a parameter value change in our event_list
Definition: effects-weed.c:8636
Definition: effects-weed.h:26
void apply_key_defaults(weed_plant_t *inst, int key, int mode)
Definition: effects-weed.c:11581
lives_fx_cat_t rte_keymode_get_category(int key, int mode)
Definition: effects-weed.c:8935
weed_plant_t * get_new_inst_for_keymode(int key, int mode)
get new refcounted inst (during recording playback)
Definition: effects-weed.c:8867
void weed_apply_audio_effects_rt(float **abuf, int nchans, int64_t nsamps, double arate, weed_timecode_t tc, boolean analysers_only)
Definition: effects-weed.c:3922
weed_plant_t * weed_plant_deserialise(int fd, unsigned char **mem, weed_plant_t *plant)
Definition: effects-weed.c:11067
weed_plant_t * add_filter_init_events(weed_plant_t *event_list, weed_timecode_t tc)
Definition: effects-weed.c:1074
boolean has_audio_chans_out(weed_plant_t *filter, boolean count_opt)
Definition: effects-weed.c:938
lives_af_t
audio filter type (any, analyser only, non analyser only)
Definition: effects.h:46
weed_plant_t * rte_keymode_get_instance(int key, int mode)
returns refcounted filter_instance bound to key/mode (or NULL)
Definition: effects-weed.c:9090
void weed_generator_end(weed_plant_t *inst)
Definition: effects-weed.c:7833
boolean interpolate_param(weed_plant_t *inst, int i, void *pchain, weed_timecode_t tc)
parameter interpolation
Definition: effects-weed.c:9791
int filter_mutex_lock(int key)
Definition: effects-weed.c:278
lives_filter_error_t
filter apply errors
Definition: effects-weed.h:11
boolean read_generator_sizes(int fd)
Definition: effects-weed.c:11334
void fill_param_vals_to(weed_plant_t *param, weed_plant_t *ptmpl, int fill_slot)
add default filler values to a parameter or pchange.
Definition: effects-weed.c:9511
weed_plant_t * weed_inst_in_param(weed_plant_t *inst, int param_num, boolean skip_hidden, boolean skip_internal)
Definition: effects-weed.c:8343
int rte_fg_gen_mode(void) GNU_PURE
Definition: effects-weed.c:9180
void set_param_gui_readwrite(weed_plant_t *inst)
Definition: effects-weed.c:1423
int rte_bg_gen_mode(void) GNU_PURE
Definition: effects-weed.c:9175
weed_plant_t * weed_filter_in_paramtmpl(weed_plant_t *filter, int param_num, boolean skip_internal)
Definition: effects-weed.c:8413
int get_master_vol_param(weed_plant_t *filter, boolean skip_internal)
Definition: effects-weed.c:8287
int weed_layer_current_palette(weed_plant_t *layer)
void weed_set_blend_factor(int hotkey)
Definition: effects-weed.c:8672
const char * version(void)
boolean weed_generator_start(weed_plant_t *inst, int key)
Definition: effects-weed.c:7545
_palette * palette
Definition: main.c:108
int rte_bg_gen_key(void) GNU_PURE
Definition: effects-weed.c:9165
weed_plant_t * weed_apply_effects(weed_plant_t **layers, weed_plant_t *filter_map, weed_timecode_t tc, int opwidth, int opheight, void ***pchains)
Definition: effects-weed.c:3730
void update_host_info(weed_plant_t *inst)
Definition: effects-weed.c:682
values >= 512 are info
Definition: effects-weed.h:35
boolean read_key_defaults(int fd, int nparams, int key, int mode, int version)
Definition: effects-weed.c:11468
Definition: effects-weed.h:25
weed_plant_t * get_enabled_audio_channel(weed_plant_t *inst, int which, boolean is_in)
for FILTER_INST
Definition: effects-weed.c:759
int rte_key_getmode(int key)
returns current active mode for a key (or -1)
Definition: effects-weed.c:9064
char * weed_instance_get_filter_name(weed_plant_t *inst, boolean get_compound_parent) WARN_UNUSED
Definition: effects-weed.c:9126
boolean has_usable_palette(weed_plant_t *chantmpl)
Definition: effects-weed.c:4149
void weed_deinit_effect(int hotkey)
hotkey starts at 1
Definition: effects-weed.c:7049
char * rte_keymode_get_plugin_name(int key, int mode) WARN_UNUSED
returns name of plugin package containing filter_class (or "")
Definition: effects-weed.c:9148
void weed_deinit_all(boolean shutdown)
deinit all active effects
Definition: effects-weed.c:7256
boolean weed_init_effect(int hotkey)
hotkey starts at 1
Definition: effects-weed.c:6548
char * make_weed_hashname(int filter_idx, boolean fullname, boolean use_extra_authors) WARN_UNUSED
fullname includes author and version
Definition: effects-weed.c:10408
boolean weed_parameter_has_variable_elements_strict(weed_plant_t *inst, weed_plant_t *ptmpl)
Definition: effects-weed.c:970
Definition: effects-weed.h:14
Definition: effects-weed.h:41
void weed_memory_init(void)
call weed_init() with mem functions
Definition: effects-weed.c:4886
int _wood_instance_ref(weed_plant_t *inst)
int rte_get_numfilters(boolean inc_dupes)
Definition: effects-weed.c:9502
lives_fx_list_t
Definition: effects-weed.h:38
boolean has_video_chans_in(weed_plant_t *filter, boolean count_opt)
Definition: effects-weed.c:854
int enabled_out_channels(weed_plant_t *plant, boolean count_repeats)
Definition: effects-weed.c:4218
weed_plant_t * weed_bootstrap_func(weed_default_getter_f *value, int num_versions, int *plugin_versions)
bootstrap function for weed plugins
Definition: effects-weed.c:204
Definition: effects-weed.h:21
Definition: effects-weed.h:18
weed_plant_t * get_textparm()
Definition: effects-weed.c:9185
int num_in_params(weed_plant_t *, boolean skip_hidden, boolean skip_internal)
Definition: effects-weed.c:4084
void ** weed_layer_get_pixel_data(weed_plant_t *layer)
Definition: effects-weed.c:10623
int enabled_in_channels(weed_plant_t *plant, boolean count_repeats)
Definition: effects-weed.c:4159
int num_out_params(weed_plant_t *)
Definition: effects-weed.c:4133
int weed_layer_get_height(weed_plant_t *layer)
Definition: effects-weed.c:10638
weed_plant_t * get_enabled_channel(weed_plant_t *inst, int which, boolean is_in)
for FILTER_INST
Definition: effects-weed.c:753
Definition: effects-weed.h:17
boolean has_alpha_palette(weed_plant_t *ctmpl)
Definition: effects-weed.c:327
void backup_weed_instances(void)
for multitrack
Definition: effects-weed.c:626
boolean is_pure_audio(weed_plant_t *filter_or_instance, boolean count_opt)
TRUE if audio in or out and no vid in/out.
Definition: effects-weed.c:960
boolean rte_keymode_valid(int key, int mode, boolean is_userkey)
set to TRUE
Definition: effects-weed.c:9047
char * weed_filter_idx_get_name(int filter_idx) WARN_UNUSED
Definition: effects-weed.c:9113
Definition: effects-weed.h:31
weed_plant_t * weed_filter_out_paramtmpl(weed_plant_t *filter, int param_num)
Definition: effects-weed.c:8451
void weed_load_all(void)
load effects
Definition: effects-weed.c:5001
int filter_mutex_unlock(int key)
Definition: effects-weed.c:284
char * weed_seed_type_to_text(int seed_type)
Definition: effects-weed.c:523
boolean has_non_alpha_palette(weed_plant_t *ctmpl)
Definition: effects-weed.c:305
int get_transition_param(weed_plant_t *filter, boolean skip_internal)
Definition: effects-weed.c:8265
int weed_get_blend_factor(int hotkey)
Definition: effects-weed.c:8808
char * rte_keymode_get_filter_name(int key, int mode) WARN_UNUSED
returns name of filter_class bound to key/mode (or "")
Definition: effects-weed.c:9139
weed_plant_t * weed_instance_obtain(int key, int mode)
Definition: effects-weed.c:6147
Definition: effects-weed.h:40
boolean has_video_chans_out(weed_plant_t *filter, boolean count_opt)
Definition: effects-weed.c:916
weed_plant_t * weed_layer_create_from_generator(weed_plant_t *inst, weed_timecode_t tc)
Definition: effects-weed.c:7388
boolean interpolate_params(weed_plant_t *inst, void **pchains, weed_timecode_t tc)
Definition: effects-weed.c:10372
Definition: effects-weed.h:15
weed_plant_t * _wood_instance_obtain(int line, char *file, int key, int mode)
void restore_weed_instances(void)
Definition: effects-weed.c:639
int weed_instance_unref(weed_plant_t *inst)
Definition: effects-weed.c:6142
int num_alpha_channels(weed_plant_t *filter, boolean out)
Definition: effects-weed.c:541
Definition: effects-weed.h:29
void set_key_defaults(weed_plant_t *inst, int key, int mode)
Definition: effects-weed.c:11663
Definition: effects-weed.h:23
boolean weed_filter_is_resizer(weed_plant_t *filt)
Definition: effects-weed.c:788
void weed_unload_all(void)
unload all effects
Definition: effects-weed.c:5870
int * weed_get_indices_from_template(const char *package_name, const char *filter_name, const char *author, int version)
Definition: effects-weed.c:10574
boolean has_perchannel_multiw(weed_plant_t *filter)
Definition: effects-weed.c:8322
void set_param_gui_readonly(weed_plant_t *inst)
Definition: effects-weed.c:1404
int _weed_instance_ref(weed_plant_t *inst)
Definition: effects-weed.c:6100
#define GNU_PURE
Definition: main.h:263
weed_plant_t * weed_instance_get_filter(weed_plant_t *inst, boolean get_compound_parent)
Definition: effects-weed.c:349
Definition: effects-weed.h:30
void weed_reinit_all(void)
Definition: effects-weed.c:1560
boolean has_video_filters(boolean analysers_only)
Definition: effects-weed.c:4049
int count_simple_params(weed_plant_t *)
Definition: effects-weed.c:8513
Definition: effects-weed.h:22
void weed_bg_generator_end(weed_plant_t *inst)
Definition: effects-weed.c:7954
weed_plant_t * add_filter_deinit_events(weed_plant_t *event_list)
Definition: effects-weed.c:1042
Definition: effects-weed.h:28
Definition: effects-weed.h:20
char * weed_error_to_text(int error)
Definition: effects-weed.c:357
size_t weed_plant_serialise(int fd, weed_plant_t *plant, unsigned char **mem)
Definition: effects-weed.c:10758
Definition: effects-weed.h:32
lives_filter_error_t weed_apply_audio_instance(weed_plant_t *init_event, float **abuf, int nbtracks, int nchans, int64_t nsamps, double arate, weed_timecode_t tc, double *vis)
Definition: effects-weed.c:3269
void weed_apply_audio_effects(weed_plant_t *filter_map, float **abuf, int nbtracks, int nchans, int64_t nsamps, double arate, weed_timecode_t tc, double *vis)
Definition: effects-weed.c:3886
Definition: effects-weed.h:19
boolean is_audio_channel_in(weed_plant_t *inst, int chnum)
Definition: effects-weed.c:808
boolean write_generator_sizes(int fd, int idx)
Definition: effects-weed.c:11279
Definition: effects-weed.h:16
int num_compound_fx(weed_plant_t *plant)
return number of filters in a compound fx (1 if it is not compound) - works for filter or inst ...
Definition: effects-weed.c:294
#define WARN_UNUSED
Definition: main.h:262
lives_filter_error_t weed_reinit_effect(weed_plant_t *inst, boolean reinit_compound)
Definition: effects-weed.c:1467
char * rte_keymode_get_type(int key, int mode) WARN_UNUSED
returns a string filter/instance type (or "")
Definition: effects-weed.c:8909
void write_key_defaults(int fd, int key, int mode)
Definition: effects-weed.c:11614
weed_plant_t * weed_layer_new_for_frame()
int get_next_free_key(void)
next free "key" for the multitrack system
Definition: effects-weed.c:8956
int rte_keymode_get_filter_idx(int key, int mode)
returns filter_class index of key/mode (or -1 if no filter bound)
Definition: effects-weed.c:9056
Definition: effects-weed.h:39
void weed_in_params_free(weed_plant_t **parameters, int num_parameters)
Definition: effects-weed.c:6018
lives_fx_cat_t weed_filter_subcategorise(weed_plant_t *pl, lives_fx_cat_t category, boolean count_opt)
Definition: effects-weed.c:492
boolean has_key_defaults(void)
Definition: effects-weed.c:11700
weed_plant_t * weed_inst_out_param(weed_plant_t *inst, int param_num)
Definition: effects-weed.c:8389
boolean read_filter_defaults(int fd)
Definition: effects-weed.c:11163