Plugin registry

Database of all installed plugins. More...

Data Structures

struct  bg_plugin_info_s
 Information about a plugin. More...
struct  bg_plugin_handle_s
 Handle of a loaded plugin. More...

Modules

 Defaults saved between sessions
 

Plugin defaults.


Typedefs

typedef struct bg_plugin_info_s bg_plugin_info_t
 Typedef for plugin info.
typedef struct bg_plugin_registry_s bg_plugin_registry_t
 Opaque handle for a plugin registry.
typedef struct bg_plugin_handle_s bg_plugin_handle_t
 Typedef for plugin handle.

Enumerations

enum  bg_plugin_api_t {
  BG_PLUGIN_API_GMERLIN = 0,
  BG_PLUGIN_API_LADSPA,
  BG_PLUGIN_API_LV,
  BG_PLUGIN_API_FREI0R
}
 

Identifiers for plugin APIs.

More...

Functions

bg_plugin_registry_tbg_plugin_registry_create (bg_cfg_section_t *section)
 Create a plugin registry.
void bg_plugin_registry_destroy (bg_plugin_registry_t *reg)
 Destroy a plugin registry.
int bg_plugin_registry_get_num_plugins (bg_plugin_registry_t *reg, uint32_t type_mask, uint32_t flag_mask)
 Count plugins.
const bg_plugin_info_tbg_plugin_find_by_index (bg_plugin_registry_t *reg, int index, uint32_t type_mask, uint32_t flag_mask)
 Find a plugin by index.
const bg_plugin_info_tbg_plugin_find_by_name (bg_plugin_registry_t *reg, const char *name)
 Find a plugin by it's unique short name.
const bg_plugin_info_tbg_plugin_find_by_filename (bg_plugin_registry_t *reg, const char *filename, int type_mask)
 Find a plugin by the file extension.
const bg_plugin_info_tbg_plugin_find_by_protocol (bg_plugin_registry_t *reg, const char *protocol)
 Find an input plugin for a network protocol.
char ** bg_plugin_registry_get_plugins (bg_plugin_registry_t *reg, uint32_t type_mask, uint32_t flag_mask)
 Get a list of plugins.
void bg_plugin_registry_free_plugins (char **plugins)
 Free a plugin list.
int bg_input_plugin_load (bg_plugin_registry_t *reg, const char *location, const bg_plugin_info_t *info, bg_plugin_handle_t **ret, bg_input_callbacks_t *callbacks, int prefer_edl)
 Load and open an input plugin.
int bg_input_plugin_load_edl (bg_plugin_registry_t *reg, const bg_edl_t *edl, const bg_plugin_info_t *info, bg_plugin_handle_t **ret, bg_input_callbacks_t *callbacks)
 Load and open an edl decoder.
void bg_plugin_registry_set_extensions (bg_plugin_registry_t *reg, const char *plugin_name, const char *extensions)
 Set file extensions for a plugin.
void bg_plugin_registry_set_protocols (bg_plugin_registry_t *reg, const char *plugin_name, const char *protocols)
 Set protocols for a plugin.
void bg_plugin_registry_set_priority (bg_plugin_registry_t *reg, const char *plugin_name, int priority)
 Set priority for a plugin.
bg_cfg_section_tbg_plugin_registry_get_section (bg_plugin_registry_t *reg, const char *plugin_name)
 Get the config section belonging to a plugin.
void bg_plugin_registry_set_parameter_info (bg_plugin_registry_t *reg, uint32_t type_mask, uint32_t flag_mask, bg_parameter_info_t *ret)
 Set a parameter info for selecting and configuring plugins.
void bg_plugin_registry_add_device (bg_plugin_registry_t *reg, const char *plugin_name, const char *device, const char *name)
 Add a device to a plugin.
void bg_plugin_registry_set_device_name (bg_plugin_registry_t *reg, const char *plugin_name, const char *device, const char *name)
 Change the name of a device.
void bg_plugin_registry_find_devices (bg_plugin_registry_t *reg, const char *plugin_name)
 Let a plugin rescan for devices.
