LiVES  2.0.3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
plugins.h
Go to the documentation of this file.
1 // plugins.h
2 // LiVES
3 // (c) G. Finch 2003-2012 <salsaman@gmail.com>
4 // released under the GNU GPL 3 or later
5 // see file ../COPYING or www.gnu.org for licensing details
6 
7 #ifndef HAS_LIVES_PLUGINS_H
8 #define HAS_LIVES_PLUGINS_H
9 
10 #include <gmodule.h>
11 #include <unistd.h>
12 #include <string.h>
13 #include <fcntl.h>
14 #include <stdlib.h>
15 
16 
17 // generic plugins
18 
19 GList *get_plugin_list (const gchar *plugin_type, boolean allow_nonex, const gchar *plugdir, const gchar *filter_ext);
20 #define PLUGIN_ENCODERS "encoders"
21 #define PLUGIN_DECODERS "decoders"
22 #define PLUGIN_VID_PLAYBACK "playback/video"
23 #define PLUGIN_AUDIO_STREAM "playback/audiostream"
24 
26 #define PLUGIN_THEMES "themes"
27 
29 #define PLUGIN_EFFECTS_WEED "weed"
30 #define PLUGIN_WEED_FX_BUILTIN "effects/realtime/weed"
31 
32 
33 GList *plugin_request (const gchar *plugin_type, const gchar *plugin_name, const gchar *request);
34 GList *plugin_request_with_blanks (const gchar *plugin_type, const gchar *plugin_name, const gchar *request);
35 GList *plugin_request_by_line (const gchar *plugin_type, const gchar *plugin_name, const gchar *request);
36 GList *plugin_request_by_space (const gchar *plugin_type, const gchar *plugin_name, const gchar *request);
37 GList *plugin_request_common (const gchar *plugin_type, const gchar *plugin_name, const gchar *request, const gchar *delim, boolean allow_blanks);
38 
39 #ifndef __WEED_EFFECTS_H__
40 typedef weed_plant_t *(*weed_bootstrap_f) (weed_default_getter_f *value, int num_versions, int *plugin_versions);
41 #endif
42 
44 typedef boolean (*plugin_keyfunc) (boolean down, guint16 unicode, guint16 keymod);
45 
46 
47 typedef struct {
48  // playback
49  gchar name[64];
50  void *handle;
51 
52  // mandatory
53  const char *(*module_check_init)(void);
54  const char *(*version) (void);
55  const char *(*get_description) (void);
56 
57  gint *(*get_palette_list) (void);
59  guint64 (*get_capabilities) (int palette);
60 
61  boolean (*render_frame) (int hsize, int vsize, int64_t timecode, void **pixel_data, void **return_data,
62  weed_plant_t **play_params);
63 
64  // optional
65  boolean (*init_screen) (int width, int height, boolean fullscreen, uint64_t window_id, int argc, gchar **argv);
66  void (*exit_screen) (guint16 mouse_x, guint16 mouse_y);
67  void (*module_unload) (void);
68  const gchar *(*get_fps_list) (int palette);
69  boolean (*set_fps) (gdouble fps);
70 
71  const char *(*get_init_rfx) (void);
72 
74  const weed_plant_t **(*get_play_params) (weed_bootstrap_f f);
75 
76  // only for display plugins
78 
79  // optional for YUV palettes
80  int *(*get_yuv_palette_sampling) (int palette);
81  int *(*get_yuv_palette_clamping) (int palette);
82  int *(*get_yuv_palette_subspace) (int palette);
86 
87  // audio streaming
88  int *(*get_audio_fmts)(void);
89 
90  guint32 audio_codec;
91  // must match with the "acodec" GList in interface.c
92  // and bitmaps in the encder plugins, with this one addition:
93 
94  guint64 capabilities;
95 
96 #define VPP_CAN_RESIZE 1<<0
97 #define VPP_CAN_RETURN 1<<1
98 #define VPP_LOCAL_DISPLAY 1<<2
99 
100  gint fwidth,fheight;
101 
102  int palette;
106 
109  gdouble fixed_fpsd;
110 
112  gchar **extra_argv;
113 
114  const weed_plant_t **play_paramtmpls;
115  weed_plant_t **play_params;
116  weed_plant_t **alpha_chans;
119 
121 
122 
123 #define DEF_VPP_HSIZE 320.
124 #define DEF_VPP_VSIZE 240.
125 
126 _vid_playback_plugin *open_vid_playback_plugin (const gchar *name, boolean in_use);
127 void vid_playback_plugin_exit (void);
132 
133 
134 const weed_plant_t *pp_get_param(weed_plant_t **pparams, int idx);
135 const weed_plant_t *pp_get_chan(weed_plant_t **pparams, int idx);
136 
137 // encoder plugins
138 
139 void do_plugin_encoder_error(const gchar *plugin_name_or_null);
140 
141 GList *filter_encoders_by_img_ext(GList *encoders, const gchar *img_ext);
142 
143 typedef struct {
144  gchar name[51];
145  guint32 audio_codec;
146  // match with bitmaps in the encoder plugins
147  // and also anames array in plugins.c (see below)
148 
149 #define AUDIO_CODEC_MP3 0
150 #define AUDIO_CODEC_PCM 1
151 #define AUDIO_CODEC_MP2 2
152 #define AUDIO_CODEC_VORBIS 3
153 #define AUDIO_CODEC_AC3 4
154 #define AUDIO_CODEC_AAC 5
155 #define AUDIO_CODEC_AMR_NB 6
156 #define AUDIO_CODEC_RAW 7 // reserved
157 #define AUDIO_CODEC_WMA2 8
158 
159 
160 #define AUDIO_CODEC_MAX 31
161  //
162 #define AUDIO_CODEC_NONE 32
163 #define AUDIO_CODEC_UNKNOWN 33
164 
166 
167 
168 #define HAS_RFX 1<<0
169 
170 #define CAN_ENCODE_PNG 1<<2
171 #define ENCODER_NON_NATIVE 1<<3
172 
173  // current output format
174  gchar of_name[51];
175  gchar of_desc[128];
177  gchar of_restrict[1024];
178  gchar of_def_ext[16];
179 }
180 _encoder;
181 
182 
183 // defined in plugins.c for the whole app
184 extern const char *anames[AUDIO_CODEC_MAX];
185 
186 
187 // decoder plugins
188 
189 // seek_flags is a bitmap
190 
192 #define LIVES_SEEK_FAST (1<<0)
193 
195 #define LIVES_SEEK_NEEDS_CALCULATION (1<<1)
196 #define LIVES_SEEK_QUALITY_LOSS (1<<2)
197 
198 
199 // must be exactly the same as in decplugin.h
200 
201 typedef struct {
202  gchar *URI;
203 
204  gint nclips;
205  gchar container_name[512];
206 
209 
210  // video data
211  gint width; // width and height of picture in frame
212  gint height;
213  gint64 nframes;
215 
218  gint offs_x;
219  gint offs_y;
220  gint frame_width; // frame width and height are the size of the outer frame
222 
223  float par;
224 
225  float fps;
226 
227  int *palettes;
228 
231 
235  gchar video_name[512];
236 
237  /* audio data */
238  gint arate;
239  gint achans;
240  gint asamps;
241  boolean asigned;
242  boolean ainterleaf;
243  gchar audio_name[512];
244 
246 
247 #define SYNC_HINT_AUDIO_TRIM_START 1
248 
250 
251 
252  void *priv;
253 
255 
256 
257 
258 typedef struct {
259  // playback
260  gchar *name;
261  void *handle;
262 
263  // mandatory
264  const char *(*version) (void);
265 
272  lives_clip_data_t *(*get_clip_data)(char *URI, lives_clip_data_t *cdata);
273 
275  boolean (*get_frame)(const lives_clip_data_t *, int64_t frame, int *rowstrides, int height, void **pixel_data);
276 
279 
280  // optional
281  const char *(*module_check_init)(void);
282  int64_t (*rip_audio) (const lives_clip_data_t *, const char *fname, int64_t stframe, int64_t nframes,
283  unsigned char **abuff);
284  void (*rip_audio_cleanup) (const lives_clip_data_t *cdata);
285  void (*module_unload)(void);
286 
288 
289 
290 
291 
292 typedef struct {
296 
297 
298 
299 
300 
301 
302 const lives_clip_data_t *get_decoder_cdata(file *, GList *disabled);
304 lives_decoder_sys_t *open_decoder_plugin(const gchar *plname);
305 void get_mime_type(gchar *text, int maxlen, const lives_clip_data_t *);
306 void unload_decoder_plugins(void);
307 
308 boolean decplugin_supports_palette (const lives_decoder_t *dplug, int palette);
309 
310 
311 
312 // RFX plugins
313 
314 
316 #define PLUGIN_RENDERED_EFFECTS_BUILTIN "effects/rendered/"
317 
319 #define PLUGIN_RENDERED_EFFECTS_CUSTOM "plugins/effects/rendered/custom/"
320 #define PLUGIN_RENDERED_EFFECTS_TEST "plugins/effects/rendered/test/"
321 
323 #define PLUGIN_RENDERED_EFFECTS_BUILTIN_SCRIPTS "effects/RFXscripts/"
324 
326 #define PLUGIN_RENDERED_EFFECTS_CUSTOM_SCRIPTS "plugins/effects/RFXscripts/custom/"
327 #define PLUGIN_RENDERED_EFFECTS_TEST_SCRIPTS "plugins/effects/RFXscripts/test/"
328 
330 #define PLUGIN_RFX_SCRAP ""
331 
332 
334 #define MAX_PARAM_WIDGETS 5
335 
337 #define RFX_MAXSTRINGLEN 1024
338 
339 
340 typedef enum {
341 
349 
351 
353 
354 
355 typedef enum {
359 
360 
361 typedef enum {
362  LIVES_PARAM_SPECIAL_TYPE_NONE=0, // normal parameter type
363 
364  // framedraw types
369 
370  // text widget types
373 
374  // misc types
377 
379 
380 
381 typedef struct {
382  // weed style part
383  gchar *name;
384  gchar *desc;
385 
386  gchar *label;
387  gint flags;
388  boolean use_mnemonic;
391  gint hidden;
392 
393  // reason(s) for hiding [bitmap]
394 #define HIDDEN_GUI (1<<0)
395 #define HIDDEN_MULTI (1<<1)
396 #define HIDDEN_NEEDS_REINIT (1<<2)
397 #define HIDDEN_COMPOUND_INTERNAL (1<<3)
398 
399  gdouble step_size;
400  //gint copy_to;
401  boolean transition;
402  boolean reinit;
403 
404  boolean wrap;
405  gint group;
407 
408  gint dp;
409  void *value;
410 
411  gdouble min;
412  gdouble max;
413 
414  void *def;
415  GList *list;
416 
418  gshort multi;
419 #define PVAL_MULTI_NONE 0
420 #define PVAL_MULTI_ANY 1
421 #define PVAL_MULTI_PER_CHANNEL 2
422 
423  //--------------------------------------------------
424  // extras for LiVES
425 
427  GtkWidget *widgets[MAX_PARAM_WIDGETS];
428  boolean onchange;
429 
430  boolean changed;
431 
432  boolean change_blocked;
433 
434  void *source;
435 
437 
438  // this may change
439  lives_param_special_t special_type; // the visual modification type (see paramspecial.h)
440  int special_type_index; // index within special_type (e.g for DEMASK, 0==left, 1==top, 2==width, 3==height)
441 
442 } lives_param_t;
443 
444 
445 typedef enum {
452 
453  // these are only used when prompting for a name
457 
458 
459 
460 
461 typedef struct {
462  gchar *name;
463  gchar *menu_text;
464  gchar *action_desc;
465  gint min_frames;
468 
469 
470  guint32 props;
471 #define RFX_PROPS_SLOW 0x0001
472 #define RFX_PROPS_MAY_RESIZE 0x0002
473 #define RFX_PROPS_BATCHG 0x0004
474 
475 
476 #define RFX_PROPS_RESERVED1 0x1000
477 #define RFX_PROPS_RESERVED2 0x2000
478 #define RFX_PROPS_RESERVED3 0x4000
479 #define RFX_PROPS_AUTO_BUILT 0x8000
480 
481  GtkWidget *menuitem;
485  void *source;
486  void *extra;
487  gchar delim[2];
488  boolean is_template;
489 
490 } lives_rfx_t;
491 
492 
493 boolean check_rfx_for_lives (lives_rfx_t *);
494 
496 
497 void render_fx_get_params (lives_rfx_t *, const gchar *plugin_name, gshort status);
498 
499 void sort_rfx_array (lives_rfx_t *in_array, gint num_elements);
500 
501 gint find_rfx_plugin_by_name (const gchar *name, gshort status);
502 
503 void rfx_copy (lives_rfx_t *src, lives_rfx_t *dest, boolean full);
504 
505 void rfx_params_free(lives_rfx_t *rfx);
506 
507 void rfx_free(lives_rfx_t *rfx);
508 
509 void rfx_free_all (void);
510 
511 void param_copy (lives_param_t *src, lives_param_t *dest, boolean full);
512 
513 
514 typedef struct {
515  GList *list;
516  gint delegate;
517  gulong func;
520 
521 // filter types which can have candidates
522 #define FX_CANDIDATE_AUDIO_VOL 0
523 #define FX_CANDIDATE_RESIZER 1
524 #define FX_CANDIDATE_DEINTERLACE 2
525 
526 #define MAX_FX_CANDIDATE_TYPES 3
527 
528 
529 
530 
531 
532 boolean get_bool_param(void *value);
533 gint get_int_param(void *value);
534 gdouble get_double_param(void *value);
535 void get_colRGB24_param(void *value, lives_colRGB24_t *rgb);
536 void get_colRGBA32_param(void *value, lives_colRGBA32_t *rgba);
537 
538 void set_bool_param(void *value, boolean );
539 void set_int_param(void *value, gint );
540 void set_double_param(void *value, gdouble );
541 void set_colRGB24_param(void *value, gshort red, gshort green, gshort blue);
542 void set_colRGBA32_param(void *value, gshort red, gshort green, gshort blue, gshort alpha);
543 
545 void **store_rfx_params (lives_rfx_t *);
546 void set_rfx_params_from_store (lives_rfx_t *rfx, void **store);
547 void rfx_params_store_free (lives_rfx_t *, void **store);
548 
549 GList *array_to_string_list (gchar **array, gint offset, gint len);
550 
551 lives_rfx_t *weed_to_rfx (weed_plant_t *plant, boolean show_reinits);
552 lives_param_t *weed_params_to_rfx(gint npar, weed_plant_t *instance, boolean show_reinits);
553 
554 gchar *plugin_run_param_window(const gchar *get_com, GtkVBox *vbox, lives_rfx_t **ret_rfx);
555 
558 typedef struct {
560  GtkWidget *dialog;
561  GtkWidget *spinbuttonh;
562  GtkWidget *spinbuttonw;
563  GtkWidget *fps_entry;
564  GtkWidget *pal_entry;
566 } _vppaw;
567 
568 _vppaw *on_vpp_advanced_clicked (GtkButton *, gpointer);
569 void on_decplug_advanced_clicked (GtkButton *button, gpointer user_data);
570 
571 
573 
574 #endif