LiVES  1.6.4-svn
 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@xs4all.nl,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, gboolean 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, gboolean 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 gboolean (*plugin_keyfunc) (gboolean 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);
58  gboolean (*set_palette) (int palette);
59  guint64 (*get_capabilities) (int palette);
60 
61  gboolean (*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  gboolean (*init_screen) (int width, int height, gboolean 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  gboolean (*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, gboolean 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  gboolean asigned;
242  gboolean 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  gboolean (*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 gboolean 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 
362 
363 
364 typedef struct {
365  // weed style part
366  gchar *name;
367  gchar *desc;
368 
369  gchar *label;
370  gint flags;
371  gboolean use_mnemonic;
374  gint hidden;
375 
376  // reason(s) for hiding [bitmap]
377 #define HIDDEN_GUI (1<<0)
378 #define HIDDEN_MULTI (1<<1)
379 #define HIDDEN_NEEDS_REINIT (1<<2)
380 
381  gdouble step_size;
382  //gint copy_to;
383  gboolean transition;
384  gboolean reinit;
385 
386  gboolean wrap;
387  gint group;
389 
390  gint dp;
391  void *value;
392 
393  gdouble min;
394  gdouble max;
395 
396  void *def;
397  GList *list;
398 
400  gshort multi;
401 #define PVAL_MULTI_NONE 0
402 #define PVAL_MULTI_ANY 1
403 #define PVAL_MULTI_PER_CHANNEL 2
404 
405  //--------------------------------------------------
406  // extras for LiVES
407 
409  GtkWidget *widgets[MAX_PARAM_WIDGETS];
410  gboolean onchange;
411 
412  gboolean changed;
413 
414  gboolean change_blocked;
415 
416  void *source;
417 
419 
420 } lives_param_t;
421 
422 
423 typedef enum {
430 
431  // these are only used when prompting for a name
435 
436 
437 
438 
439 typedef struct {
440  gchar *name;
441  gchar *menu_text;
442  gchar *action_desc;
443  gint min_frames;
446 
447 
448  guint32 props;
449 #define RFX_PROPS_SLOW 0x0001
450 #define RFX_PROPS_MAY_RESIZE 0x0002
451 #define RFX_PROPS_BATCHG 0x0004
452 
453 
454 #define RFX_PROPS_RESERVED1 0x1000
455 #define RFX_PROPS_RESERVED2 0x2000
456 #define RFX_PROPS_RESERVED3 0x4000
457 #define RFX_PROPS_AUTO_BUILT 0x8000
458 
459  GtkWidget *menuitem;
463  void *source;
464  void *extra;
465  gchar delim[2];
466  gboolean is_template;
467 
468 } lives_rfx_t;
469 
470 
471 gboolean check_rfx_for_lives (lives_rfx_t *);
472 
474 
475 void render_fx_get_params (lives_rfx_t *, const gchar *plugin_name, gshort status);
476 
477 void sort_rfx_array (lives_rfx_t *in_array, gint num_elements);
478 
479 gint find_rfx_plugin_by_name (const gchar *name, gshort status);
480 
481 void rfx_copy (lives_rfx_t *src, lives_rfx_t *dest, gboolean full);
482 
483 void rfx_params_free(lives_rfx_t *rfx);
484 
485 void rfx_free(lives_rfx_t *rfx);
486 
487 void rfx_free_all (void);
488 
489 void param_copy (lives_param_t *src, lives_param_t *dest, gboolean full);
490 
491 
492 typedef struct {
493  GList *list;
494  gint delegate;
495  gulong func;
498 
499 // filter types which can have candidates
500 #define FX_CANDIDATE_AUDIO_VOL 0
501 #define FX_CANDIDATE_RESIZER 1
502 #define FX_CANDIDATE_DEINTERLACE 2
503 
504 #define MAX_FX_CANDIDATE_TYPES 3
505 
506 
507 
508 
509 
510 gboolean get_bool_param(void *value);
511 gint get_int_param(void *value);
512 gdouble get_double_param(void *value);
513 void get_colRGB24_param(void *value, lives_colRGB24_t *rgb);
514 void get_colRGBA32_param(void *value, lives_colRGBA32_t *rgba);
515 
516 void set_bool_param(void *value, gboolean );
517 void set_int_param(void *value, gint );
518 void set_double_param(void *value, gdouble );
519 void set_colRGB24_param(void *value, gshort red, gshort green, gshort blue);
520 void set_colRGBA32_param(void *value, gshort red, gshort green, gshort blue, gshort alpha);
521 
523 void **store_rfx_params (lives_rfx_t *);
524 void set_rfx_params_from_store (lives_rfx_t *rfx, void **store);
525 void rfx_params_store_free (lives_rfx_t *, void **store);
526 
527 GList *array_to_string_list (gchar **array, gint offset, gint len);
528 
529 lives_rfx_t *weed_to_rfx (weed_plant_t *plant, gboolean show_reinits);
530 lives_param_t *weed_params_to_rfx(gint npar, weed_plant_t *instance, gboolean show_reinits);
531 
532 gchar *plugin_run_param_window(const gchar *get_com, GtkVBox *vbox, lives_rfx_t **ret_rfx);
533 
536 typedef struct {
538  GtkWidget *dialog;
539  GtkWidget *spinbuttonh;
540  GtkWidget *spinbuttonw;
541  GtkWidget *fps_entry;
542  GtkWidget *pal_entry;
544 } _vppaw;
545 
546 _vppaw *on_vpp_advanced_clicked (GtkButton *, gpointer);
547 void on_decplug_advanced_clicked (GtkButton *button, gpointer user_data);
548 
549 
551 
552 #endif