void bg_plugin_registry_remove_device (bg_plugin_registry_t *reg, const char *plugin_name, const char *device, const char *name)
 Remove a device.
gavl_video_frame_tbg_plugin_registry_load_image (bg_plugin_registry_t *reg, const char *filename, gavl_video_format_t *format, bg_metadata_t *m)
 Load an image.
void bg_plugin_registry_save_image (bg_plugin_registry_t *reg, const char *filename, gavl_video_frame_t *frame, const gavl_video_format_t *format, const bg_metadata_t *m)
 Save an image.
bg_plugin_handle_tbg_plugin_load (bg_plugin_registry_t *reg, const bg_plugin_info_t *info)
 Load a plugin.
bg_plugin_handle_tbg_ov_plugin_load (bg_plugin_registry_t *reg, const bg_plugin_info_t *info, const char *window_id)
 Load a video output plugin.
void bg_plugin_lock (bg_plugin_handle_t *h)
 Lock a plugin.
void bg_plugin_unlock (bg_plugin_handle_t *h)
 Unlock a plugin.
void bg_plugin_ref (bg_plugin_handle_t *h)
 Increase the reference count.
void bg_plugin_unref (bg_plugin_handle_t *h)
 Decrease the reference count.
void bg_plugin_unref_nolock (bg_plugin_handle_t *h)
 Decrease the reference count without locking.
int bg_plugin_equal (bg_plugin_handle_t *h1, bg_plugin_handle_t *h2)
 Check if 2 plugins are equal.

Detailed Description

Database of all installed plugins.

The plugin registry keeps informations about all installed plugins. Furthermore, it manages default plugins and some other settings. Available plugins are cached in the file $HOME/.gmerlin/plugins.xml, which is used by all applications. Application specific data are stored in a bg_cfg_section_t.

It allows you to search for plugins according to certain criteria. You get detailed information about plugins in bg_plugin_info_t structs.


Typedef Documentation

Typedef for plugin info.

typedef struct bg_plugin_registry_s bg_plugin_registry_t

Opaque handle for a plugin registry.

You don't want to know, what's inside here.

Typedef for plugin handle.


Enumeration Type Documentation

Identifiers for plugin APIs.

Enumerator:
BG_PLUGIN_API_GMERLIN 

Always 0 so native plugins can leave this empty.

BG_PLUGIN_API_LADSPA 

Ladspa API.

BG_PLUGIN_API_LV 

Libvisual.

BG_PLUGIN_API_FREI0R 

frei0r


Function Documentation

bg_plugin_registry_t* bg_plugin_registry_create ( bg_cfg_section_t section  ) 

Create a plugin registry.

Parameters:
section A configuration section

The configuration section will be owned exclusively by the plugin registry, applications should not touch it.

void bg_plugin_registry_destroy ( bg_plugin_registry_t reg  ) 

Destroy a plugin registry.

Parameters:
reg A plugin registry
int bg_plugin_registry_get_num_plugins ( bg_plugin_registry_t reg,
uint32_t  type_mask,
uint32_t  flag_mask 
)

Count plugins.

Parameters:
reg A plugin registry
type_mask Mask of all types you want to have
flag_mask Mask of all flags you want to have
Returns:
Number of available plugins matching type_mask and flag_mask
const bg_plugin_info_t* bg_plugin_find_by_index ( bg_plugin_registry_t reg,
int  index,
uint32_t  type_mask,
uint32_t  flag_mask 
)

Find a plugin by index.

Parameters:
reg A plugin registry
index Index
type_mask Mask of all types you want to have
flag_mask Mask of all flags you want to have
Returns:
A plugin info or NULL

This function should be called after bg_plugin_registry_get_num_plugins to get a particular plugin

const bg_plugin_info_t* bg_plugin_find_by_name ( bg_plugin_registry_t reg,
const char *  name 
)

Find a plugin by it's unique short name.

Parameters:
reg A plugin registry
name The name
Returns:
A plugin info or NULL
const bg_plugin_info_t* bg_plugin_find_by_filename ( bg_plugin_registry_t reg,
const char *  filename,
int  type_mask 
)

Find a plugin by the file extension.

