Gst.Registry

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Registry Gst.Registry Gst.Object->Gst.Registry

Subclasses:

None

Methods

Inherited:

Gst.Object (27), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

fork_is_enabled ()

class

fork_set_enabled (enabled)

class

get ()

add_feature (feature)

add_plugin (plugin)

check_feature_version (feature_name, min_major, min_minor, min_micro)

feature_filter (filter, first, *user_data)

find_feature (name, type)

find_plugin (name)

get_feature_list (type)

get_feature_list_by_plugin (name)

get_feature_list_cookie ()

get_plugin_list ()

lookup (filename)

lookup_feature (name)

plugin_filter (filter, first, *user_data)

remove_feature (feature)

remove_plugin (plugin)

scan_path (path)

Virtual Methods

Inherited:

Gst.Object (1), GObject.Object (7)

Properties

Inherited:

Gst.Object (2)

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Short Description

feature-added

Signals that a feature has been added to the registry (possibly replacing a previously-added one by the same name)

plugin-added

Signals that a plugin has been added to the registry (possibly replacing a previously-added one by the same name)

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Type

Access

Description

object

Gst.Object

r

Class Details

class Gst.Registry(**kwargs)
Bases:

Gst.Object

Abstract:

No

Structure:

Gst.RegistryClass

One registry holds the metadata of a set of plugins.

Design:

The Gst.Registry object is a list of plugins and some functions for dealing with them. Each Gst.Plugin is matched 1-1 with a file on disk, and may or may not be loaded at a given time.

The primary source, at all times, of plugin information is each plugin file itself. Thus, if an application wants information about a particular plugin, or wants to search for a feature that satisfies given criteria, the primary means of doing so is to load every plugin and look at the resulting information that is gathered in the default registry. Clearly, this is a time consuming process, so we cache information in the registry file. The format and location of the cache file is internal to gstreamer.

On startup, plugins are searched for in the plugin search path. The following locations are checked in this order:

  • location from –gst-plugin-path commandline option.

  • the GST_PLUGIN_PATH environment variable.

  • the GST_PLUGIN_SYSTEM_PATH environment variable.

  • default locations (if GST_PLUGIN_SYSTEM_PATH is not set). Those default locations are: $XDG_DATA_HOME/gstreamer-$GST_API_VERSION/plugins/ and $prefix/libs/gstreamer-$GST_API_VERSION/. $XDG_DATA_HOME defaults to $HOME/.local/share.

The registry cache file is loaded from $XDG_CACHE_HOME/gstreamer-$GST_API_VERSION/registry-$ARCH.bin (where $XDG_CACHE_HOME defaults to $HOME/.cache) or the file listed in the GST_REGISTRY env var. One reason to change the registry location is for testing.

For each plugin that is found in the plugin search path, there could be 3 possibilities for cached information:

  • the cache may not contain information about a given file.

  • the cache may have stale information.

  • the cache may have current information.

In the first two cases, the plugin is loaded and the cache updated. In addition to these cases, the cache may have entries for plugins that are not relevant to the current process. These are marked as not available to the current process. If the cache is updated for whatever reason, it is marked dirty.

A dirty cache is written out at the end of initialization. Each entry is checked to make sure the information is minimally valid. If not, the entry is simply dropped.

Implementation notes:

The “cache” and “registry” are different concepts and can represent different sets of plugins. For various reasons, at init time, the cache is stored in the default registry, and plugins not relevant to the current process are marked with the Gst.PluginFlags.CACHED bit. These plugins are removed at the end of initialization.

classmethod fork_is_enabled()[source]
Returns:

True if GStreamer will use the child helper process when rebuilding the registry.

Return type:

bool

By default GStreamer will perform scanning and rebuilding of the registry file using a helper child process.

Applications might want to disable this behaviour with the Gst.Registry.fork_set_enabled() function, in which case new plugins are scanned (and loaded) into the application process.

classmethod fork_set_enabled(enabled)[source]
Parameters:

enabled (bool) – whether rebuilding the registry can use a temporary child helper process.

Applications might want to disable/enable spawning of a child helper process when rebuilding the registry. See Gst.Registry.fork_is_enabled() for more information.

classmethod get()[source]
Returns:

the Gst.Registry.

Return type:

Gst.Registry

Retrieves the singleton plugin registry. The caller does not own a reference on the registry, as it is alive as long as GStreamer is initialized.

add_feature(feature)[source]
Parameters:

feature (Gst.PluginFeature) – the feature to add

Returns:

True on success.

MT safe.

Return type:

bool

Add the feature to the registry. The feature-added signal will be emitted.

feature's reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink())

add_plugin(plugin)[source]
Parameters:

plugin (Gst.Plugin) – the plugin to add

Returns:

True on success.

MT safe.

Return type:

bool

Add the plugin to the registry. The plugin-added signal will be emitted.

plugin's reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink())

