GstPlugin

Name

GstPlugin -- Dynamically loadable Elements

Synopsis


#include <gst/gst.h>


struct      GstPlugin;
gboolean    (*GstPluginInitFunc)            (GModule *module,
                                             GstPlugin *plugin);
struct      GstPluginDesc;
GstPlugin*  gst_plugin_new                  (const gchar *name,
                                             gint major,
                                             gint minor);
void        gst_plugin_set_name             (GstPlugin *plugin,
                                             const gchar *name);
const gchar* gst_plugin_get_name            (GstPlugin *plugin);
const gchar* gst_plugin_get_longname        (GstPlugin *plugin);
void        gst_plugin_set_longname         (GstPlugin *plugin,
                                             const gchar *longname);
const gchar* gst_plugin_get_filename        (GstPlugin *plugin);
gboolean    gst_plugin_is_loaded            (GstPlugin *plugin);
void        gst_plugin_load_all             (void);
gboolean    gst_plugin_load                 (const gchar *name);
gboolean    gst_plugin_load_absolute        (const gchar *name);
void        gst_plugin_add_path             (const gchar *path);
gboolean    gst_library_load                (const gchar *name);
void        gst_plugin_add_factory          (GstPlugin *plugin,
                                             GstElementFactory *factory);
void        gst_plugin_add_type             (GstPlugin *plugin,
                                             GstTypeFactory *factory);
void        gst_plugin_add_autoplugger      (GstPlugin *plugin,
                                             GstAutoplugFactory *factory);
GstPlugin*  gst_plugin_find                 (const gchar *name);
GList*      gst_plugin_get_list             (void);
GList*      gst_plugin_get_factory_list     (GstPlugin *plugin);
GList*      gst_plugin_get_type_list        (GstPlugin *plugin);
GList*      gst_plugin_get_autoplug_list    (GstPlugin *plugin);
GstElementFactory* gst_plugin_load_elementfactory
                                            (const gchar *name);
void        gst_plugin_load_typefactory     (const gchar *mime);
GstAutoplugFactory* gst_plugin_load_autoplugfactory
                                            (const gchar *name);
void        gst_plugin_load_thyself         (xmlNodePtr parent);
xmlNodePtr  gst_plugin_save_thyself         (xmlNodePtr parent);

Description

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 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.

Details

struct GstPlugin

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 */
};


GstPluginInitFunc ()

gboolean    (*GstPluginInitFunc)            (GModule *module,
                                             GstPlugin *plugin);

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.

module :The GModule it was loaded from
plugin :The plugin object that can be used to register stuff for this plugin.
Returns :A boolean indicating success or failure.


struct GstPluginDesc

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.

gint major_versionThe minor version of the gstreamer library this plugin was created with
gint minor_versionThe minor version of the gstreamer library this plugin was created with
gchar *nameThe name of the plugin
GstPluginInitFunc plugin_initThe init function of this plugin.


gst_plugin_new ()

GstPlugin*  gst_plugin_new                  (const gchar *name,
                                             gint major,
                                             gint minor);

Create a new plugin with given name.

name : name of new plugin
major : major version number of core that plugin is compatible with
minor : minor version number of core that plugin is compatible with
Returns : new plugin, or NULL if plugin couldn't be created, due to incompatible version number, or name already being allocated)


gst_plugin_set_name ()

void        gst_plugin_set_name             (GstPlugin *plugin,
                                             const gchar *name);

Sets the name (should be short) of the plugin.

plugin : plugin to set name of
name : new name


gst_plugin_get_name ()

const gchar* gst_plugin_get_name            (GstPlugin *plugin);

Get the short name of the plugin

plugin : plugin to get the name of
Returns : the name of the plugin


gst_plugin_get_longname ()

const gchar* gst_plugin_get_longname        (GstPlugin *plugin);

Get the long descriptive name of the plugin

plugin : plugin to get long name of
Returns : the long name of the plugin


gst_plugin_set_longname ()

void        gst_plugin_set_longname         (GstPlugin *plugin,
                                             const gchar *longname);

Sets the long name (should be descriptive) of the plugin.

plugin : plugin to set long name of
longname : new long name


gst_plugin_get_filename ()

