gmerlin
pluginregistry.h
1 /*****************************************************************
2  * gmerlin - a general purpose multimedia framework and applications
3  *
4  * Copyright (c) 2001 - 2012 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_TEXT = (1<<1),
65  BG_STREAM_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;
90 
91  char * description;
92 
93  char * module_filename;
94  long module_time;
95 
97  int index;
98 
100  int flags;
101  int priority;
102 
104 
106 
108 
109 
114 
117 
120 
121  char * cmp_name;
122 
123  };
124 
131 typedef struct
132  {
133  char ** blacklist;
134  int dont_save;
136 
143 typedef struct bg_plugin_registry_s bg_plugin_registry_t;
144 
150 
160  {
161  /* Private members, should not be accessed! */
162 
163  void * dll_handle;
164  pthread_mutex_t mutex;
165  int refcount;
167 
168  /* These are for use by applications */
169 
173  void * priv;
174 
175  // char * location; //!< Applications can save the argument of an open call here
176  gavl_edl_t * edl;
177  };
178 
179 /*
180  * pluginregistry.c
181  */
182 
193 
205  const bg_plugin_registry_options_t * opt);
206 
207 
208 
221  uint32_t type_mask, uint32_t flag_mask);
222 
223 
230 
240  uint32_t type_mask, uint32_t flag_mask);
253 const bg_plugin_info_t *
255  uint32_t type_mask, uint32_t flag_mask);
256 
264 const bg_plugin_info_t *
265 bg_plugin_find_by_name(bg_plugin_registry_t * reg, const char * name);
266 
277 const bg_plugin_info_t *
279  const char * filename, int type_mask);
280 
291 const bg_plugin_info_t *
293  const char * mimetype, int type_mask);
294 
295 
296 
305 const bg_plugin_info_t *
307  gavl_codec_id_t id,
308  int typemask, int flagmask);
309 
310 
317 const bg_plugin_info_t *
319  const char * protocol);
320 
321 
322 /* Another method: Return long names as strings (NULL terminated) */
323 
339  uint32_t type_mask,
340  uint32_t flag_mask);
341 
346 void bg_plugin_registry_free_plugins(char ** plugins);
347 
348 
349 /* Finally a version for finding/loading plugins */
350 
351 /*
352  * info can be NULL
353  * If ret is non NULL before the call, the plugin will be unrefed
354  *
355  * Return values are 0 for error, 1 on success
356  */
357 
374  const char * location,
375  const bg_plugin_info_t * info,
376  bg_plugin_handle_t ** ret,
377  bg_input_callbacks_t * callbacks, int prefer_edl);
378 
396  const char * location,
397  const bg_plugin_info_t * info,
398  bg_plugin_handle_t ** ret,
399  bg_input_callbacks_t * callbacks, int prefer_edl,
400  int * track);
401 
402 
418  const gavl_edl_t * edl,
419  const bg_plugin_info_t * info,
420  bg_plugin_handle_t ** ret,
421  bg_input_callbacks_t * callbacks);
422 
423 /* Set the supported extensions and mimetypes for a plugin */
424 
435  const char * plugin_name,
436  const char * extensions);
437 
448  const char * plugin_name,
449  const char * protocols);
450 
461  const char * plugin_name,
462  int priority);
463 
464 
473  const char * plugin_name);
474 
485  uint32_t type_mask,
486  uint32_t flag_mask,
487  bg_parameter_info_t * ret);
488 
499  uint32_t type_mask,
500  uint32_t flag_mask,
501  bg_parameter_info_t * ret);
502 
503 
512 void bg_plugin_registry_set_parameter_input(void * data, const char * name,
513  const bg_parameter_value_t * val);
514 
515 int bg_plugin_registry_get_parameter_input(void * data, const char * name,
516  bg_parameter_value_t * val);
517 
518 
537  uint32_t stream_type_mask,
538  uint32_t flag_mask,
539  int stream_params);
540 
554  uint32_t flag_mask);
555 
568 void
570  bg_plugin_handle_t ** plugin,
571  const char * name,
572  const bg_parameter_value_t * val);
573 
586  bg_cfg_section_t * section);
587 
588 
598 const char *
600  bg_cfg_section_t * s,
601  bg_stream_type_t stream_type,
602  int stream_mask);
603 
615 void
617  bg_cfg_section_t * s,
618  bg_stream_type_t stream_type,
619  int stream_mask,
620  bg_cfg_section_t ** section_ret,
621  const bg_parameter_info_t ** params_ret);
622 
633 void
635  bg_cfg_section_t * s,
636  bg_stream_type_t stream_type,
637  int stream_mask,
638  bg_cfg_section_t ** section_ret,
639  const bg_parameter_info_t ** params_ret);
640 
641 
653  const bg_parameter_info_t * parameters,
654  uint32_t type_mask,
655  uint32_t flag_mask);
656 
667 void
669  bg_cfg_section_t * s,
670  const bg_parameter_info_t * parameters,
671  uint32_t type_mask,
672  uint32_t flag_mask);
673 
674 
687  bg_plugin_type_t type, uint32_t flag_mask,
688  const char * plugin_name);
689 
700  bg_plugin_type_t type, uint32_t flag_mask);
701 
702 
726  int audio_to_video);
727 
735 
743  int text_to_video);
744 
752 
760  int overlay_to_video);
761 
768 
776  int encode_pp);
777 
784 
792  int enable);
793 
801 
802 
812  const char * plugin_name,
813  const char * device,
814  const char * name);
815 
829  const char * plugin_name,
830  const char * device,
831  const char * name);
832 
833 /* Rescan the available devices */
834 
845  const char * plugin_name);
846 
859  const char * plugin_name,
860  const char * device,
861  const char * name);
862 
876  const char * filename,
877  gavl_video_format_t * format,
878  gavl_metadata_t * m);
879 
880 /* Same as above for writing. Does implicit pixelformat conversion */
881 
891 void
893  const char * filename,
894  gavl_video_frame_t * frame,
895  const gavl_video_format_t * format,
896  const gavl_metadata_t * m);
897 
898 
910 int bg_get_thumbnail(const char * gml,
911  bg_plugin_registry_t * plugin_reg,
912  char ** thumbnail_filename_ret,
913  gavl_video_frame_t ** frame_ret,
914  gavl_video_format_t * format_ret);
915 
927 char * bg_make_thumbnail(bg_plugin_registry_t * plugin_reg,
928  gavl_video_frame_t * in_frame,
929  gavl_video_format_t * input_format,
930  int max_width, int max_height,
931  const char * out_file_base,
932  const char * mimetype);
933 
934 
935 /*
936  * These are the actual loading/unloading functions
937  * (loader.c)
938  */
939 
940 /* Load a plugin and return handle with reference count of 1 */
941 
951  const bg_plugin_info_t * info);
952 
964  const bg_plugin_info_t * info,
965  const char * window_id);
966 
971 void bg_plugin_lock(void * h);
972 
977 void bg_plugin_unlock(void * h);
978 
979 /* Reference counting for input plugins */
980 
986 
987 /* Plugin will be unloaded when refcount is zero */
988 
997 
1010 
1020 
1030 
1040 
1046 
1047 #endif // __BG_PLUGINREGISTRY_H_