check_feature_version(feature_name, min_major, min_minor, min_micro)[source]
Parameters:
  • feature_name (str) – the name of the feature (e.g. “oggdemux”)

  • min_major (int) – the minimum major version number

  • min_minor (int) – the minimum minor version number

  • min_micro (int) – the minimum micro version number

Returns:

True if the feature could be found and the version is the same as the required version or newer, and False otherwise.

Return type:

bool

Checks whether a plugin feature by the given name exists in self and whether its version is at least the version required.

feature_filter(filter, first, *user_data)[source]
Parameters:
Returns:

a GLib.List of Gst.PluginFeature. Use Gst.PluginFeature.list_free() after usage.

MT safe.

Return type:

[Gst.PluginFeature]

Runs a filter against all features of the plugins in the registry and returns a GLib.List with the results. If the first flag is set, only the first match is returned (as a list with a single object).

find_feature(name, type)[source]
Parameters:
  • name (str) – the pluginfeature name to find

  • type (GObject.GType) – the pluginfeature type to find

Returns:

the pluginfeature with the given name and type or None if the plugin was not found. Gst.Object.unref() after usage.

MT safe.

Return type:

Gst.PluginFeature or None

Find the pluginfeature with the given name and type in the registry.

find_plugin(name)[source]
Parameters:

name (str) – the plugin name to find

Returns:

the plugin with the given name or None if the plugin was not found. Gst.Object.unref() after usage.

MT safe.

Return type:

Gst.Plugin or None

Find the plugin with the given name in the registry. The plugin will be reffed; caller is responsible for unreffing.

get_feature_list(type)[source]
Parameters:

type (GObject.GType) – a GObject.GType.

Returns:

a GLib.List of Gst.PluginFeature of type. Use Gst.PluginFeature.list_free() after use

MT safe.

Return type:

[Gst.PluginFeature]

Retrieves a GLib.List of Gst.PluginFeature of type.

get_feature_list_by_plugin(name)[source]
Parameters:

name (str) – a plugin name.

Returns:

a GLib.List of Gst.PluginFeature. Use Gst.PluginFeature.list_free() after usage.

Return type:

[Gst.PluginFeature]

Retrieves a GLib.List of features of the plugin with name name.

Returns:

the feature list cookie.

Return type:

int

Returns the registry’s feature list cookie. This changes every time a feature is added or removed from the registry.

get_plugin_list()[source]
Returns:

a GLib.List of Gst.Plugin. Use Gst.Plugin.list_free() after usage.

MT safe.

Return type:

[Gst.Plugin]

Get a copy of all plugins registered in the given registry. The refcount of each element in the list in incremented.

lookup(filename)[source]
Parameters:

filename (str) – the name of the file to look up

Returns:

the Gst.Plugin if found, or None if not. Gst.Object.unref() after usage.

Return type:

Gst.Plugin or None

Look up a plugin in the given registry with the given filename. If found, plugin is reffed.

lookup_feature(name)[source]
Parameters:

name (str) – a Gst.PluginFeature name

Returns:

a Gst.PluginFeature with its refcount incremented, use Gst.Object.unref() after usage.

MT safe.

Return type:

Gst.PluginFeature or None

Find a Gst.PluginFeature with name in self.

plugin_filter(filter, first, *user_data)[source]
Parameters:
  • filter (Gst.PluginFilter) – the filter to use

  • first (bool) – only return first match

  • user_data (object or None) – user data passed to the filter function

Returns:

a GLib.List of Gst.Plugin. Use Gst.Plugin.list_free() after usage.

MT safe.

Return type:

[Gst.Plugin]

Runs a filter against all plugins in the registry and returns a GLib.List with the results. If the first flag is set, only the first match is returned (as a list with a single object). Every plugin is reffed; use Gst.Plugin.list_free() after use, which will unref again.

remove_feature(feature)[source]
Parameters:

feature (Gst.PluginFeature) – the feature to remove

Remove the feature from the registry.

MT safe.

remove_plugin(plugin)[source]
Parameters:

plugin (Gst.Plugin) – the plugin to remove

Remove the plugin from the registry.

MT safe.

scan_path(path)[source]
Parameters:

path (str) – the path to scan

Returns:

True if registry changed

Return type:

bool

Scan the given path for plugins to add to the registry. The syntax of the path is specific to the registry.

Signal Details

Gst.Registry.signals.feature_added(registry, feature)
Signal Name:

feature-added

Flags:

RUN_LAST

Parameters:

Signals that a feature has been added to the registry (possibly replacing a previously-added one by the same name)

Gst.Registry.signals.plugin_added(registry, plugin)
Signal Name:

plugin-added

Flags:

RUN_LAST

Parameters:
  • registry (Gst.Registry) – The object which received the signal

  • plugin (Gst.Plugin) – the plugin that has been added

Signals that a plugin has been added to the registry (possibly replacing a previously-added one by the same name)