Parameters:
reg A plugin registry
filename The file, whose extension should match
type_mask Mask of plugin types to be returned
Returns:
A plugin info or NULL

This function returns the first plugin matching type_mask, whose extensions match filename.

const bg_plugin_info_t* bg_plugin_find_by_protocol ( bg_plugin_registry_t reg,
const char *  protocol 
)

Find an input plugin for a network protocol.

Parameters:
reg A plugin registry
protocol The network protocol (e.g. http)
Returns:
A plugin info or NULL
char** bg_plugin_registry_get_plugins ( bg_plugin_registry_t reg,
uint32_t  type_mask,
uint32_t  flag_mask 
)

Get a list of plugins.

Parameters:
reg A plugin registry
type_mask Mask of all returned plugin types
flag_mask Mask of all returned plugin flags
Returns:
A NULL-terminated list of plugin names.

This functions returns plugin names suitable for adding to GUI menus. Use bg_plugin_find_by_name to get the corresponding plugin infos.

Use bg_plugin_registry_free_plugins to free the returned list.

void bg_plugin_registry_free_plugins ( char **  plugins  ) 

Free a plugin list.

Parameters:
plugins List returned by bg_plugin_registry_get_plugins
int bg_input_plugin_load ( bg_plugin_registry_t reg,
const char *  location,
const bg_plugin_info_t info,
bg_plugin_handle_t **  ret,
bg_input_callbacks_t callbacks,
int  prefer_edl 
)

Load and open an input plugin.

Parameters:
reg A plugin registry
location Filename or URL
info Plugin to use (can be NULL for autodetection)
ret Will return the plugin handle.
callbacks Input callbacks (only for authentication)
prefer_edl If 1 EDLs are preferred over raw streams
Returns:
1 on success, 0 on error.

This is a convenience function to load an input file. If info is NULL, the plugin will be autodetected. The handle is stored in ret. If ret is non-null before the call, the old plugin will be unrefed.

int bg_input_plugin_load_edl ( bg_plugin_registry_t reg,
const bg_edl_t edl,
const bg_plugin_info_t info,
bg_plugin_handle_t **  ret,
bg_input_callbacks_t callbacks 
)

Load and open an edl decoder.

Parameters:
reg A plugin registry
edl The edl to open
info Plugin to use (can be NULL for autodetection)
ret Will return the plugin handle.
callbacks Input callbacks (only for authentication)
Returns:
1 on success, 0 on error.

This is a convenience function to load an input file. If info is NULL, the plugin will be autodetected. The handle is stored in ret. If ret is non-null before the call, the old plugin will be unrefed.

void bg_plugin_registry_set_extensions ( bg_plugin_registry_t reg,
const char *  plugin_name,
const char *  extensions 
)

Set file extensions for a plugin.

Parameters:
reg A plugin registry
plugin_name Name of the plugin
extensions Space separated list of file extensions

The extensions will be saved in the plugin file

void bg_plugin_registry_set_protocols ( bg_plugin_registry_t reg,
const char *  plugin_name,
const char *  protocols 
)

Set protocols for a plugin.

Parameters:
reg A plugin registry
plugin_name Name of the plugin
protocols Space separated list of protocols

The protocols will be saved in the plugin file

void bg_plugin_registry_set_priority ( bg_plugin_registry_t reg,
const char *  plugin_name,
int  priority 
)

Set priority for a plugin.

Parameters:
reg A plugin registry
plugin_name Name of the plugin
priority Priority (BG_PLUGIN_PRIORITY_MIN..BG_PLUGIN_PRIORITY_MAX, should be 1..10)

The priority will be saved in the plugin file

bg_cfg_section_t* bg_plugin_registry_get_section ( bg_plugin_registry_t reg,
const char *  plugin_name 
)

Get the config section belonging to a plugin.

Parameters:
reg A plugin registry
plugin_name Short name of the plugin
Returns:
The config section belonging to the plugin or NULL
void bg_plugin_registry_set_parameter_info ( bg_plugin_registry_t reg,
uint32_t  type_mask,
uint32_t  flag_mask,
bg_parameter_info_t ret 
)

