GStreamer Library Reference Manual (Core) | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
GStreamer is extensible so GstElements can be loaded at runtime. A plugin system can provide one or more of the following basic GStreamer objects factories:
A GstElementFactory: the components to build a pipeline.
A GstTypeFactory: A MIME type and an optional typefind function.
A GstAutoplugFactory: An object used to automatically construct pipelines.
A plugin should export a symbol plugin_desc that is a struct of type GstPluginDesc. the plugin loader will check the version of the core library the plugin was linked against and will create a new GstPlugin. It will then call the GstPluginInitFunc function that was provided in the plugin_desc.
Optionally a new plugin is created with gst_plugin_new(). this function will return a handle to the GstPlugin or NULL if the plugin could not be created.
Once you have a handle to a GstPlugin, you can add the different types of factories to it with gst_plugin_add_factory(), gst_plugin_add_type(), gst_plugin_add_autoplugger().
use gst_plugin_find(), gst_plugin_get_list(), gst_plugin_get_factory_list(), gst_plugin_get_type_list() and gst_plugin_get_autoplug_list() to query the plugin repository.
Plugins are always automaticlly loaded so you don't need to call gst_plugin_load() explicitly to bring it into memory.
struct GstPlugin { gchar *name; /* name of the plugin */ gchar *longname; /* long name of plugin */ gchar *filename; /* filename it came from */ GList *types; /* list of types provided */ gint numtypes; GList *elements; /* list of elements provided */ gint numelements; GList *autopluggers; /* list of autopluggers provided */ gint numautopluggers; gboolean loaded; /* if the plugin is in memory */ }; |
|
A plugin should provide a pointer to a function of this type in the plugin_desc struct. It will be called by the loader at statup.
struct GstPluginDesc { gint major_version; /* major version of core that plugin was compiled for */ gint minor_version; /* minor version of core that plugin was compiled for */ gchar *name; /* name of plugin */ GstPluginInitFunc plugin_init; /* pointer to plugin_init function */ }; |
A plugins should export a variable of this type called plugin_desc. This plugin loaded will use this variable to initialize the plugin.
The minor version of the gstreamer library this plugin was created with | |
The minor version of the gstreamer library this plugin was created with | |
The name of the plugin | |
GstPluginInitFunc plugin_init | The init function of this plugin. |
GstPlugin* gst_plugin_new (const |
Create a new plugin with given name.
void gst_plugin_set_name (GstPlugin *plugin, const |
Sets the name (should be short) of the plugin.
const |
Get the short name of the plugin
const |
Get the long descriptive name of the plugin
void gst_plugin_set_longname (GstPlugin *plugin, const |
Sets the long name (should be descriptive) of the plugin.
const |
get the filename of the plugin
|
queries if the plugin is loaded into memory
|
Load the named plugin. Name should be given as "libplugin.so".
void gst_plugin_add_path (const |
Add a directory to the path searched for plugins.
|
Load the named library. Name should be given as "liblibrary.so".
void gst_plugin_add_factory (GstPlugin *plugin, GstElementFactory *factory); |
Add factory to the list of those provided by the plugin.
void gst_plugin_add_type (GstPlugin *plugin, GstTypeFactory *factory); |
Add a typefactory to the list of those provided by the plugin.
void gst_plugin_add_autoplugger (GstPlugin *plugin, GstAutoplugFactory *factory); |
Add an autoplugfactory to the list of those provided by the plugin.
GstPlugin* gst_plugin_find (const |
Search the list of registered plugins for one of the given name
name : | name of plugin to find |
Returns : | pointer to the GstPlugin if found, NULL otherwise |
|
get a list of all the factories that this plugin provides
|
get a list of all the typefactories that this plugin provides
|
get a list of all the autoplugfactories that this plugin provides
GstElementFactory* gst_plugin_load_elementfactory (const |
Load a registered elementfactory by name.
void gst_plugin_load_typefactory (const |
Load a registered typefactory by mime type.
GstAutoplugFactory* gst_plugin_load_autoplugfactory (const |
Load a registered autoplugfactory by name.
void gst_plugin_load_thyself ( |
load the plugin from an XML representation