Go to the documentation of this file.
7 #ifndef HAS_LIVES_EFFECTS_WEED_H
8 #define HAS_LIVES_EFFECTS_WEED_H
10 #define MAX_WEED_STRLEN 65535 // soft limit for LiVES
11 #define MAX_WEED_ELEMENTS 65535 // soft limit for LiVES
52 #define WEED_FLAG_HOST_READONLY (1 << 16)
55 #define WEED_LEAF_HOST_SUSPICIOUS "host_suspicious" // plugin is badly behaved
58 #define WEED_LEAF_HOST_AUDIO_PLAYER "host_audio_player" // exported to plugins
60 #define WEED_LEAF_HOST_ORIG_PDATA "host_orig_pdata" // set if we "steal" an alpha channel to chain
61 #define WEED_LEAF_HOST_MENU_HIDE "host_menu_hide" // hide from menus
62 #define WEED_LEAF_HOST_DEFAULT "host_default" // user set default
63 #define WEED_LEAF_HOST_WIDTH "host_width" // user set width
64 #define WEED_LEAF_HOST_HEIGHT "host_height" // user set height
65 #define WEED_LEAF_HOST_FPS "host_fps" // user set fps
66 #define WEED_LEAF_HOST_TAG "host_tag" // internal key mapping (for higher keys)
67 #define WEED_LEAF_HOST_KEY "host_key" // internal key mapping
68 #define WEED_LEAF_HOST_MODE "host_mode" // internal mode mapping
69 #define WEED_LEAF_HOST_INPLACE "host_inplace" // inplace effect
70 #define WEED_LEAF_HOST_DISABLED "host_disabled" // channel is disabled
71 #define WEED_LEAF_HOST_TEMP_DISABLED "host_temp_dis" // channel is temp disabled
72 #define WEED_LEAF_HOST_REFS "host_refs" // host ref counting
73 #define WEED_LEAF_HOST_REPEATS "host_repeats" // host channel repeats
74 #define WEED_LEAF_HOST_INITED "host_inited" // inited or not
75 #define WEED_LEAF_HOST_PLUGIN_PATH "host_plugin_path" // plugin path
76 #define WEED_LEAF_HOST_HANDLE "host_handle" // dll handle
77 #define WEED_LEAF_HOST_FILTER_LIST "host_filter_list" // host usable filters
78 #define WEED_LEAF_HOST_NORECORD "host_norecord" // do not record parameter changes for this instance
79 #define WEED_LEAF_DUPLICATE "host_duplicate"
80 #define WEED_LEAF_HOST_REINITING "host_reiniting"
81 #define WEED_LEAF_HOST_UNUSED "host_unused"
83 #define WEED_LEAF_HOST_INSTANCE "host_instance" // special value for text widgets
84 #define WEED_LEAF_HOST_IDX "host_idx" // special value for text widgets
86 #define WEED_LEAF_FREED_PLANTS "host_freed_plants" // list of freed pointers to avoid freeing dupes during unload
88 #define WEED_LEAF_HOST_SCRAP_FILE_OFFSET "scrap_offset" // special value for scrap_file
90 #define WEED_LEAF_HOST_IDENTIFIER "host_unique_id"
92 #define WEED_LEAF_HOST_EASING_END "host_easing_end"
93 #define WEED_LEAF_HOST_EASE_OUT_COUNT "host_ease_out_count"
94 #define WEED_LEAF_AUTO_EASING "host_auto_easing"
96 #define WEED_LEAF_RFX_STRINGS "layout_rfx_strings"
97 #define WEED_LEAF_RFX_DELIM "layout_rfx_delim"
99 #define WEED_LEAF_HOST_PLUGIN_NAME "host_plugin_name"
102 #define WEED_LEAF_HOST_INTERNAL_CONNECTION "host_internal_connection" // for chain plugins
103 #define WEED_LEAF_HOST_INTERNAL_CONNECTION_AUTOSCALE "host_internal_connection_autoscale" // for chain plugins
104 #define WEED_LEAF_HOST_NEXT_INSTANCE "host_next_instance" // for chain plugins
105 #define WEED_LEAF_HOST_COMPOUND_CLASS "host_compound_class" // for chain plugins
106 #define WEED_LEAF_HOST_CHANNEL_CONNECTION "host_channel_connection" // special value for text widgets
109 #define LIVES_FLAG_MAINTAIN_VALUE (1 << 16)
116 boolean use_extra_authors,
char sep,
boolean spc_to_underscore)
WARN_UNUSED;
128 #define PLUGIN_COMPOUND_EFFECTS_BUILTIN "effects/compound/"
129 #define PLUGIN_COMPOUND_EFFECTS_CUSTOM "plugins/effects/compound/"
143 boolean is_pure_audio(weed_plant_t *filter_or_instance,
boolean count_opt);
147 #ifdef HAS_LIVES_EFFECTS_H
178 int num_in_params(weed_plant_t *,
boolean skip_hidden,
boolean skip_internal);
180 weed_plant_t *
weed_inst_in_param(weed_plant_t *inst,
int param_num,
boolean skip_hidden,
boolean skip_internal);
227 int opwidth,
int opheight,
ticks_t tc);
234 double arate,
ticks_t tc,
double *vis);
264 #ifdef HAS_LIVES_EFFECTS_H
337 #ifdef DEBUG_FILTER_MUTEXES
338 #define filter_mutex_lock(key) {g_print ("lock %d at line %d in file %s\n",key,__LINE__,__FILE__); \
339 if (key >= 0 && key < FX_KEYS_MAX) pthread_mutex_lock(&mainw->fx_mutex[key]); g_print("done\n");}
340 #define filter_mutex_unlock(key) {g_print ("unlock %d at line %d in file %s\n\n",key,__LINE__,__FILE__); \
341 if (key >= 0 && key < FX_KEYS_MAX) pthread_mutex_unlock(&mainw->fx_mutex[key]); g_print("done\n");}
345 #ifdef DEBUG_REFCOUNT
346 #define weed_instance_ref(a) {g_print ("ref %p at line %d in file %s\n",a,__LINE__,__FILE__); _weed_instance_ref(a);}
347 #define weed_instance_unref(a) {g_print ("unref %p at line %d in file %s\n",a,__LINE__,__FILE__); _weed_instance_unref(a);}
348 #define weed_instance_obtain(a,b) _weed_instance_obtain(__LINE__, __FILE__, a, b)
355 #ifndef DEBUG_REFCOUNT
361 #define WEED_ERROR_NOSUCH_PLANT 65536
363 weed_plant_t *
host_info_cb(weed_plant_t *xhost_info,
void *data);
365 weed_error_t
weed_leaf_set_host(weed_plant_t *plant,
const char *key, uint32_t seed_type, weed_size_t num_elems,
void *value);
char * weed_filter_idx_get_name(int idx, boolean add_subcats, boolean add_notes) WARN_UNUSED
boolean has_perchannel_multiw(weed_plant_t *filter)
weed_error_t weed_leaf_copy_or_delete(weed_layer_t *dlayer, const char *key, weed_layer_t *slayer)
int get_nth_simple_param(weed_plant_t *, int pnum)
void deinit_render_effects(void)
switch off effects after render preview during rendering/render preview, we use the "keys" FX_KEYS_MA...
boolean has_audio_chans_in(weed_plant_t *filter, boolean count_opt)
LiVESList * weed_get_all_names(lives_fx_list_t list_type)
weed_plant_t * _weed_instance_obtain(int line, char *file, int key, int mode)
boolean has_audio_filters(lives_af_t af_type)
weed_plant_t * _wood_instance_obtain(int line, char *file, int key, int mode)
weed_plant_t * add_filter_deinit_events(weed_plant_t *event_list)
add effect_deinit events to an event_list
boolean weed_delete_effectkey(int key, int mode)
unbinds a filter_class from a key/mode
void weed_apply_audio_effects_rt(weed_layer_t *alayer, ticks_t tc, boolean analysers_only, boolean is_audio_thread)
weed_error_t weed_call_init_func(weed_plant_t *instance)
boolean rte_key_setmode(int key, int newmode)
set mode for a given key; if key==0 then the active key is used
int weed_instance_unref(weed_plant_t *inst)
const char * version(void)
int rte_fg_gen_mode(void) GNU_PURE
weed_plant_t * add_filter_init_events(weed_plant_t *event_list, ticks_t tc)
void free_key_defaults(int key, int mode)
boolean read_filter_defaults(int fd)
boolean weed_parameter_has_variable_elements_strict(weed_plant_t *inst, weed_plant_t *ptmpl)
char * get_weed_display_string(weed_plant_t *inst, int pnum)
weed_plant_t * weed_filter_in_paramtmpl(weed_plant_t *filter, int param_num, boolean skip_internal)
@ FILTER_ERROR_INVALID_TRACK
weed_error_t weed_call_deinit_func(weed_plant_t *instance)
int weed_instance_ref(weed_plant_t *inst)
lives_filter_error_t weed_apply_audio_instance(weed_plant_t *init_event, weed_layer_t **layers, int nbtracks, int nchans, int64_t nsamps, double arate, ticks_t tc, double *vis)
boolean is_perchannel_multiw(weed_plant_t *param)
@ FILTER_ERROR_INVALID_PLUGIN
boolean weed_instance_is_resizer(weed_plant_t *filt)
void rte_swap_fg_bg(void)
lives_fx_cat_t rte_keymode_get_category(int key, int mode)
@ FILTER_ERROR_DONT_THREAD
weed_plant_t * weed_plant_deserialise(int fd, unsigned char **mem, weed_plant_t *plant)
lives_filter_error_t weed_apply_instance(weed_plant_t *inst, weed_plant_t *init_event, weed_plant_t **layers, int opwidth, int opheight, ticks_t tc)
int enabled_in_channels(weed_plant_t *plant, boolean count_repeats)
void weed_in_params_free(weed_plant_t **parameters, int num_parameters)
int get_next_free_key(void)
next free "key" for the multitrack system
int rte_keymode_get_filter_idx(int key, int mode)
returns filter_class index of key/mode (or -1 if no filter bound)
boolean weed_playback_gen_start(void)
weed_plant_t * get_weed_filter(int filter_idx)
weed_plant_t * weed_apply_effects(weed_plant_t **layers, weed_plant_t *filter_map, ticks_t tc, int opwidth, int opheight, void ***pchains)
boolean write_filter_defaults(int fd, int idx)
@ FILTER_ERROR_IS_SCRAP_FILE
weed_plant_t * weed_instance_from_filter(weed_plant_t *filter)
lives_filter_error_t run_process_func(weed_plant_t *instance, weed_timecode_t tc, int key)
int weed_get_blend_factor(int hotkey)
char * weed_filter_idx_get_package_name(int filter_idx) WARN_UNUSED
void apply_key_defaults(weed_plant_t *inst, int key, int mode)
char * rte_keymode_get_filter_name(int key, int mode, boolean add_notes) WARN_UNUSED
returns name of filter_class bound to key/mode (or "")
weed_plant_t * get_enabled_channel(weed_plant_t *inst, int which, boolean is_in)
for FILTER_INST
boolean rte_keymode_valid(int key, int mode, boolean is_userkey)
returns TRUE if a filter_class is bound to key/mode, is_userkey should be set to TRUE
boolean interpolate_params(weed_plant_t *inst, void **pchains, ticks_t tc)
weed_plant_t * weed_inst_in_param(weed_plant_t *inst, int param_num, boolean skip_hidden, boolean skip_internal)
boolean is_hidden_param(weed_plant_t *, int i)
returns the permanent (structural) state c.f check_hidden_gui() which sets flag values for params lin...
@ FILTER_ERROR_INVALID_INSTANCE
int rte_get_numfilters(void)
int _wood_instance_ref(weed_plant_t *inst)
void restore_weed_instances(void)
lives_af_t
audio filter type (any, analyser only, non analyser only)
int weed_flagset_array_count(weed_plant_t **array, boolean set_readonly)
int weed_add_effectkey_by_idx(int key, int idx)
see description
@ FILTER_ERROR_MISSING_CHANNEL
boolean has_non_alpha_palette(weed_plant_t *ctmpl, weed_plant_t *filter)
int filter_mutex_unlock(int key)
weed_plant_t * get_enabled_audio_channel(weed_plant_t *inst, int which, boolean is_in)
for FILTER_INST
int get_master_vol_param(weed_plant_t *filter, boolean skip_internal)
weed_error_t weed_plant_free_host(weed_plant_t *plant)
void weed_set_blend_factor(int hotkey)
weed_plant_t * weed_instance_get_filter(weed_plant_t *inst, boolean get_compound_parent)
weed_plant_t * get_mandatory_channel(weed_plant_t *filter, int which, boolean is_in)
for FILTER_CLASS
weed_plant_t * get_new_inst_for_keymode(int key, int mode)
get new refcounted inst (during recording playback)
boolean has_video_chans_out(weed_plant_t *filter, boolean count_opt)
boolean has_usable_palette(weed_plant_t *chantmpl)
weed_plant_t * weed_instance_obtain(int key, int mode)
weed_error_t weed_leaf_set_host(weed_plant_t *plant, const char *key, uint32_t seed_type, weed_size_t num_elems, void *value)
int num_out_params(weed_plant_t *)
int rte_bg_gen_key(void) GNU_PURE
boolean has_audio_chans_out(weed_plant_t *filter, boolean count_opt)
@ FILTER_ERROR_BLANK_FRAME
boolean read_key_defaults(int fd, int nparams, int key, int mode, int version)
weed_plant_t * rte_keymode_get_instance(int key, int mode)
returns refcounted filter_instance bound to key/mode (or NULL)
int best_palette_match(int *palete_list, int num_palettes, int palette)
check palette vs.
int filter_mutex_lock(int key)
int rte_fg_gen_key(void) GNU_PURE
int rte_key_getmode(int key)
returns current active mode for a key (or -1)
int rte_switch_keymode(int key, int mode, const char *hashname)
lives_filter_error_t
filter apply errors
boolean read_generator_sizes(int fd)
int _weed_instance_ref(weed_plant_t *inst)
@ FILTER_ERROR_INVALID_PALETTE_CONVERSION
@ FILTER_ERROR_MISSING_LAYER
@ FILTER_ERROR_COULD_NOT_REINIT
int weed_get_idx_for_hashname(const char *hashname, boolean fullname) GNU_CONST
fullname includes author and version
_palette * palette
interface colour settings
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
@ FILTER_ERROR_TEMPLATE_MISMATCH
void deinit_easing_effects(void)
switch off effects in easing out state after playback ends during playback, some effects don't deinit...
char * rte_keymode_get_plugin_name(int key, int mode) WARN_UNUSED
returns name of plugin package containing filter_class (or "")
int num_alpha_channels(weed_plant_t *filter, boolean out)
boolean has_alpha_palette(weed_plant_t *ctmpl, weed_plant_t *filter)
lives_fx_cat_t weed_filter_subcategorise(weed_plant_t *pl, lives_fx_cat_t category, boolean count_opt)
boolean is_audio_channel_in(weed_plant_t *inst, int chnum)
weed_plant_t weed_layer_t
int rte_bg_gen_mode(void) GNU_PURE
int weed_filter_highest_version(const char *pkg, const char *fxname, const char *auth, int *return_version)
int weed_get_sorted_filter(int i)
char * make_weed_hashname(int filter_idx, boolean fullname, boolean use_extra_authors, char sep, boolean spc_to_underscore) WARN_UNUSED
fullname includes author and version
void weed_reinit_all(void)
lives_fx_cat_t weed_filter_categorise(weed_plant_t *pl, int in_channels, int out_channels)
boolean is_audio_channel_out(weed_plant_t *inst, int chnum)
boolean weed_deinit_effect(int hotkey)
hotkey starts at 1
weed_plant_t * weed_plant_new_host(int type)
weed_plant_t ** weed_params_create(weed_plant_t *filter, boolean in)
void wge_inner(weed_plant_t *inst)
deinit and instance(s) for generator, reset instance mapping
int * weed_get_indices_from_template(const char *package_name, const char *filter_name, const char *author, int version)
generate a list of filter indices from a given template.
void update_all_host_info(void)
void weed_unload_all(void)
unload all effects
void show_weed_stats(weed_plant_t *statsplant)
size_t weed_plant_serialise(int fd, weed_plant_t *plant, unsigned char **mem)
void weed_functions_init(void)
call weed_init() to set our weed core functions
boolean weed_init_effect(int hotkey)
hotkey starts at 1
boolean has_key_defaults(void)
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.
void weed_deinit_all(boolean shutdown)
deinit all active effects
@ FILTER_ERROR_NEEDS_REINIT
@ FILTER_ERROR_MISSING_FRAME
weed_error_t weed_leaf_delete_host(weed_plant_t *plant, const char *key)
void weed_load_all(void)
load effects
weed_plant_t * weed_filter_out_paramtmpl(weed_plant_t *filter, int param_num)
@ FILTER_ERROR_MEMORY_ERROR
@ FILTER_ERROR_INTERPOLATION_FAILED
int set_copy_to(weed_plant_t *inst, int pnum, lives_rfx_t *rfx, boolean update)
@ FILTER_ERROR_INVALID_FILTER
int count_simple_params(weed_plant_t *)
void weed_bg_generator_end(weed_plant_t *inst)
boolean write_generator_sizes(int fd, int idx)
int rte_key_getmaxmode(int key)
returns highest mode which is set
weed_plant_t * weed_layer_create_from_generator(weed_plant_t *inst, ticks_t tc, int clipno)
int weed_generator_start(weed_plant_t *inst, int key)
int get_transition_param(weed_plant_t *filter, boolean skip_internal)
@ FILTER_ERROR_COPYING_FAILED
int num_in_params(weed_plant_t *, boolean skip_hidden, boolean skip_internal)
char * weed_instance_get_filter_name(weed_plant_t *inst, boolean get_compound_parent) WARN_UNUSED
void add_param_connections(weed_plant_t *inst)
int weed_add_effectkey(int key, const char *hashname, boolean fullname)
bind a filter_class to key/mode using its hashname
int _weed_instance_unref(weed_plant_t *inst)
boolean rte_key_valid(int key, boolean is_userkey)
returns TRUE if there is a filter bound to active mode of hotkey
boolean interpolate_param(weed_plant_t *param, void *pchain, ticks_t tc)
parameter interpolation
@ FILTER_ERROR_NO_IN_CHANNELS
void backup_weed_instances(void)
for multitrack
int filter_mutex_trylock(int key)
void set_key_defaults(weed_plant_t *inst, int key, int mode)
boolean has_video_chans_in(weed_plant_t *filter, boolean count_opt)
char * cd_to_plugin_dir(weed_plant_t *filter)
change directory to plugin installation dir so it can find any data files
weed_plant_t * rte_keymode_get_filter(int key, int mode)
returns filter_class bound to key/mode (or NULL)
boolean is_pure_audio(weed_plant_t *filter_or_instance, boolean count_opt)
TRUE if audio in or out and no vid in/out.
int enabled_out_channels(weed_plant_t *plant, boolean count_repeats)
void weed_in_parameters_free(weed_plant_t *inst)
weed_plant_t * get_textparm()
for rte textmode, get first string parameter for current key/mode instance we will then forward all k...
boolean has_video_filters(boolean analysers_only)
void rec_param_change(weed_plant_t *inst, int pnum)
record a parameter value change in our event_list
void write_key_defaults(int fd, int key, int mode)
@ FILTER_INFO_REINITED
values >= 512 are info
void weed_apply_audio_effects(weed_plant_t *filter_map, weed_layer_t **, int nbtracks, int nchans, int64_t nsamps, double arate, ticks_t tc, double *vis)
@ FILTER_ERROR_INVALID_INIT_EVENT
weed_plant_t * weed_inst_out_param(weed_plant_t *inst, int param_num)
weed_plant_t * host_info_cb(weed_plant_t *xhost_info, void *data)
void weed_generator_end(weed_plant_t *inst)
lives_filter_error_t weed_reinit_effect(weed_plant_t *inst, boolean reinit_compound)
@ FILTER_ERROR_UNABLE_TO_RESIZE
char * rte_keymode_get_type(int key, int mode) WARN_UNUSED
returns a string filter/instance type (or "")
int _wood_instance_unref(weed_plant_t *inst)