00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __BG_PLUGINREGISTRY_H_
00023 #define __BG_PLUGINREGISTRY_H_
00024
00025
00026 #include <pthread.h>
00027
00028 #include <gmerlin/plugin.h>
00029 #include <gmerlin/cfg_registry.h>
00030
00049 typedef enum
00050 {
00051 BG_PLUGIN_API_GMERLIN = 0,
00052 BG_PLUGIN_API_LADSPA,
00053 BG_PLUGIN_API_LV,
00054 BG_PLUGIN_API_FREI0R,
00055 } bg_plugin_api_t;
00056
00061 typedef enum
00062 {
00063 BG_STREAM_AUDIO = (1<<0),
00064 BG_STREAM_SUBTITLE_TEXT = (1<<1),
00065 BG_STREAM_SUBTITLE_OVERLAY = (1<<2),
00066 BG_STREAM_VIDEO = (1<<3),
00067 } bg_stream_type_t;
00068
00073 typedef struct bg_plugin_info_s bg_plugin_info_t;
00074
00079 struct bg_plugin_info_s
00080 {
00081 char * gettext_domain;
00082 char * gettext_directory;
00083
00084 char * name;
00085 char * long_name;
00086 char * mimetypes;
00087 char * extensions;
00088 char * protocols;
00089
00090 char * description;
00091
00092 char * module_filename;
00093 long module_time;
00094
00095 bg_plugin_api_t api;
00096 int index;
00097
00098 bg_plugin_type_t type;
00099 int flags;
00100 int priority;
00101
00102 bg_device_info_t * devices;
00103
00104 bg_plugin_info_t * next;
00105
00106 bg_parameter_info_t * parameters;
00107
00108 int max_audio_streams;
00109 int max_video_streams;
00110 int max_subtitle_text_streams;
00111 int max_subtitle_overlay_streams;
00112
00113 bg_parameter_info_t * audio_parameters;
00114 bg_parameter_info_t * video_parameters;
00115
00116 bg_parameter_info_t * subtitle_text_parameters;
00117 bg_parameter_info_t * subtitle_overlay_parameters;
00118
00119 char * cmp_name;
00120
00121 };
00122
00129 typedef struct
00130 {
00131 char ** blacklist;
00132 int dont_save;
00133 } bg_plugin_registry_options_t;
00134
00141 typedef struct bg_plugin_registry_s bg_plugin_registry_t;
00142
00147 typedef struct bg_plugin_handle_s bg_plugin_handle_t;
00148
00157 struct bg_plugin_handle_s
00158 {
00159
00160
00161 void * dll_handle;
00162 pthread_mutex_t mutex;
00163 int refcount;
00164 bg_plugin_registry_t * plugin_reg;
00165
00166
00167
00168 const bg_plugin_common_t * plugin;
00169 bg_plugin_common_t * plugin_nc;
00170 const bg_plugin_info_t * info;
00171 void * priv;
00172
00173 char * location;
00174 bg_edl_t * edl;
00175 };
00176
00177
00178
00179
00180
00189 bg_plugin_registry_t *
00190 bg_plugin_registry_create(bg_cfg_section_t * section);
00191
00201 bg_plugin_registry_t *
00202 bg_plugin_registry_create_with_options(bg_cfg_section_t * section,
00203 const bg_plugin_registry_options_t * opt);
00204
00205
00206
00218 void bg_plugin_registry_scan_devices(bg_plugin_registry_t * plugin_reg,
00219 uint32_t type_mask, uint32_t flag_mask);
00220
00221
00227 void bg_plugin_registry_destroy(bg_plugin_registry_t * reg);
00228
00237 int bg_plugin_registry_get_num_plugins(bg_plugin_registry_t * reg,
00238 uint32_t type_mask, uint32_t flag_mask);
00251 const bg_plugin_info_t *
00252 bg_plugin_find_by_index(bg_plugin_registry_t * reg, int index,
00253 uint32_t type_mask, uint32_t flag_mask);
00254
00262 const bg_plugin_info_t *
00263 bg_plugin_find_by_name(bg_plugin_registry_t * reg, const char * name);
00264
00275 const bg_plugin_info_t *
00276 bg_plugin_find_by_filename(bg_plugin_registry_t * reg,
00277 const char * filename, int type_mask);
00278
00279
00286 const bg_plugin_info_t *
00287 bg_plugin_find_by_protocol(bg_plugin_registry_t * reg,
00288 const char * protocol);
00289
00290
00291
00292
00307 char ** bg_plugin_registry_get_plugins(bg_plugin_registry_t*reg,
00308 uint32_t type_mask,
00309 uint32_t flag_mask);
00310
00315 void bg_plugin_registry_free_plugins(char ** plugins);
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00342 int bg_input_plugin_load(bg_plugin_registry_t * reg,
00343 const char * location,
00344 const bg_plugin_info_t * info,
00345 bg_plugin_handle_t ** ret,
00346 bg_input_callbacks_t * callbacks, int prefer_edl);
00347
00362 int bg_input_plugin_load_edl(bg_plugin_registry_t * reg,
00363 const bg_edl_t * edl,
00364 const bg_plugin_info_t * info,
00365 bg_plugin_handle_t ** ret,
00366 bg_input_callbacks_t * callbacks);
00367
00368
00369
00379 void bg_plugin_registry_set_extensions(bg_plugin_registry_t * reg,
00380 const char * plugin_name,
00381 const char * extensions);
00382
00392 void bg_plugin_registry_set_protocols(bg_plugin_registry_t * reg,
00393 const char * plugin_name,
00394 const char * protocols);
00395
00405 void bg_plugin_registry_set_priority(bg_plugin_registry_t * reg,
00406 const char * plugin_name,
00407 int priority);
00408
00409
00416 bg_cfg_section_t *
00417 bg_plugin_registry_get_section(bg_plugin_registry_t * reg,
00418 const char * plugin_name);
00419
00429 void bg_plugin_registry_set_parameter_info(bg_plugin_registry_t * reg,
00430 uint32_t type_mask,
00431 uint32_t flag_mask,
00432 bg_parameter_info_t * ret);
00433
00443 void bg_plugin_registry_set_parameter_info_input(bg_plugin_registry_t * reg,
00444 uint32_t type_mask,
00445 uint32_t flag_mask,
00446 bg_parameter_info_t * ret);
00447
00448
00457 void bg_plugin_registry_set_parameter_input(void * data, const char * name,
00458 const bg_parameter_value_t * val);
00459
00460 int bg_plugin_registry_get_parameter_input(void * data, const char * name,
00461 bg_parameter_value_t * val);
00462
00463
00480 bg_parameter_info_t *
00481 bg_plugin_registry_create_encoder_parameters(bg_plugin_registry_t * reg,
00482 uint32_t stream_type_mask,
00483 uint32_t flag_mask);
00484
00494 const char *
00495 bg_encoder_section_get_plugin(bg_plugin_registry_t * plugin_reg,
00496 bg_cfg_section_t * s,
00497 bg_stream_type_t stream_type,
00498 int stream_mask);
00499
00511 void
00512 bg_encoder_section_get_plugin_config(bg_plugin_registry_t * plugin_reg,
00513 bg_cfg_section_t * s,
00514 bg_stream_type_t stream_type,
00515 int stream_mask,
00516 bg_cfg_section_t ** section_ret,
00517 const bg_parameter_info_t ** params_ret);
00518
00529 void
00530 bg_encoder_section_get_stream_config(bg_plugin_registry_t * plugin_reg,
00531 bg_cfg_section_t * s,
00532 bg_stream_type_t stream_type,
00533 int stream_mask,
00534 bg_cfg_section_t ** section_ret,
00535 const bg_parameter_info_t ** params_ret);
00536
00537
00546 bg_cfg_section_t *
00547 bg_encoder_section_get_from_registry(bg_plugin_registry_t * plugin_reg,
00548 const bg_parameter_info_t * parameters,
00549 uint32_t type_mask,
00550 uint32_t flag_mask);
00551
00561 void
00562 bg_encoder_section_store_in_registry(bg_plugin_registry_t * plugin_reg,
00563 bg_cfg_section_t * s,
00564 const bg_parameter_info_t * parameters,
00565 uint32_t type_mask,
00566 uint32_t flag_mask);
00567
00568
00579 void bg_plugin_registry_set_default(bg_plugin_registry_t * reg,
00580 bg_plugin_type_t type, uint32_t flag_mask,
00581 const char * plugin_name);
00582
00591 const bg_plugin_info_t * bg_plugin_registry_get_default(bg_plugin_registry_t * reg,
00592 bg_plugin_type_t type, uint32_t flag_mask);
00593
00594
00617 void bg_plugin_registry_set_encode_audio_to_video(bg_plugin_registry_t * reg,
00618 int audio_to_video);
00619
00626 int bg_plugin_registry_get_encode_audio_to_video(bg_plugin_registry_t * reg);
00627
00634 void bg_plugin_registry_set_encode_subtitle_text_to_video(bg_plugin_registry_t * reg,
00635 int subtitle_text_to_video);
00636
00643 int bg_plugin_registry_get_encode_subtitle_text_to_video(bg_plugin_registry_t * reg);
00644
00651 void bg_plugin_registry_set_encode_subtitle_overlay_to_video(bg_plugin_registry_t * reg,
00652 int subtitle_overlay_to_video);
00653
00659 int bg_plugin_registry_get_encode_subtitle_overlay_to_video(bg_plugin_registry_t * reg);
00660
00667 void bg_plugin_registry_set_encode_pp(bg_plugin_registry_t * reg,
00668 int encode_pp);
00669
00675 int bg_plugin_registry_get_encode_pp(bg_plugin_registry_t * reg);
00676
00683 void bg_plugin_registry_set_visualize(bg_plugin_registry_t * reg,
00684 int enable);
00685
00692 int bg_plugin_registry_get_visualize(bg_plugin_registry_t * reg);
00693
00694
00703 void bg_plugin_registry_add_device(bg_plugin_registry_t * reg,
00704 const char * plugin_name,
00705 const char * device,
00706 const char * name);
00707
00720 void bg_plugin_registry_set_device_name(bg_plugin_registry_t * reg,
00721 const char * plugin_name,
00722 const char * device,
00723 const char * name);
00724
00725
00726
00736 void bg_plugin_registry_find_devices(bg_plugin_registry_t * reg,
00737 const char * plugin_name);
00738
00750 void bg_plugin_registry_remove_device(bg_plugin_registry_t * reg,
00751 const char * plugin_name,
00752 const char * device,
00753 const char * name);
00754
00766 gavl_video_frame_t * bg_plugin_registry_load_image(bg_plugin_registry_t * reg,
00767 const char * filename,
00768 gavl_video_format_t * format,
00769 bg_metadata_t * m);
00770
00771
00772
00781 void
00782 bg_plugin_registry_save_image(bg_plugin_registry_t * reg,
00783 const char * filename,
00784 gavl_video_frame_t * frame,
00785 const gavl_video_format_t * format, const bg_metadata_t * m);
00786
00787
00799 int bg_get_thumbnail(const char * gml,
00800 bg_plugin_registry_t * plugin_reg,
00801 char ** thumbnail_filename_ret,
00802 gavl_video_frame_t ** frame_ret,
00803 gavl_video_format_t * format_ret);
00804
00805
00806
00807
00808
00809
00810
00811
00812
00821 bg_plugin_handle_t * bg_plugin_load(bg_plugin_registry_t * reg,
00822 const bg_plugin_info_t * info);
00823
00834 bg_plugin_handle_t * bg_ov_plugin_load(bg_plugin_registry_t * reg,
00835 const bg_plugin_info_t * info,
00836 const char * window_id);
00837
00842 void bg_plugin_lock(bg_plugin_handle_t * h);
00843
00848 void bg_plugin_unlock(bg_plugin_handle_t * h);
00849
00850
00851
00856 void bg_plugin_ref(bg_plugin_handle_t * h);
00857
00858
00859
00867 void bg_plugin_unref(bg_plugin_handle_t * h);
00868
00880 void bg_plugin_unref_nolock(bg_plugin_handle_t * h);
00881
00893 bg_plugin_info_t * bg_plugin_info_create(const bg_plugin_common_t * plugin,
00894 void * plugin_priv,
00895 const char * module_filename);
00896
00905 bg_plugin_handle_t * bg_plugin_handle_create();
00906
00907
00908 #endif // __BG_PLUGINREGISTRY_H_