|  |  |  | GStreamer 0.10 Core Reference Manual |  | 
|---|---|---|---|---|
#include <gst/gst.h> GQuark gst_plugin_error_quark (void); #define GST_PLUGIN_ERROR enum GstPluginError; GstPlugin; GstPluginDesc; gboolean (*GstPluginInitFunc) (GstPlugin *plugin); #define GST_PLUGIN_DEFINE (major,minor,name,description,init,version,license,package,origin) #define GST_PLUGIN_DEFINE_STATIC (major,minor,name,description,init,version,license,package,origin) #define GST_LICENSE_UNKNOWN gboolean (*GstPluginFilter) (GstPlugin *plugin, gpointer user_data); const gchar* gst_plugin_get_name (GstPlugin *plugin); const gchar* gst_plugin_get_description (GstPlugin *plugin); const gchar* gst_plugin_get_filename (GstPlugin *plugin); const gchar* gst_plugin_get_license (GstPlugin *plugin); const gchar* gst_plugin_get_package (GstPlugin *plugin); const gchar* gst_plugin_get_origin (GstPlugin *plugin); const gchar* gst_plugin_get_source (GstPlugin *plugin); const gchar* gst_plugin_get_version (GstPlugin *plugin); GModule* gst_plugin_get_module (GstPlugin *plugin); gboolean gst_plugin_is_loaded (GstPlugin *plugin); gboolean gst_plugin_name_filter (GstPlugin *plugin, const gchar *name); GstPlugin* gst_plugin_load_file (const gchar *filename, GError **error); GstPlugin* gst_plugin_load (GstPlugin *plugin); GstPlugin* gst_plugin_load_by_name (const gchar *name); void gst_plugin_list_free (GList *list); gboolean gst_plugin_register_static (gint major_version, gint minor_version, const gchar *name, gchar *description, GstPluginInitFunc init_func, const gchar *version, const gchar *license, const gchar *source, const gchar *package, const gchar *origin);
GStreamer is extensible, so GstElement instances can be loaded at runtime. A plugin system can provide one or more of the basic GStreamer GstPluginFeature subclasses.
A plugin should export a symbol gst_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 gst_plugin_desc.
Once you have a handle to a GstPlugin (e.g. from the GstRegistryPool), you can add any object that subclasses GstPluginFeature.
Use gst_plugin_find_feature() and gst_plugin_get_feature_list() to find
features in a plugin.
Usually plugins are always automaticlly loaded so you don't need to call
gst_plugin_load() explicitly to bring it into memory. There are options to
statically link plugins to an app or even use GStreamer without a plugin
repository in which case gst_plugin_load() can be needed to bring the plugin
into memory.
GQuark gst_plugin_error_quark (void);
Get the error quark.
| Returns : | The error quark used in GError messages | 
#define GST_PLUGIN_ERROR gst_plugin_error_quark ()
The error message category quark
typedef enum
{
  GST_PLUGIN_ERROR_MODULE,
  GST_PLUGIN_ERROR_DEPENDENCIES,
  GST_PLUGIN_ERROR_NAME_MISMATCH
} GstPluginError;
The plugin loading errors
typedef struct {
  gint major_version;
  gint minor_version;
  const gchar *name;
  gchar *description;
  GstPluginInitFunc plugin_init;
  const gchar *version;
  const gchar *license;
  const gchar *source;
  const gchar *package;
  const gchar *origin;
  gpointer _gst_reserved[GST_PADDING];
} GstPluginDesc;
A plugin should export a variable of this type called plugin_desc. The plugin loader will use the data provided there to initialize the plugin.
The licence parameter must be one of: LGPL, GPL, QPL, GPL/QPL, MPL,
BSD, MIT/X11, Proprietary, unknown.
| gint  | the major version number of core that plugin was compiled for | 
| gint  | the minor version number of core that plugin was compiled for | 
| const gchar * | a unique name of the plugin | 
| gchar * | description of plugin | 
| GstPluginInitFunc  | pointer to the init function of this plugin. | 
| const gchar * | version of the plugin | 
| const gchar * | effective license of plugin | 
| const gchar * | source module plugin belongs to | 
| const gchar * | shipped package plugin belongs to | 
| const gchar * | URL to provider of plugin | 
| gpointer  | private, for later expansion | 
gboolean (*GstPluginInitFunc) (GstPlugin *plugin);
A plugin should provide a pointer to a function of this type in the plugin_desc struct. This function will be called by the loader at startup.
| 
 | The plugin object that can be used to register GstPluginFeatures for this plugin. | 
| Returns : | TRUEif plugin initialised successfully | 
#define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,package,origin)
This macro needs to be used to define the entry point and meta data of a plugin. One would use this macro to export a plugin, so that it can be used by other applications
| 
 | major version number of the gstreamer-core that plugin was compiled for | 
| 
 | minor version number of the gstreamer-core that plugin was compiled for | 
| 
 | short, but unique name of the plugin | 
| 
 | information about the purpose of the plugin | 
| 
 | function pointer to the plugin_init method with the signature of static gboolean plugin_init (GstPlugin * plugin). | 
| 
 | full version string (e.g. VERSION from config.h) | 
| 
 | under which licence the package has been released, e.g. GPL, LGPL. | 
| 
 | the package-name (e.g. PACKAGE_NAME from config.h) | 
| 
 | a description from where the package comes from (e.g. the homepage URL) | 
#define GST_PLUGIN_DEFINE_STATIC(major,minor,name,description,init,version,license,package,origin)
GST_PLUGIN_DEFINE_STATIC is deprecated and should not be used in newly-written code. Use gst_plugin_register_static() instead. This macro was
deprecated because it uses constructors, which is a compiler feature not
available on all compilers.
This macro needs to be used to define the entry point and meta data of a local plugin. One would use this macro to define a local plugin that can only be used by the own application.
| 
 | major version number of the gstreamer-core that plugin was compiled for | 
| 
 | minor version number of the gstreamer-core that plugin was compiled for | 
| 
 | short, but unique name of the plugin | 
| 
 | information about the purpose of the plugin | 
| 
 | function pointer to the plugin_init method with the signature of static gboolean plugin_init (GstPlugin * plugin). | 
| 
 | full version string (e.g. VERSION from config.h) | 
| 
 | under which licence the package has been released, e.g. GPL, LGPL. | 
| 
 | the package-name (e.g. PACKAGE_NAME from config.h) | 
| 
 | a description from where the package comes from (e.g. the homepage URL) | 
#define GST_LICENSE_UNKNOWN "unknown"
To be used in GST_PLUGIN_DEFINE or GST_PLUGIN_DEFINE_STATIC if usure about the licence.
gboolean (*GstPluginFilter) (GstPlugin *plugin, gpointer user_data);
A function that can be used with e.g. gst_registry_plugin_filter()
to get a list of plugins that match certain criteria.
| 
 | the plugin to check | 
| 
 | the user_data that has been passed on e.g. gst_registry_plugin_filter() | 
| Returns : | TRUE for a positive match, FALSE otherwise | 
const gchar* gst_plugin_get_name (GstPlugin *plugin);
Get the short name of the plugin
| 
 | plugin to get the name of | 
| Returns : | the name of the plugin | 
const gchar* gst_plugin_get_description (GstPlugin *plugin);
Get the long descriptive name of the plugin
| 
 | plugin to get long name of | 
| Returns : | the long name of the plugin | 
const gchar* gst_plugin_get_filename (GstPlugin *plugin);
get the filename of the plugin
| 
 | plugin to get the filename of | 
| Returns : | the filename of the plugin | 
const gchar* gst_plugin_get_license (GstPlugin *plugin);
get the license of the plugin
| 
 | plugin to get the license of | 
| Returns : | the license of the plugin | 
const gchar* gst_plugin_get_package (GstPlugin *plugin);
get the package the plugin belongs to.
| 
 | plugin to get the package of | 
| Returns : | the package of the plugin | 
const gchar* gst_plugin_get_origin (GstPlugin *plugin);
get the URL where the plugin comes from
| 
 | plugin to get the origin of | 
| Returns : | the origin of the plugin | 
const gchar* gst_plugin_get_source (GstPlugin *plugin);
get the source module the plugin belongs to.
| 
 | plugin to get the source of | 
| Returns : | the source of the plugin | 
const gchar* gst_plugin_get_version (GstPlugin *plugin);
get the version of the plugin
| 
 | plugin to get the version of | 
| Returns : | the version of the plugin | 
GModule* gst_plugin_get_module (GstPlugin *plugin);
Gets the GModule of the plugin. If the plugin isn't loaded yet, NULL is returned.
| 
 | plugin to query | 
| Returns : | module belonging to the plugin or NULL if the plugin isn't loaded yet. | 
gboolean gst_plugin_is_loaded (GstPlugin *plugin);
queries if the plugin is loaded into memory
| 
 | plugin to query | 
| Returns : | TRUE is loaded, FALSE otherwise | 
gboolean gst_plugin_name_filter (GstPlugin *plugin, const gchar *name);
A standard filter that returns TRUE when the plugin is of the given name.
| 
 | the plugin to check | 
| 
 | the name of the plugin | 
| Returns : | TRUE if the plugin is of the given name. | 
GstPlugin* gst_plugin_load_file (const gchar *filename, GError **error);
Loads the given plugin and refs it. Caller needs to unref after use.
| 
 | the plugin filename to load | 
| 
 | pointer to a NULL-valued GError | 
| Returns : | a reference to the existing loaded GstPlugin, a reference to the newly-loaded GstPlugin, or NULL if an error occurred. | 
GstPlugin* gst_plugin_load (GstPlugin *plugin);
Loads plugin. Note that the *return value* is the loaded plugin; plugin is
untouched. The normal use pattern of this function goes like this:
GstPlugin *loaded_plugin; loaded_plugin = gst_plugin_load (plugin); // presumably, we're no longer interested in the potentially-unloaded plugin gst_object_unref (plugin); plugin = loaded_plugin;
| 
 | plugin to load | 
| Returns : | A reference to a loaded plugin, or NULL on error. | 
GstPlugin* gst_plugin_load_by_name (const gchar *name);
Load the named plugin. Refs the plugin.
| 
 | name of plugin to load | 
| Returns : | A reference to a loaded plugin, or NULL on error. | 
void gst_plugin_list_free (GList *list);
Unrefs each member of list, then frees the list.
| 
 | list of GstPlugin | 
gboolean            gst_plugin_register_static          (gint major_version,
                                                         gint minor_version,
                                                         const gchar *name,
                                                         gchar *description,
                                                         GstPluginInitFunc init_func,
                                                         const gchar *version,
                                                         const gchar *license,
                                                         const gchar *source,
                                                         const gchar *package,
                                                         const gchar *origin);
Registers a static plugin, ie. a plugin which is private to an application or library and contained within the application or library (as opposed to being shipped as a separate module file).
You must make sure that GStreamer has been initialised (with gst_init() or
via gst_init_get_option_group()) before calling this function.
| 
 | the major version number of the GStreamer core that the plugin was compiled for, you can just use GST_VERSION_MAJOR here | 
| 
 | the minor version number of the GStreamer core that the plugin was compiled for, you can just use GST_VERSION_MINOR here | 
| 
 | a unique name of the plugin (ideally prefixed with an application- or library-specific namespace prefix in order to avoid name conflicts in case a similar plugin with the same name ever gets added to GStreamer) | 
| 
 | description of the plugin | 
| 
 | pointer to the init function of this plugin. | 
| 
 | version string of the plugin | 
| 
 | effective license of plugin. Must be one of the approved licenses (see GstPluginDesc above) or the plugin will not be registered. | 
| 
 | source module plugin belongs to | 
| 
 | shipped package plugin belongs to | 
| 
 | URL to provider of plugin | 
| Returns : | TRUE if the plugin was registered correctly, otherwise FALSE. | 
Since 0.10.16