const gchar* gst_plugin_get_filename        (GstPlugin *plugin);

get the filename of the plugin

plugin : plugin to get the filename of
Returns : the filename of the plugin


gst_plugin_is_loaded ()

gboolean    gst_plugin_is_loaded            (GstPlugin *plugin);

queries if the plugin is loaded into memory

plugin : plugin to query
Returns : TRUE is loaded, FALSE otherwise


gst_plugin_load_all ()

void        gst_plugin_load_all             (void);

Load all plugins in the path.


gst_plugin_load ()

gboolean    gst_plugin_load                 (const gchar *name);

Load the named plugin. Name should be given as &quot;libplugin.so&quot;.

name : name of plugin to load
Returns : whether the plugin was loaded or not


gst_plugin_load_absolute ()

gboolean    gst_plugin_load_absolute        (const gchar *name);

name : name of plugin to load
Returns : whether or not the plugin loaded


gst_plugin_add_path ()

void        gst_plugin_add_path             (const gchar *path);

Add a directory to the path searched for plugins.

path : the directory to add to the search path


gst_library_load ()

gboolean    gst_library_load                (const gchar *name);

Load the named library. Name should be given as &quot;liblibrary.so&quot;.

name : name of library to load
Returns : whether the library was loaded or not


gst_plugin_add_factory ()

void        gst_plugin_add_factory          (GstPlugin *plugin,
                                             GstElementFactory *factory);

Add factory to the list of those provided by the plugin.

plugin : plugin to add factory to
factory : factory to add


gst_plugin_add_type ()

void        gst_plugin_add_type             (GstPlugin *plugin,
                                             GstTypeFactory *factory);

Add a typefactory to the list of those provided by the plugin.

plugin : plugin to add type to
factory : the typefactory to add


gst_plugin_add_autoplugger ()

void        gst_plugin_add_autoplugger      (GstPlugin *plugin,
                                             GstAutoplugFactory *factory);

Add an autoplugfactory to the list of those provided by the plugin.

plugin : plugin to add the autoplugger to
factory : the autoplugfactory to add


gst_plugin_find ()

GstPlugin*  gst_plugin_find                 (const gchar *name);

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


gst_plugin_get_list ()

GList*      gst_plugin_get_list             (void);

get the currently loaded plugins

Returns :; a GList of GstPlugin elements


gst_plugin_get_factory_list ()

GList*      gst_plugin_get_factory_list     (GstPlugin *plugin);

get a list of all the factories that this plugin provides

plugin : the plugin to get the factories from
Returns : a GList of factories


gst_plugin_get_type_list ()

GList*      gst_plugin_get_type_list        (GstPlugin *plugin);

get a list of all the typefactories that this plugin provides

plugin : the plugin to get the typefactories from
Returns : a GList of factories


gst_plugin_get_autoplug_list ()

GList*      gst_plugin_get_autoplug_list    (GstPlugin *plugin);

get a list of all the autoplugfactories that this plugin provides

plugin : the plugin to get the autoplugfactories from
Returns : a GList of factories


gst_plugin_load_elementfactory ()

GstElementFactory* gst_plugin_load_elementfactory
                                            (const gchar *name);

Load a registered elementfactory by name.

name : name of elementfactory to load
Returns : GstElementFactory if loaded, NULL if not


gst_plugin_load_typefactory ()

void        gst_plugin_load_typefactory     (const gchar *mime);

Load a registered typefactory by mime type.

mime : name of typefactory to load


gst_plugin_load_autoplugfactory ()

GstAutoplugFactory* gst_plugin_load_autoplugfactory
                                            (const gchar *name);

Load a registered autoplugfactory by name.

name : name of autoplugfactory to load
Returns : GstAutoplugFactory if loaded, NULL if not


gst_plugin_load_thyself ()

void        gst_plugin_load_thyself         (xmlNodePtr parent);

load the plugin from an XML representation

parent : the parent node to load the plugin from


gst_plugin_save_thyself ()

xmlNodePtr  gst_plugin_save_thyself         (xmlNodePtr parent);

saves the plugin into an XML representation

parent : the parent node to save the plugin to
Returns : the new XML node

See Also

GstElement, GstType, GstAutoplug