Set a parameter info for selecting and configuring plugins.

Parameters:
reg A plugin registry
type_mask Mask of all returned types
flag_mask Mask of all returned flags
ret Where the parameter info will be copied
void bg_plugin_registry_add_device ( bg_plugin_registry_t reg,
const char *  plugin_name,
const char *  device,
const char *  name 
)

Add a device to a plugin.

Parameters:
reg A plugin registry
plugin_name Name of the plugin
device Device file
name Name for the device
void bg_plugin_registry_set_device_name ( bg_plugin_registry_t reg,
const char *  plugin_name,
const char *  device,
const char *  name 
)

Change the name of a device.

Parameters:
reg A plugin registry
plugin_name Name of the plugin
device Device file name
name New name for the device

Usually, plugins are quite smart in getting the name (Vendor, Model etc) of devices from the OS. In the case, you want to change names of a device use this function

void bg_plugin_registry_find_devices ( bg_plugin_registry_t reg,
const char *  plugin_name 
)

Let a plugin rescan for devices.

Parameters:
reg A plugin registry
plugin_name Name of the plugin

This will let the plugin rescan for devices. Call this, after you changed your hardware.

void bg_plugin_registry_remove_device ( bg_plugin_registry_t reg,
const char *  plugin_name,
const char *  device,
const char *  name 
)

Remove a device.

Parameters:
reg A plugin registry
plugin_name Name of the plugin
device Device file name
name New name for the device

Remove a device from the list of devices. Call this if a plugin detected a device multiple times.

gavl_video_frame_t* bg_plugin_registry_load_image ( bg_plugin_registry_t reg,
const char *  filename,
gavl_video_format_t format,
bg_metadata_t m 
)

Load an image.

Parameters:
reg A plugin registry
filename Image filename
format Returns format of the image
Returns:
The frame, which contains the image

Use gavl_video_frame_destroy to free the return value

void bg_plugin_registry_save_image ( bg_plugin_registry_t reg,
const char *  filename,
gavl_video_frame_t frame,
const gavl_video_format_t format,
const bg_metadata_t m 
)

Save an image.

Parameters:
reg A plugin registry
filename Image filename
frame The frame, which contains the image
format Returns format of the image
bg_plugin_handle_t* bg_plugin_load ( bg_plugin_registry_t reg,
const bg_plugin_info_t info 
)

Load a plugin.

Parameters:
reg A plugin registry
info The plugin info

Load a plugin and return handle with reference count of 1

bg_plugin_handle_t* bg_ov_plugin_load ( bg_plugin_registry_t reg,
const bg_plugin_info_t info,
const char *  window_id 
)

Load a video output plugin.

Parameters:
reg A plugin registry
info The plugin info
window_id The window ID or NULL

Load a video output plugin for embedding into an already existing window and return handle with reference count of 1

void bg_plugin_lock ( bg_plugin_handle_t h  ) 

Lock a plugin.

Parameters:
h A plugin handle
void bg_plugin_unlock ( bg_plugin_handle_t h  ) 

Unlock a plugin.

Parameters:
h A plugin handle
void bg_plugin_ref ( bg_plugin_handle_t h  ) 

Increase the reference count.

Parameters:
h A plugin handle
void bg_plugin_unref ( bg_plugin_handle_t h  ) 

Decrease the reference count.

Parameters:
h A plugin handle

If the reference count gets zero, the plugin will be destroyed

void bg_plugin_unref_nolock ( bg_plugin_handle_t h  ) 

Decrease the reference count without locking.

Parameters:
h A plugin handle

Use this *only* if you know for sure, that the plugin is already locked and no other thread waits for the plugin to be unlocked. If the reference count gets zero, the plugin will be destroyed

int bg_plugin_equal ( bg_plugin_handle_t h1,
bg_plugin_handle_t h2 
)

Check if 2 plugins are equal.

Parameters:
h1 A Plugin handle
h2 Another plugin handle
Returns:
1 if the plugins are equal, 0 else
Generated on Sat Apr 24 15:29:53 2010 for gmerlin by  doxygen 1.6.3