libweed 2.0.0
weed-effects.h
Go to the documentation of this file.
1/* WEED is free software; you can redistribute it and/or
2 modify it under the terms of the GNU Lesser General Public
3 License as published by the Free Software Foundation; either
4 version 3 of the License, or (at your option) any later version.
5
6 Weed is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 Lesser General Public License for more details.
10
11 You should have received a copy of the GNU Lesser General Public
12 License along with this source code; if not, write to the Free Software
13 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
14
15 Weed is developed by:
16 Gabriel "Salsaman" Finch - http://lives-video.com
17
18 partly based on LiViDO, which is developed by:
19 Niels Elburg - http://veejay.sf.net
20 Denis "Jaromil" Rojo - http://freej.dyne.org
21 Tom Schouten - http://zwizwa.fartit.com
22 Andraz Tori - http://cvs.cinelerra.org
23
24 reviewed with suggestions and contributions from:
25 Silvano "Kysucix" Galliani - http://freej.dyne.org
26 Kentaro Fukuchi - http://megaui.net/fukuchi
27 Jun Iio - http://www.malib.net
28 Carlo Prelz - http://www2.fluido.as:8080/
29*/
30
31/* (C) G. Finch, 2005 - 2019 */
32
33#ifndef __WEED_EFFECTS_H__
34#define __WEED_EFFECTS_H__
35
36#ifdef __cplusplus
37extern "C"
38{
39#endif /* __cplusplus */
40
41#include <inttypes.h>
42
43/* API version * 200 */
44#define WEED_FILTER_API_VERSION 200
45#define WEED_FILTER_API_VERSION 200
46
47/* plant types */
48#define WEED_PLANT_PLUGIN_INFO 1
49#define WEED_PLANT_FILTER_CLASS 2
50#define WEED_PLANT_FILTER_INSTANCE 3
51#define WEED_PLANT_CHANNEL_TEMPLATE 4
52#define WEED_PLANT_PARAMETER_TEMPLATE 5
53#define WEED_PLANT_CHANNEL 6
54#define WEED_PLANT_PARAMETER 7
55#define WEED_PLANT_GUI 8
56#define WEED_PLANT_HOST_INFO 9
57
58/* Parameter types */
59#define WEED_PARAM_UNSPECIFIED 0
60#define WEED_PARAM_INTEGER 1
61#define WEED_PARAM_FLOAT 2
62#define WEED_PARAM_TEXT 3
63#define WEED_PARAM_SWITCH 4
64#define WEED_PARAM_COLOR 5
65
66typedef struct {
67 int32_t red, green, blue;
69
70typedef struct {
71 int32_t red, green, blue, alpha;
73
74typedef struct {
75 double red, green, blue;
77
78typedef struct {
79 double red, green, blue, alpha;
81
82/* Colorspaces for Color parameters */
83#define WEED_COLORSPACE_RGB 1
84#define WEED_COLORSPACE_RGBA 2
85
86/* host_info flags */
87/* API version 200 */
88#define WEED_HOST_SUPPORTS_LINEAR_GAMMA (1 << 0)
89#define WEED_HOST_SUPPORTS_PREMULTIPLIED_ALPHA (1 << 1)
90
91/* Filter flags */
92#define WEED_FILTER_NON_REALTIME (1 << 0)
93#define WEED_FILTER_IS_CONVERTER (1 << 1)
94#define WEED_FILTER_HINT_STATELESS (1 << 2)
95#define WEED_FILTER_PREF_LINEAR_GAMMA (1 << 3)
96#define WEED_FILTER_PREF_PREMULTIPLIED_ALPHA (1 << 4)
97#define WEED_FILTER_HINT_PROCESS_LAST (1 << 5)
98#define WEED_FILTER_HINT_MAY_THREAD (1 << 6)
99#define WEED_FILTER_HINT_MAYBE_UNSTABLE (1 << 7)
100#define WEED_FILTER_CHANNEL_SIZES_MAY_VARY (1 << 8)
101#define WEED_FILTER_PALETTES_MAY_VARY (1 << 9)
102
103/* audio */
104#define WEED_FILTER_CHANNEL_LAYOUTS_MAY_VARY (1 << 15)
105#define WEED_FILTER_AUDIO_RATES_MAY_VARY (1 << 16)
106
107/* Channel template flags */
108#define WEED_CHANNEL_REINIT_ON_SIZE_CHANGE (1 << 0)
109#define WEED_CHANNEL_REINIT_ON_PALETTE_CHANGE (1 << 1)
110#define WEED_CHANNEL_REINIT_ON_ROWSTRIDES_CHANGE (1 << 2)
111#define WEED_CHANNEL_OPTIONAL (1 << 3)
112#define WEED_CHANNEL_CAN_DO_INPLACE (1 << 4)
113#define WEED_CHANNEL_NEEDS_NATURAL_SIZE (1 << 5)
114
115/* audio */
116#define WEED_CHANNEL_REINIT_ON_RATE_CHANGE WEED_CHANNEL_REINIT_ON_SIZE_CHANGE
117#define WEED_CHANNEL_REINIT_ON_LAYOUT_CHANGE WEED_CHANNEL_REINIT_ON_PALETTE_CHANGE
118
119/* Parameter template flags */
120#define WEED_PARAMETER_REINIT_ON_VALUE_CHANGE (1 << 0)
121#define WEED_PARAMETER_VARIABLE_SIZE (1 << 1)
122#define WEED_PARAMETER_VALUE_PER_CHANNEL (1 << 2)
123#define WEED_PARAMETER_VALUE_IRRELEVANT (1 << 3)
124
125/* Parameter template GUI flags */
126#define WEED_GUI_REINIT_ON_VALUE_CHANGE (1 << 0)
127#define WEED_GUI_CHOICES_SET_ON_INIT (1 << 1)
128
129/* filter instance flags */
130#define WEED_INSTANCE_UPDATE_GUI_ONLY (1 << 0)
131
132/* error codes (in addidion to WEED_SUCCESS and WEED_ERROR_MEMORY_ALLOCATION) */
133#define WEED_ERROR_PLUGIN_INVALID 64
134#define WEED_ERROR_FILTER_INVALID 65
135#define WEED_ERROR_TOO_MANY_INSTANCES 66
136#define WEED_ERROR_REINIT_NEEDED 67
137#define WEED_ERROR_NOT_READY 68
138
139#define WEED_VERBOSITY_SILENT -2
140#define WEED_VERBOSITY_CRITICAL -1
141#define WEED_VERBOSITY_ERROR 0
142#define WEED_VERBOSITY_WARN 1
143#define WEED_VERBOSITY_INFO 2
144#define WEED_VERBOSITY_DEBUG 3
145
146typedef int64_t weed_timecode_t;
147
148// allows the plugin to get the plugin_info before weed_leaf_get() is defined
149typedef weed_error_t (*weed_default_getter_f)(weed_plant_t *plant, const char *key, void *value);
150
151/* host bootstrap function */
152typedef weed_plant_t *(*weed_bootstrap_f)(weed_default_getter_f *,
153 int32_t plugin_weed_min_api_version,
154 int32_t plugin_weed_max_api_version,
155 int32_t plugin_filter_min_api_version,
156 int32_t plugin_filter_max_api_version);
157
158/* mandatory plugin functions */
159typedef weed_plant_t *(*weed_setup_f)(weed_bootstrap_f weed_boot);
160
161/* optional plugin functions */
162typedef void (*weed_desetup_f)(void);
163typedef weed_error_t (*weed_process_f)(weed_plant_t *filter_instance, weed_timecode_t timestamp);
164typedef weed_error_t (*weed_init_f)(weed_plant_t *filter_instance);
165typedef weed_error_t (*weed_deinit_f)(weed_plant_t *filter_instance);
166
167/* special plugin functions */
168typedef void (*weed_display_f)(weed_plant_t *parameter); // deprecated
169typedef weed_error_t (*weed_interpolate_f)(weed_plant_t **in_values, weed_plant_t *out_value);
170
171// PLUGIN_INFO
172// mandatory:
173#define WEED_LEAF_FILTERS "filters"
174#define WEED_LEAF_HOST_INFO "host_info"
175#define WEED_LEAF_VERSION "version"
176
177// optional
178#define WEED_LEAF_PACKAGE_NAME "package_name"
179#define WEED_LEAF_MAINTAINER "maintainer"
180#define WEED_LEAF_URL "url"
181#define WEED_LEAF_DESCRIPTION "description"
182#define WEED_LEAF_ERROR_NUMBER "error_number"
183#define WEED_LEAF_ERROR_TEXT "error_text"
184
185// HOST_INFO
186// mandatory:
187#define WEED_LEAF_FILTER_API_VERSION "filter_api_version"
188#define WEED_LEAF_GET_FUNC "weed_leaf_get_func"
189#define WEED_LEAF_SET_FUNC "weed_leaf_set_func"
190#define WEED_LEAF_DELETE_FUNC "weed_leaf_delete_func"
191#define WEED_PLANT_NEW_FUNC "weed_plant_new_func"
192#define WEED_PLANT_FREE_FUNC "weed_plant_free_func"
193#define WEED_PLANT_LIST_LEAVES_FUNC "weed_plant_list_leaves_func"
194#define WEED_LEAF_NUM_ELEMENTS_FUNC "weed_leaf_num_elements_func"
195#define WEED_LEAF_ELEMENT_SIZE_FUNC "weed_leaf_element_size_func"
196#define WEED_LEAF_SEED_TYPE_FUNC "weed_leaf_seed_type_func"
197#define WEED_LEAF_GET_FLAGS_FUNC "weed_leaf_get_flags_func"
198#define WEED_LEAF_MALLOC_FUNC "weed_malloc_func"
199#define WEED_LEAF_FREE_FUNC "weed_free_func"
200#define WEED_LEAF_MEMSET_FUNC "weed_memset_func"
201#define WEED_LEAF_MEMCPY_FUNC "weed_memcpy_func"
202#define WEED_LEAF_MEMMOVE_FUNC "weed_memmove_func"
203#define WEED_LEAF_CALLOC_FUNC "weed_calloc_func"
204#define WEED_LEAF_REALLOC_FUNC "weed_realloc_func"
205
206// optional //
207#define WEED_LEAF_HOST_NAME "host_name"
208#define WEED_LEAF_HOST_VERSION "host_version"
209#define WEED_LEAF_FLAGS "flags"
210#define WEED_LEAF_VERBOSITY "verbosity"
211#define WEED_LEAF_LAYOUT_SCHEMES "layout_schemes"
212#define WEED_LEAF_PLUGIN_INFO "plugin_info"
213
214// FILTER_CLASS
215// mandatory
216#define WEED_LEAF_NAME "name"
217#define WEED_LEAF_AUTHOR "author"
218/* also WEED_LEAF_VERSION */
219
220/* mandatory for filters with video, unless overridden in channel templates */
221#define WEED_LEAF_PALETTE_LIST "palette_list"
222
223// optional
224#define WEED_LEAF_INIT_FUNC "init_func"
225#define WEED_LEAF_DEINIT_FUNC "deinit_func"
226#define WEED_LEAF_PROCESS_FUNC "process_func"
227#define WEED_LEAF_IN_PARAMETER_TEMPLATES "in_param_tmpls"
228#define WEED_LEAF_OUT_PARAMETER_TEMPLATES "out_param_tmpls"
229#define WEED_LEAF_IN_CHANNEL_TEMPLATES "in_chan_tmpls"
230#define WEED_LEAF_OUT_CHANNEL_TEMPLATES "out_chan_tmpls"
231#define WEED_LEAF_GUI "gui"
232#define WEED_LEAF_EXTRA_AUTHORS "extra_authors"
233#define WEED_LEAF_MICRO_VERSION "micro_version"
234#define WEED_LEAF_ICON "icon"
235#define WEED_LEAF_LICENSE "license"
236#define WEED_LEAF_COPYRIGHT "copyright"
237
238/* optional for filters with video channels */
239#define WEED_LEAF_PREFERRED_FPS "target_fps"
240#define WEED_LEAF_HSTEP "hstep"
241#define WEED_LEAF_VSTEP "vstep"
242#define WEED_LEAF_ALIGNMENT_HINT "alignment_hint"
243
244/* optional for filters with video channels (may be overriden in channel templates depending on filter_class flags) */
245#define WEED_LEAF_WIDTH "width"
246#define WEED_LEAF_HEIGHT "height"
247#define WEED_LEAF_MAXWIDTH "maxwidth"
248#define WEED_LEAF_MAXHEIGHT "maxheight"
249#define WEED_LEAF_MINWIDTH "minwidth"
250#define WEED_LEAF_MINHEIGHT "minheight"
251#define WEED_LEAF_YUV_CLAMPING "YUV_clamping"
252#define WEED_LEAF_YUV_SAMPLING "YUV_sampling"
253#define WEED_LEAF_YUV_SUBSPACE "YUV_subspace"
254#define WEED_LEAF_NATURAL_SIZE "natural_size"
255#define WEED_LEAF_INNER_SIZE "inner_size"
256
258/* optional for filters with audio channels (maybe overriden in channel templates depending on filter_class flags) */
259#define WEED_LEAF_AUDIO_RATE "audio_rate"
260#define WEED_LEAF_MAX_AUDIO_CHANNELS "max_audio_chans"
261#define WEED_LEAF_MIN_AUDIO_LENGTH "min_audio_len"
262#define WEED_LEAF_MAX_AUDIO_LENGTH "max_audio_len"
263#define WEED_LEAF_CHANNEL_LAYOUTS "channel_layouts"
264
265/* audio channel layouts (default settings) */
266#ifndef WEED_CHANNEL_LAYOUT_TYPE
267#define WEED_CHANNEL_LAYOUT_TYPE "default"
268#define WEED_CH_FRONT_LEFT 0x00000001
269#define WEED_CH_FRONT_RIGHT 0x00000002
270#define WEED_CH_FRONT_CENTER 0x00000004
271#define WEED_CH_LAYOUT_MONO (WEED_CH_FRONT_CENTER)
272#define WEED_CH_LAYOUT_STEREO (WEED_CH_FRONT_LEFT | WEED_CH_FRONT_RIGHT)
273#define WEED_CH_LAYOUT_DEFAULT_1 WEED_CH_LAYOUT_MONO
274#define WEED_CH_LAYOUT_DEFAULT_2 WEED_CH_LAYOUT_STEREO
275#define WEED_CH_LAYOUTS_DEFAULT (WEED_CH_LAYOUT_DEFAULT_2, WEED_CH_LAYOUT_DEFAULT_1}
276#define WEED_CH_LAYOUTS_DEFAULT_MIN2 (WEED_CH_LAYOUT_DEFAULT_2}
277#endif
278
279// FILTER_CLASS GUI
280#define WEED_LEAF_LAYOUT_SCHEME "layout_scheme"
281
282
283// FILTER_INSTANCE
284// mandatory
285#define WEED_LEAF_FILTER_CLASS "filter_class"
286#define WEED_LEAF_IN_PARAMETERS "in_parameters"
287#define WEED_LEAF_OUT_PARAMETERS "out_parameters"
288#define WEED_LEAF_IN_CHANNELS "in_channels"
289#define WEED_LEAF_OUT_CHANNELS "out_channels"
290 // optional
291#define WEED_LEAF_FPS "fps"
292#define WEED_LEAF_TARGET_FPS "target_fps"
293
294// instance GUI leaves
295#define WEED_LEAF_EASE_IN_FRAMES "ease_in_frames" // set by filter in init_func()
296#define WEED_LEAF_EASE_OUT_FRAMES "ease_out_frames" // set by filter in process_func()
297
298#define WEED_LEAF_EASE_IN "ease_in" // host request, set prior to first process_func() call
299#define WEED_LEAF_EASE_OUT "ease_out" // host request, set prior to andy process_func() call
300
301
302// CHANNEL_TEMPLATE
303// mandatory
305
306// mandatory for audio
307#define WEED_LEAF_IS_AUDIO "is_audio"
308
309//optional
312#define WEED_LEAF_MAX_REPEATS "max_repeats"
314
315
316// CHANNEL
317// mandatory
318#define WEED_LEAF_TEMPLATE "template"
320
321/* mandatory for VIDEO */
324#define WEED_LEAF_PIXEL_DATA "pixel_data"
325#define WEED_LEAF_CURRENT_PALETTE "current_palette"
326#define WEED_LEAF_ROWSTRIDES "rowstrides"
327
328// mandatory for AUDIO
329#define WEED_LEAF_AUDIO_DATA "audio_data"
330#define WEED_LEAF_AUDIO_DATA_LENGTH "audio_data_len"
331#define WEED_LEAF_AUDIO_RATE "audio_rate"
332#define WEED_LEAF_AUDIO_CHANNELS "audio_channels"
333//#define WEED_LEAF_AUDIO_CHANNEL_LAYOUT "channel_layout" /// ONLY if set in filter_class or channel_template
334
335// optional
336#define WEED_LEAF_OFFSET "offset"
337#define WEED_LEAF_DISABLED "disabled"
338
343#define WEED_LEAF_PIXEL_ASPECT_RATIO "par"
344#define WEED_LEAF_GAMMA_TYPE "gamma_type"
345#define WEED_LEAF_ALPHA_PREMULTIPLIED "alpha_premult"
346
347
348// PARAM_TEMPLATE
349// mandatory
351#define WEED_LEAF_DEFAULT "default"
352#define WEED_LEAF_MIN "min"
353#define WEED_LEAF_MAX "max"
354#define WEED_LEAF_PARAM_TYPE "param_type"
355
356//optional
360#define WEED_LEAF_NEW_DEFAULT "new_default"
361#define WEED_LEAF_GROUP "group"
362#define WEED_LEAF_COLORSPACE "colorspace"
363#define WEED_LEAF_IS_TRANSITION "is_transition"
364#define WEED_LEAF_IS_VOLUME_MASTER "is_vol_master"
365
366// PARAM_TEMPLATE GUI
367#define WEED_LEAF_WRAP "wrap"
368#define WEED_LEAF_MAXCHARS "maxchars"
369#define WEED_LEAF_LABEL "label"
370#define WEED_LEAF_DECIMALS "decimals"
371#define WEED_LEAF_STEP_SIZE "step_size"
372#define WEED_LEAF_USE_MNEMONIC "use_mnemonic"
373#define WEED_LEAF_CHOICES "choices"
374#define WEED_LEAF_CHOICES_LANGUAGES "choices_langs"
375#define WEED_LEAF_HIDDEN "hidden"
376#define WEED_LEAF_COPY_VALUE_TO "copy_value_to"
377
378// PARAM
379// mandatory
380#define WEED_LEAF_VALUE "value"
381
382// PARAM_GUI
383#define WEED_LEAF_CHOICES_LANGUAGE "choices_lang"
384
385#ifdef __cplusplus
386}
387#endif /* __cplusplus */
388
389#endif // #ifndef __WEED_EFFECTS_H__
Definition: weed-effects.h:74
double blue
Definition: weed-effects.h:75
Definition: weed-effects.h:66
int32_t blue
Definition: weed-effects.h:67
Definition: weed-effects.h:78
double alpha
Definition: weed-effects.h:79
Definition: weed-effects.h:70
int32_t alpha
Definition: weed-effects.h:71
void(* weed_display_f)(weed_plant_t *parameter)
Definition: weed-effects.h:168
int64_t weed_timecode_t
Definition: weed-effects.h:146
weed_error_t(* weed_process_f)(weed_plant_t *filter_instance, weed_timecode_t timestamp)
Definition: weed-effects.h:163
void(* weed_desetup_f)(void)
Definition: weed-effects.h:162
weed_error_t(* weed_init_f)(weed_plant_t *filter_instance)
Definition: weed-effects.h:164
weed_error_t(* weed_deinit_f)(weed_plant_t *filter_instance)
Definition: weed-effects.h:165
weed_plant_t *(* weed_bootstrap_f)(weed_default_getter_f *, int32_t plugin_weed_min_api_version, int32_t plugin_weed_max_api_version, int32_t plugin_filter_min_api_version, int32_t plugin_filter_max_api_version)
Definition: weed-effects.h:152
weed_error_t(* weed_interpolate_f)(weed_plant_t **in_values, weed_plant_t *out_value)
Definition: weed-effects.h:169
weed_error_t(* weed_default_getter_f)(weed_plant_t *plant, const char *key, void *value)
Definition: weed-effects.h:149
int32_t weed_error_t
Definition: weed.h:70
weed_leaf_t weed_plant_t
Definition: weed.h:125