gmerlin
pluginregistry.h
1 /*****************************************************************
2  * gmerlin - a general purpose multimedia framework and applications
3  *
4  * Copyright (c) 2001 - 2011 Members of the Gmerlin project
5  * gmerlin-general@lists.sourceforge.net
6  * http://gmerlin.sourceforge.net
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  * *****************************************************************/
21 
22 #ifndef __BG_PLUGINREGISTRY_H_
23 #define __BG_PLUGINREGISTRY_H_
24 
25 /* Plugin registry */
26 #include <pthread.h>
27 
28 #include <gmerlin/plugin.h>
29 #include <gmerlin/cfg_registry.h>
30 
49 typedef enum
50  {
56 
61 typedef enum
62  {
63  BG_STREAM_AUDIO = (1<<0),
64  BG_STREAM_SUBTITLE_TEXT = (1<<1),
65  BG_STREAM_SUBTITLE_OVERLAY = (1<<2),
66  BG_STREAM_VIDEO = (1<<3),
68 
74 
80  {
81  char * gettext_domain;
83 
84  char * name;
85  char * long_name;
86  char * mimetypes;
87  char * extensions;
88  char * protocols;
89 
90  char * description;
91 
92  char * module_filename;
93  long module_time;
94 
96  int index;
97 
99  int flags;
100  int priority;
101 
103 
105 
107 
112 
115 
118 
119  char * cmp_name;
120 
121  };
122 
129 typedef struct
130  {
131  char ** blacklist;
132  int dont_save;
134 
141 typedef struct bg_plugin_registry_s bg_plugin_registry_t;
142 
148 
158  {
159  /* Private members, should not be accessed! */
160 
161  void * dll_handle;
162  pthread_mutex_t mutex;
163  int refcount;
165 
166  /* These are for use by applications */
167 
171  void * priv;
172 
173  char * location;
175  };
176 
177 /*
178  * pluginregistry.c
179  */
180 
191 
203  const bg_plugin_registry_options_t * opt);
204 
205 
206 
219  uint32_t type_mask, uint32_t flag_mask);
220 
221 
228 
238  uint32_t type_mask, uint32_t flag_mask);
251 const bg_plugin_info_t *
253  uint32_t type_mask, uint32_t flag_mask);
254 
262 const bg_plugin_info_t *
263 bg_plugin_find_by_name(bg_plugin_registry_t * reg, const char * name);
264 
275 const bg_plugin_info_t *
277  const char * filename, int type_mask);
278 
279 
286 const bg_plugin_info_t *
288  const char * protocol);
289 
290 
291 /* Another method: Return long names as strings (NULL terminated) */
292 
308  uint32_t type_mask,
309  uint32_t flag_mask);
310 
315 void bg_plugin_registry_free_plugins(char ** plugins);
316 
317 
318 /* Finally a version for finding/loading plugins */
319 
320 /*
321  * info can be NULL
322  * If ret is non NULL before the call, the plugin will be unrefed
323  *
324  * Return values are 0 for error, 1 on success
325  */
326 
343  const char * location,
344  const bg_plugin_info_t * info,
345  bg_plugin_handle_t ** ret,
346  bg_input_callbacks_t * callbacks, int prefer_edl);
347 
363  const bg_edl_t * edl,
364  const bg_plugin_info_t * info,
365  bg_plugin_handle_t ** ret,
366  bg_input_callbacks_t * callbacks);
367 
368 /* Set the supported extensions and mimetypes for a plugin */
369 
380  const char * plugin_name,
381  const char * extensions);
382 
393  const char * plugin_name,
394  const char * protocols);
395 
406  const char * plugin_name,
407  int priority);
408 
409 
418  const char * plugin_name);
419 
430  uint32_t type_mask,
431  uint32_t flag_mask,
432  bg_parameter_info_t * ret);
433 
444  uint32_t type_mask,
445  uint32_t flag_mask,
446  bg_parameter_info_t * ret);
447 
448 
457 void bg_plugin_registry_set_parameter_input(void * data, const char * name,
458  const bg_parameter_value_t * val);
459 
460 int bg_plugin_registry_get_parameter_input(void * data, const char * name,
461  bg_parameter_value_t * val);
462 
463 
482  uint32_t stream_type_mask,
483  uint32_t flag_mask);
484 
494 const char *
496  bg_cfg_section_t * s,
497  bg_stream_type_t stream_type,
498  int stream_mask);
499 
511 void
513  bg_cfg_section_t * s,
514  bg_stream_type_t stream_type,
515  int stream_mask,
516  bg_cfg_section_t ** section_ret,
517  const bg_parameter_info_t ** params_ret);
518 
529 void
531  bg_cfg_section_t * s,
532  bg_stream_type_t stream_type,
533  int stream_mask,
534  bg_cfg_section_t ** section_ret,
535  const bg_parameter_info_t ** params_ret);
536 
537 
549  const bg_parameter_info_t * parameters,
550  uint32_t type_mask,
551  uint32_t flag_mask);
552 
563 void
565  bg_cfg_section_t * s,
566  const bg_parameter_info_t * parameters,
567  uint32_t type_mask,
568  uint32_t flag_mask);
569 
570 
583  bg_plugin_type_t type, uint32_t flag_mask,
584  const char * plugin_name);
585 
596  bg_plugin_type_t type, uint32_t flag_mask);
597 
598 
622  int audio_to_video);
623 
631 
639  int subtitle_text_to_video);
640 
648 
656  int subtitle_overlay_to_video);
657 
664 
672  int encode_pp);
673 
680 
688  int enable);
689 
697 
698 
708  const char * plugin_name,
709  const char * device,
710  const char * name);
711 
725  const char * plugin_name,
726  const char * device,
727  const char * name);
728 
729 /* Rescan the available devices */
730 
741  const char * plugin_name);
742 
755  const char * plugin_name,
756  const char * device,
757  const char * name);
758 
772  const char * filename,
773  gavl_video_format_t * format,
774  gavl_metadata_t * m);
775 
776 /* Same as above for writing. Does implicit pixelformat conversion */
777 
787 void
789  const char * filename,
790  gavl_video_frame_t * frame,
791  const gavl_video_format_t * format,
792  const gavl_metadata_t * m);
793 
794 
806 int bg_get_thumbnail(const char * gml,
807  bg_plugin_registry_t * plugin_reg,
808  char ** thumbnail_filename_ret,
809  gavl_video_frame_t ** frame_ret,
810  gavl_video_format_t * format_ret);
811 
812 
813 /*
814  * These are the actual loading/unloading functions
815  * (loader.c)
816  */
817 
818 /* Load a plugin and return handle with reference count of 1 */
819 
829  const bg_plugin_info_t * info);
830 
842  const bg_plugin_info_t * info,
843  const char * window_id);
844 
850 
856 
857 /* Reference counting for input plugins */
858 
864 
865 /* Plugin will be unloaded when refcount is zero */
866 
875 
888 
898 
908 
909 
910 #endif // __BG_PLUGINREGISTRY_H_