LiVES 1.4.9

src/plugins.h

Go to the documentation of this file.
00001 // plugins.h
00002 // LiVES
00003 // (c) G. Finch 2003-2010 <salsaman@xs4all.nl,salsaman@gmail.com>
00004 // released under the GNU GPL 3 or later
00005 // see file ../COPYING or www.gnu.org for licensing details
00006 
00007 #ifndef _HAS_PLUGINS_H
00008 #define _HAS_PLUGINS_H
00009 
00010 #include <gmodule.h>
00011 #include <unistd.h>
00012 #include <string.h>
00013 #include <fcntl.h>
00014 #include <stdlib.h>
00015 
00016 
00017 // generic plugins
00018 
00019 GList *get_plugin_list (const gchar *plugin_type, gboolean allow_nonex, const gchar *plugdir, const gchar *filter_ext);
00020 #define PLUGIN_ENCODERS "encoders"
00021 #define PLUGIN_DECODERS "decoders"
00022 #define PLUGIN_VID_PLAYBACK "playback/video"
00023 #define PLUGIN_AUDIO_STREAM "playback/audiostream"
00024 
00026 #define PLUGIN_THEMES "themes"
00027 
00029 #define PLUGIN_EFFECTS_WEED "weed"
00030 #define PLUGIN_WEED_FX_BUILTIN "effects/realtime/weed"
00031 
00032 
00033 GList *plugin_request (const gchar *plugin_type, const gchar *plugin_name, const gchar *request);
00034 GList *plugin_request_with_blanks (const gchar *plugin_type, const gchar *plugin_name, const gchar *request);
00035 GList *plugin_request_by_line (const gchar *plugin_type, const gchar *plugin_name, const gchar *request);
00036 GList *plugin_request_by_space (const gchar *plugin_type, const gchar *plugin_name, const gchar *request);
00037 GList *plugin_request_common (const gchar *plugin_type, const gchar *plugin_name, const gchar *request, const gchar *delim, gboolean allow_blanks);
00038 
00039 
00041 typedef gboolean (*plugin_keyfunc) (gboolean down, guint16 unicode, guint16 keymod);
00042 
00043 typedef struct {
00044   // playback
00045   gchar name[64];
00046   void *handle;
00047 
00048   // mandatory
00049   const char *(*module_check_init)(void);
00050   const char *(*version) (void);
00051   const char *(*get_description) (void);
00052   const char *(*get_rfx) (void);
00053   gint *(*get_palette_list) (void);
00054   gboolean (*set_palette) (int palette);
00055   guint64 (*get_capabilities) (int palette);
00056   gboolean (*render_frame) (int hsize, int vsize, int64_t timecode, void *pixel_data, void *return_data);
00057 
00058   // optional
00059   gboolean (*init_screen) (int width, int height, gboolean fullscreen, guint32 window_id, int argc, gchar **argv);
00060   void (*exit_screen) (guint16 mouse_x, guint16 mouse_y);
00061   void (*module_unload) (void);
00062   const gchar *(*get_fps_list) (int palette);
00063   gboolean (*set_fps) (gdouble fps);
00064 
00065   // only for display plugins
00066   gboolean (*send_keycodes) (plugin_keyfunc);
00067 
00068   // optional for YUV palettes
00069   int *(*get_yuv_palette_sampling) (int palette);
00070   int *(*get_yuv_palette_clamping) (int palette);
00071   int *(*get_yuv_palette_subspace) (int palette);
00072   int (*set_yuv_palette_sampling) (int palette);
00073   int (*set_yuv_palette_clamping) (int palette);
00074   int (*set_yuv_palette_subspace) (int palette);
00075 
00076   // audio streaming
00077   int *(*get_audio_fmts)(void);
00078 
00079   guint32 audio_codec;
00080   // must match with the "acodec" GList in interface.c
00081   // and bitmaps in the encder plugins, with this one addition:
00082 
00083   guint64 capabilities;
00084 
00085 #define VPP_CAN_RESIZE    1<<0
00086 #define VPP_CAN_RETURN    1<<1
00087 #define VPP_LOCAL_DISPLAY 1<<2
00088 
00089   gint fwidth,fheight;
00090 
00091   int palette;
00092   int YUV_sampling;
00093   int YUV_clamping;
00094   int YUV_subspace;
00095 
00096   gint fixed_fps_numer;
00097   gint fixed_fps_denom;
00098   gdouble fixed_fpsd;
00099 
00100   int extra_argc;
00101   gchar **extra_argv;
00102 
00103 
00104 } _vid_playback_plugin;
00105 
00106 
00107 #define DEF_VPP_HSIZE 320.
00108 #define DEF_VPP_VSIZE 240.
00109 
00110 _vid_playback_plugin *open_vid_playback_plugin (const gchar *name, gboolean using);
00111 void vid_playback_plugin_exit (void);
00112 void close_vid_playback_plugin(_vid_playback_plugin *);
00113 gint64 get_best_audio(_vid_playback_plugin *);
00114 void save_vpp_defaults(_vid_playback_plugin *, gchar *file);
00115 void load_vpp_defaults(_vid_playback_plugin *, gchar *file);
00116 
00117 
00118 // encoder plugins
00119 
00120 void do_plugin_encoder_error(const gchar *plugin_name_or_null);
00121 
00122 GList *filter_encoders_by_img_ext(GList *encoders, const gchar *img_ext);
00123 
00124 typedef struct {
00125   gchar name[51];
00126   guint32 audio_codec;
00127   // match with bitmaps in the encoder plugins
00128   // and also anames array in plugins.c (see below)
00129 
00130 #define AUDIO_CODEC_MP3 0
00131 #define AUDIO_CODEC_PCM 1
00132 #define AUDIO_CODEC_MP2 2
00133 #define AUDIO_CODEC_VORBIS 3
00134 #define AUDIO_CODEC_AC3 4
00135 #define AUDIO_CODEC_AAC 5
00136 #define AUDIO_CODEC_AMR_NB 6
00137 #define AUDIO_CODEC_RAW 7       // reserved
00138 #define AUDIO_CODEC_WMA2 8
00139 
00140 #define AUDIO_CODEC_MAX 31
00141   //
00142 #define AUDIO_CODEC_NONE 32
00143 #define AUDIO_CODEC_UNKNOWN 33
00144 
00145   guint capabilities;
00146 
00147 
00148 #define HAS_RFX 1<<0
00149 
00150 #define CAN_ENCODE_PNG 1<<2
00151 #define ENCODER_NON_NATIVE 1<<3
00152 
00153   // current output format
00154   gchar of_name[51];
00155   gchar of_desc[128];
00156   gint of_allowed_acodecs;
00157   gchar of_restrict[1024];
00158   gchar of_def_ext[16];
00159 }
00160 _encoder;
00161 
00162 
00163 // defined in plugins.c for the whole app
00164 extern const char *anames[AUDIO_CODEC_MAX];
00165 
00166 
00167 // decoder plugins
00168 
00169 // seek_flags is a bitmap
00170 
00172 #define LIVES_SEEK_FAST (1<<0)
00173 
00175 #define LIVES_SEEK_NEEDS_CALCULATION (1<<1)
00176 #define LIVES_SEEK_QUALITY_LOSS (1<<2)
00177 
00178 
00179 typedef struct {
00180   gchar *URI; 
00181 
00182   gint nclips; 
00183   gchar container_name[512]; 
00184 
00186   gint current_clip; 
00187 
00188   // video data
00189   gint width; // width and height of picture in frame
00190   gint height;
00191   gint64 nframes;
00192   lives_interlace_t interlace;
00193 
00196   gint offs_x;
00197   gint offs_y;
00198   gint frame_width; // frame width and height are the size of the outer frame
00199   gint frame_height;
00200 
00201   gfloat par; 
00202 
00203   gfloat fps;
00204 
00205   int *palettes;
00206 
00208   int current_palette;  
00209   
00210   int YUV_sampling;
00211   int YUV_clamping;
00212   int YUV_subspace;
00213   gchar video_name[512]; 
00214 
00215   /* audio data */
00216   gint arate;
00217   gint achans;
00218   gint asamps;
00219   gboolean asigned;
00220   gboolean ainterleaf;
00221   gchar audio_name[512]; 
00222 
00223   int seek_flag;
00224 
00225   void *priv; 
00226 
00227 } lives_clip_data_t;
00228 
00229 
00230 
00231 typedef struct {
00232   // playback
00233   gchar *name; 
00234   void *handle; 
00235 
00236   // mandatory
00237   const char *(*version) (void);
00238 
00245   lives_clip_data_t *(*get_clip_data)(char *URI, lives_clip_data_t *cdata);
00246 
00248   gboolean (*get_frame)(const lives_clip_data_t *, int64_t frame, int *rowstrides, int height, void **pixel_data);
00249 
00251   void (*clip_data_free)(lives_clip_data_t *);
00252 
00253   // optional
00254   const char *(*module_check_init)(void);
00255   int64_t (*rip_audio) (const lives_clip_data_t *, const char *fname, int64_t stframe, int64_t nframes, 
00256                         unsigned char **abuff);
00257   void (*rip_audio_cleanup) (const lives_clip_data_t *cdata);
00258   void (*module_unload)(void);
00259 
00260 } lives_decoder_sys_t;
00261 
00262 
00263 
00264 
00265 typedef struct {
00266   const lives_decoder_sys_t *decoder;
00267   lives_clip_data_t *cdata;
00268 } lives_decoder_t;
00269 
00270 
00271 
00272 
00273 
00274 
00275 const lives_clip_data_t *get_decoder_cdata(file *, GList *disabled);
00276 void close_decoder_plugin (lives_decoder_t *);
00277 lives_decoder_sys_t *open_decoder_plugin(const gchar *plname);
00278 void get_mime_type(gchar *text, int maxlen, const lives_clip_data_t *);
00279 void unload_decoder_plugins(void);
00280 
00281 LIVES_INLINE gboolean decplugin_supports_palette (const lives_decoder_t *dplug, int palette);
00282 
00283 
00284 
00285 // RFX plugins
00286 
00287 
00289 #define PLUGIN_RENDERED_EFFECTS_BUILTIN "effects/rendered/"
00290 
00292 #define PLUGIN_RENDERED_EFFECTS_CUSTOM "plugins/effects/rendered/custom/"
00293 #define PLUGIN_RENDERED_EFFECTS_TEST "plugins/effects/rendered/test/"
00294 
00296 #define PLUGIN_RENDERED_EFFECTS_BUILTIN_SCRIPTS "effects/RFXscripts/"
00297 
00299 #define PLUGIN_RENDERED_EFFECTS_CUSTOM_SCRIPTS "plugins/effects/RFXscripts/custom/"
00300 #define PLUGIN_RENDERED_EFFECTS_TEST_SCRIPTS "plugins/effects/RFXscripts/test/"
00301 
00303 #define PLUGIN_RFX_SCRAP ""
00304 
00305 
00307 #define MAX_PARAM_WIDGETS 5
00308 
00310 #define RFX_MAXSTRINGLEN 1024
00311 
00312 
00313 typedef enum {
00314 
00315   LIVES_PARAM_UNKNOWN=0,
00316   LIVES_PARAM_NUM,
00317   LIVES_PARAM_BOOL,
00318   LIVES_PARAM_COLRGB24,
00319   LIVES_PARAM_STRING,
00320   LIVES_PARAM_STRING_LIST,
00321   LIVES_PARAM_COLRGBA32,
00322 
00323   LIVES_PARAM_UNDISPLAYABLE=65536
00324   
00325 } lives_param_type_t;
00326 
00327 
00328 typedef enum {
00329   LIVES_RFX_SOURCE_RFX=0,
00330   LIVES_RFX_SOURCE_WEED
00331 } lives_rfx_source_t;
00332 
00333 
00334 
00335 
00336 
00337 typedef struct {
00338   // weed style part
00339   gchar *name;
00340   gchar *desc;
00341 
00342   gchar *label;
00343   gint flags;
00344   gboolean use_mnemonic;
00345   gpointer interp_func;
00346   gpointer display_func;
00347   gint hidden;
00348 
00349   // reason(s) for hiding [bitmap]
00350 #define HIDDEN_GUI (1<<0)
00351 #define HIDDEN_MULTI (1<<1)
00352 #define HIDDEN_NEEDS_REINIT (1<<2)
00353 
00354   gdouble step_size;
00355   gint copy_to;
00356   gboolean transition;
00357   gboolean reinit;
00358 
00359   gboolean wrap;
00360   gint group;
00361   lives_param_type_t type;
00362 
00363   gint dp;  
00364   void *value;  
00365 
00366   gdouble min;
00367   gdouble max; 
00368 
00369   void *def; 
00370   GList *list; 
00371 
00373   gshort multi;
00374 #define PVAL_MULTI_NONE 0
00375 #define PVAL_MULTI_ANY 1
00376 #define PVAL_MULTI_PER_CHANNEL 2
00377 
00378   //--------------------------------------------------
00379   // extras for LiVES
00380 
00382   GtkWidget *widgets[MAX_PARAM_WIDGETS]; 
00383   gboolean onchange; 
00384 
00385   gboolean changed;
00386 
00387   gboolean change_blocked;
00388 
00389   void *source;
00390 
00391   lives_rfx_source_t source_type;
00392 
00393 } lives_param_t;
00394 
00395 
00396 typedef enum {
00397   RFX_STATUS_BUILTIN=0, 
00398   RFX_STATUS_CUSTOM=1, 
00399   RFX_STATUS_TEST=2, 
00400   RFX_STATUS_ANY=3, 
00401   RFX_STATUS_WEED=4, 
00402   RFX_STATUS_SCRAP=5, 
00403 
00404   // these are only used when prompting for a name
00405   RFX_STATUS_COPY=128, 
00406   RFX_STATUS_RENAME=129 
00407 } lives_rfx_status_t;
00408 
00409 
00410 
00411 
00412 typedef struct {
00413   gchar *name;  
00414   gchar *menu_text; 
00415   gchar *action_desc; 
00416   gint min_frames; 
00417   gint num_in_channels;
00418   lives_rfx_status_t status;
00419 
00420 
00421   guint32 props;
00422 #define RFX_PROPS_SLOW        0x0001  ///< hint to GUI
00423 #define RFX_PROPS_MAY_RESIZE  0x0002 ///< is a tool
00424 #define RFX_PROPS_BATCHG      0x0004 ///< is a batch generator
00425 
00426 
00427 #define RFX_PROPS_RESERVED1   0x1000
00428 #define RFX_PROPS_RESERVED2   0x2000
00429 #define RFX_PROPS_RESERVED3   0x4000
00430 #define RFX_PROPS_AUTO_BUILT  0x8000
00431 
00432   GtkWidget *menuitem;  
00433   gint num_params;
00434   lives_param_t *params;
00435   lives_rfx_source_t source_type;
00436   void *source;  
00437   void *extra;  
00438   gchar delim[2];
00439   gboolean is_template;
00440 
00441 } lives_rfx_t;
00442 
00443 gboolean check_rfx_for_lives (lives_rfx_t *);
00444 
00445 void do_rfx_cleanup(lives_rfx_t *);
00446 
00447 void render_fx_get_params (lives_rfx_t *, const gchar *plugin_name, gshort status);
00448 
00449 void sort_rfx_array (lives_rfx_t *in_array, gint num_elements);
00450 
00451 gint find_rfx_plugin_by_name (const gchar *name, gshort status);
00452 
00453 void rfx_copy (lives_rfx_t *src, lives_rfx_t *dest, gboolean full);
00454 
00455 void rfx_free(lives_rfx_t *rfx);
00456 
00457 void rfx_free_all (void);
00458 
00459 void param_copy (lives_param_t *src, lives_param_t *dest, gboolean full);
00460 
00461 
00462 typedef struct {
00463   GList *list; 
00464   gint delegate; 
00465   gulong func; 
00466   lives_rfx_t *rfx; 
00467 } lives_fx_candidate_t;
00468 
00469 // filter types which can have candidates
00470 #define FX_CANDIDATE_AUDIO_VOL 0
00471 #define FX_CANDIDATE_RESIZER 1
00472 #define FX_CANDIDATE_DEINTERLACE 2
00473 
00474 #define MAX_FX_CANDIDATE_TYPES 3
00475 
00476 gboolean get_bool_param(void *value);
00477 gint get_int_param(void *value);
00478 gdouble get_double_param(void *value);
00479 void get_colRGB24_param(void *value, lives_colRGB24_t *rgb);
00480 void get_colRGBA32_param(void *value, lives_colRGBA32_t *rgba);
00481 
00482 void set_bool_param(void *value, gboolean );
00483 void set_int_param(void *value, gint );
00484 void set_double_param(void *value, gdouble );
00485 void set_colRGB24_param(void *value, gshort red, gshort green, gshort blue);
00486 void set_colRGBA32_param(void *value, gshort red, gshort green, gshort blue, gshort alpha);
00487 
00489 void **store_rfx_params (lives_rfx_t *);
00490 void set_rfx_params_from_store (lives_rfx_t *rfx, void **store);
00491 void rfx_params_store_free (lives_rfx_t *, void **store);
00492 
00493 GList *array_to_string_list (gchar **array, gint offset, gint len);
00494 
00495 lives_rfx_t *weed_to_rfx (weed_plant_t *plant, gboolean show_reinits);
00496 
00497 gchar *plugin_run_param_window(const gchar *get_com, GtkVBox *vbox, lives_rfx_t **ret_rfx);
00498 
00501 typedef struct {
00502   _vid_playback_plugin *plugin;
00503   GtkWidget *dialog;
00504   GtkWidget *spinbuttonh;
00505   GtkWidget *spinbuttonw;
00506   GtkWidget *fps_entry;
00507   GtkWidget *pal_entry;
00508   lives_rfx_t *rfx;
00509 } _vppaw;
00510 
00511 _vppaw *on_vpp_advanced_clicked (GtkButton *, gpointer);
00512 void on_decplug_advanced_clicked (GtkButton *button, gpointer user_data);
00513 
00514 
00516 
00517 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines