Gst::Plugin Class Reference

A container for features loaded from a shared object module. More...

`#include <gstreamermm/plugin.h>`

Inheritance diagram for Gst::Plugin:
[legend]

## Public Types

typedef sigc::slot< bool, const Glib::RefPtr< Gst::Plugin >&> | SlotInit
| For example, bool on_plugin_init(const Glib::RefPtr<Gst::Plugin>& plugin);. More...
typedef sigc::slot< bool, const Glib::RefPtr< Gst::Plugin >&> | SlotFilter
| For example, bool on_plugin_filter(const Glib::RefPtr<Gst::Plugin>& plugin);. More...

## Public Member Functions

| Plugin (Plugin&& src) noexcept
Plugin& | operator= (Plugin&& src) noexcept
| ~Plugin () noexcept override
GstPlugin* | gobj ()
| Provides access to the underlying C GObject. More...
const GstPlugin* | gobj () const
| Provides access to the underlying C GObject. More...
GstPlugin* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::ustring | get_name () const
| Get the short name of the plugin. More...
Glib::ustring | get_description () const
| Get the long descriptive name of the plugin. More...
Glib::ustring | get_filename () const
| get the filename of the plugin More...
Glib::ustring | get_license () const
| get the license of the plugin More...
Glib::ustring | get_package () const
| get the package the plugin belongs to. More...
Glib::ustring | get_origin () const
| get the URL where the plugin comes from More...
Glib::ustring | get_source () const
| get the source module the plugin belongs to. More...
Glib::ustring | get_version () const
| get the version of the plugin More...
Glib::ustring | get_release_date_string () const
| Get the release date (and possibly time) in form of a string, if available. More...
bool | is_loaded () const
| queries if the plugin is loaded into memory More...
Gst::Structure | get_cache_data () const
| Gets the plugin specific data cache. More...
void | set_cache_data (Gst::Structure& cache_data)
| Adds plugin specific data to cache. More...
Glib::RefPtr< Gst::Plugin > | load ()
| Loads plugin. More...
void | add_dependency (const Glib::StringArrayHandle& env_vars, const Glib::StringArrayHandle& paths, const Glib::StringArrayHandle& names, Gst::PluginDependencyFlags flags)
| Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie. More...
void | add_dependency (const Glib::ustring& env_vars, const Glib::ustring& paths, const Glib::ustring& names, Gst::PluginDependencyFlags flags)
| Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie. More...
Public Member Functions inherited from Gst::Object
| Object (Object&& src) noexcept
Object& | operator= (Object&& src) noexcept
| ~Object () noexcept override
GstObject* | gobj ()
| Provides access to the underlying C GObject. More...
const GstObject* | gobj () const
| Provides access to the underlying C GObject. More...
GstObject* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
bool | is_element () const
bool | is_element_factory () const
bool | is_pad () const
bool | is_pad_template () const
bool | is_bin () const
guint32 | get_flags () const
| Returns the entire set of flags for the object. More...
bool | set_name (const Glib::ustring& name)
| Sets the name of object, or gives object a guaranteed unique name (if name is `nullptr`). More...
Glib::ustring | get_name () const
| Returns a copy of the name of object. More...
bool | set_parent (const Glib::RefPtr< Gst::Object >& parent)
| Sets the parent of object to parent. More...
Glib::RefPtr< Gst::Object > | get_parent ()
| Returns the parent of object. More...
Glib::RefPtr< const Gst::Object > | get_parent () const
| Returns the parent of object. More...
void | unparent ()
| Clear the parent of object, removing the associated reference. More...
void | set_control_rate (Gst::ClockTime control_rate)
| Change the control-rate for this object. More...
Gst::ClockTime | get_control_rate () const
| Obtain the control-rate for this object. More...
Gst::ClockTime | suggest_next_sync () const
| Returns a suggestion for timestamps where buffers should be split to get best controller results. More...
bool | sync_values (Gst::ClockTime timestamp)
| Sets the properties of the object, according to the Gst::ControlSources that (maybe) handle them and for the given timestamp. More...
void | set_control_bindings_disabled (bool disabled)
| This function is used to disable all controlled properties of the object for some time, i.e. sync_values() will do nothing. More...
bool | has_asctive_control_bindings () const
| Check if the object has an active controlled properties. More...
bool | has_ancestor (const Glib::RefPtr< const Gst::Object >& ancestor) const
| Check if object has an ancestor ancestor somewhere up in the hierarchy. More...
bool | has_as_ancestor (const Glib::RefPtr< Gst::Object >& ancestor) const
| Check if object has an ancestor ancestor somewhere up in the hierarchy. More...
bool | has_as_parent (const Glib::RefPtr< Gst::Object >& parent) const
| Check if parent is the parent of object. More...
Glib::ustring | get_path_string ()
| Generates a string describing the path of object in the object hierarchy. More...
Glib::PropertyProxy< Glib::ustring > | property_name ()
| The name of the object. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_name () const
| The name of the object. More...
Glib::PropertyProxy< Glib::RefPtr< Gst::Object > > | property_parent ()
| The parent of the object. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gst::Object > > | property_parent () const
| The parent of the object. More...
Glib::SignalProxy< void, const Glib::RefPtr< Gst::Object >&, GParamSpec*> | signal_deep_notify ()
int | get_refcount () const

## Static Public Member Functions

static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::QueryQuark | error_quark ()
| Get the error quark. More...
static Glib::RefPtr< Gst::Plugin > | load_file (const Glib::ustring& filename)
static Glib::RefPtr< Gst::Plugin > | load_by_name (const Glib::ustring& name)
| Load the named plugin. More...
static bool | register_static (int major_version, int minor_version, const Glib::ustring& name, const Glib::ustring& description, const SlotInit& init_slot, const Glib::ustring&version, const Glib::ustring& license, const Glib::ustring& source, const Glib::ustring& package, const Glib::ustring& origin)
Static Public Member Functions inherited from Gst::Object
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static bool | check_uniqueness (const Glib::ListHandle< const Gst::Object >& list, const Glib::ustring& name)
| Checks to see if there is any object named name in list. More...

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gst::Plugin > | wrap (GstPlugin* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gst::Object
Glib::RefPtr< Gst::Object > | wrap (GstObject* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members

Protected Member Functions inherited from Gst::Object
virtual void | on_deep_notify (const Glib::RefPtr< Gst::Object >& prop_object, GParamSpec* prop)
| This is a default handler for the signal signal_deep_notify(). More...

## Detailed Description

A container for features loaded from a shared object module.

GStreamer is extensible, so Gst::Element instances can be loaded at runtime. A plugin system can provide one or more of the basic GStreamer Gst::PluginFeature subclasses.

A plugin should export a symbol gst_plugin_desc that is a struct of type PluginDesc. the plugin loader will check the version of the core library the plugin was linked against and will create a new Gst::Plugin. It will then call the PluginInitFunc function that was provided in the gst_plugin_desc.

Once you have a handle to a Gst::Plugin (e.g. from the RegistryPool), you can add any object that subclasses Gst::PluginFeature.

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 load() can be needed to bring the plugin into memory.

Last reviewed on 2016-06-06 (1.8.0)

## Member Typedef Documentation

## SlotFilter

typedef sigc::slot< bool, const Glib::RefPtr<Gst::Plugin>& > Gst::Plugin::SlotFilter

For example, bool on_plugin_filter(const Glib::RefPtr<Gst::Plugin>& plugin);.

The filter function should return true if plugin is a match, false otherwise.

## SlotInit

typedef sigc::slot< bool, const Glib::RefPtr<Gst::Plugin>& > Gst::Plugin::SlotInit

For example, bool on_plugin_init(const Glib::RefPtr<Gst::Plugin>& plugin);.

The init function should return true if plugin was initialized successfully, false otherwise.

## Constructor & Destructor Documentation

## Plugin()

Gst::Plugin::Plugin | ( | Plugin&& | src | ) |

noexcept

## ~Plugin()

Gst::Plugin::~Plugin | ( |  | ) |

override noexcept

## Member Function Documentation

## add_dependency() [1/2]

void Gst::Plugin::add_dependency | ( | const Glib::StringArrayHandle & | env_vars,
|  | const Glib::StringArrayHandle & | paths,
|  | const Glib::StringArrayHandle & | names,
|  | Gst::PluginDependencyFlags | flags
| ) |  |

Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie.

the elements or typefinders associated with it).

GStreamer will re-inspect plugins with external dependencies whenever any of the external dependencies change. This is useful for plugins which wrap other plugin systems, e.g. a plugin which wraps a plugin-based visualisation library and makes visualisations available as GStreamer elements, or a codec loader which exposes elements and/or caps dependent on what external codec libraries are currently installed.

Parameters

  env_vars | `nullptr`-terminated array of environment variables affecting the feature set of the plugin (e.g. an environment variable containing paths where to look for additional modules/plugins of a library), or `nullptr`. Environment variable names may be followed by a path component which will be added to the content of the environment variable, e.g. "HOME/.mystuff/plugins".
  paths | `nullptr`-terminated array of directories/paths where dependent files may be, or `nullptr`.
  names | `nullptr`-terminated array of file names (or file name suffixes, depending on flags) to be used in combination with the paths from paths and/or the paths extracted from the environment variables in env_vars, or `nullptr`.
  flags | Optional flags, or Gst::PLUGIN_DEPENDENCY_FLAG_NONE.

## add_dependency() [2/2]

void Gst::Plugin::add_dependency | ( | const Glib::ustring & | env_vars,
|  | const Glib::ustring & | paths,
|  | const Glib::ustring & | names,
|  | Gst::PluginDependencyFlags | flags
| ) |  |

Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie.

the elements or typefinders associated with it).

GStreamer will re-inspect plugins with external dependencies whenever any of the external dependencies change. This is useful for plugins which wrap other plugin systems, e.g. a plugin which wraps a plugin-based visualisation library and makes visualisations available as GStreamer elements, or a codec loader which exposes elements and/or caps dependent on what external codec libraries are currently installed.

Convenience wrapper function for add_dependency() which takes simple strings as arguments instead of string arrays, with multiple arguments separated by predefined delimiters (see above).

Parameters

  env_vars | One or more environment variables (separated by ':', ';' or ','), or `nullptr`. Environment variable names may be followed by a path component which will be added to the content of the environment variable, e.g. "HOME/.mystuff/plugins:MYSTUFF_PLUGINS_PATH".
  paths | One ore more directory paths (separated by ':' or ';' or ','), or `nullptr`. Example: "/usr/lib/mystuff/plugins".
  names | One or more file names or file name suffixes (separated by commas), or `nullptr`.
  flags | Optional flags, or Gst::PLUGIN_DEPENDENCY_FLAG_NONE.

## error_quark()

static Glib::QueryQuark Gst::Plugin::error_quark | ( |  | ) |

static

Get the error quark.

Returns
  The error quark used in GError messages.

## get_cache_data()

Gst::Structure Gst::Plugin::get_cache_data | ( |  | ) | const

Gets the plugin specific data cache.

If it is `nullptr` there is no cached data stored. This is the case when the registry is getting rebuilt.

Returns
  The cached data as a Gst::Structure or `nullptr`.

## get_description()

Glib::ustring Gst::Plugin::get_description | ( |  | ) | const

Get the long descriptive name of the plugin.

Returns
  The long name of the plugin.

## get_filename()

Glib::ustring Gst::Plugin::get_filename | ( |  | ) | const

get the filename of the plugin

Returns
  The filename of the plugin.

## get_license()

Glib::ustring Gst::Plugin::get_license | ( |  | ) | const

get the license of the plugin

Returns
  The license of the plugin.

## get_name()

Glib::ustring Gst::Plugin::get_name | ( |  | ) | const

Get the short name of the plugin.

Returns
  The name of the plugin.

## get_origin()

Glib::ustring Gst::Plugin::get_origin | ( |  | ) | const

get the URL where the plugin comes from

Returns
  The origin of the plugin.

## get_package()

Glib::ustring Gst::Plugin::get_package | ( |  | ) | const

get the package the plugin belongs to.

Returns
  The package of the plugin.

## get_release_date_string()

Glib::ustring Gst::Plugin::get_release_date_string | ( |  | ) | const

Get the release date (and possibly time) in form of a string, if available.

For normal GStreamer plugin releases this will usually just be a date in the form of "YYYY-MM-DD", while pre-releases and builds from git may contain a time component after the date as well, in which case the string will be formatted like "YYYY-MM-DDTHH:MMZ" (e.g. "2012-04-30T09:30Z").

There may be plugins that do not have a valid release date set on them.

Returns
  The date string of the plugin, or `nullptr` if not available.

## get_source()

Glib::ustring Gst::Plugin::get_source | ( |  | ) | const

get the source module the plugin belongs to.

Returns
  The source of the plugin.

## get_type()

static GType Gst::Plugin::get_type | ( |  | ) |

static

Get the GType for this class, for use with the underlying GObject type system.

## get_version()

Glib::ustring Gst::Plugin::get_version | ( |  | ) | const

get the version of the plugin

Returns
  The version of the plugin.

## gobj() [1/2]

GstPlugin* Gst::Plugin::gobj | ( |  | ) |

inline

Provides access to the underlying C GObject.

## gobj() [2/2]

const GstPlugin* Gst::Plugin::gobj | ( |  | ) | const

inline

Provides access to the underlying C GObject.

## gobj_copy()

GstPlugin* Gst::Plugin::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## is_loaded()

bool Gst::Plugin::is_loaded | ( |  | ) | const

queries if the plugin is loaded into memory

Returns
  `true` is loaded, `false` otherwise.

## load()

Glib::RefPtr<Gst::Plugin> Gst::Plugin::load | ( |  | ) |

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;

Returns
  A reference to a loaded plugin, or `nullptr` on error.

## load_by_name()

static Glib::RefPtr<Gst::Plugin> Gst::Plugin::load_by_name | ( | const Glib::ustring & | name | ) |

static

Load the named plugin.

Refs the plugin.

Parameters

  name | Name of plugin to load.

Returns
  A reference to a loaded plugin, or `nullptr` on error.

## load_file()

static Glib::RefPtr<Gst::Plugin> Gst::Plugin::load_file | ( | const Glib::ustring & | filename | ) |

static

Exceptions

  Gst::PluginError. |

## operator=()

Plugin& Gst::Plugin::operator= | ( | Plugin&& | src | ) |

noexcept

## register_static()

static bool Gst::Plugin::register_static | ( | int | major_version,
|  | int | minor_version,
|  | const Glib::ustring & | name,
|  | const Glib::ustring & | description,
|  | const SlotInit& | init_slot,
|  | const Glib::ustring & | version,
|  | const Glib::ustring & | license,
|  | const Glib::ustring & | source,
|  | const Glib::ustring & | package,
|  | const Glib::ustring & | origin
| ) |  |

static

## set_cache_data()

void Gst::Plugin::set_cache_data | ( | Gst::Structure& | cache_data | ) |

Adds plugin specific data to cache.

Passes the ownership of the structure to the plugin.

The cache is flushed every time the registry is rebuilt.

Parameters

  cache_data | A structure containing the data to cache.

## Friends And Related Function Documentation

## wrap()

Glib::RefPtr< Gst::Plugin > wrap | ( | GstPlugin * | object,
|  | bool | take_copy = `false`
| ) |  |

related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.