Gst.Registry¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Signals that a feature has been added to the registry (possibly replacing a previously-added one by the same name) |
|
Signals that a plugin has been added to the registry (possibly replacing a previously-added one by the same name) |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
object |
r |
Class Details¶
- class Gst.Registry(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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. EachGst.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 theGST_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:
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:
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:
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:
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:
- Returns:
True
if the feature could be found and the version is the same as the required version or newer, andFalse
otherwise.- Return type:
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:
filter (
Gst.PluginFeatureFilter
) – the filter to usefirst (
bool
) – only return first matchuser_data (
object
orNone
) – user data passed to the filter function
- Returns:
a
GLib.List
ofGst.PluginFeature
. UseGst.PluginFeature.list_free
() after usage.MT safe.
- Return type:
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 findtype (
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:
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
orNone
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
) – aGObject.GType
.- Returns:
a
GLib.List
ofGst.PluginFeature
of type. UseGst.PluginFeature.list_free
() after useMT safe.
- Return type:
Retrieves a
GLib.List
ofGst.PluginFeature
of type.
- get_feature_list_by_plugin(name)[source]¶
- Parameters:
name (
str
) – a plugin name.- Returns:
a
GLib.List
ofGst.PluginFeature
. UseGst.PluginFeature.list_free
() after usage.- Return type:
Retrieves a
GLib.List
of features of the plugin with name name.
- get_feature_list_cookie()[source]¶
- Returns:
the feature list cookie.
- Return type:
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
ofGst.Plugin
. UseGst.Plugin.list_free
() after usage.MT safe.
- Return type:
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, orNone
if not.Gst.Object.unref
() after usage.- Return type:
Gst.Plugin
orNone
Look up a plugin in the given registry with the given filename. If found, plugin is reffed.
- lookup_feature(name)[source]¶
- Parameters:
name (
str
) – aGst.PluginFeature
name- Returns:
a
Gst.PluginFeature
with its refcount incremented, useGst.Object.unref
() after usage.MT safe.
- Return type:
Find a
Gst.PluginFeature
with name in self.
- plugin_filter(filter, first, *user_data)[source]¶
- Parameters:
filter (
Gst.PluginFilter
) – the filter to usefirst (
bool
) – only return first matchuser_data (
object
orNone
) – user data passed to the filter function
- Returns:
a
GLib.List
ofGst.Plugin
. UseGst.Plugin.list_free
() after usage.MT safe.
- Return type:
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; useGst.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.
Signal Details¶
- Gst.Registry.signals.feature_added(registry, feature)¶
- Signal Name:
feature-added
- Flags:
- Parameters:
registry (
Gst.Registry
) – The object which received the signalfeature (
Gst.PluginFeature
) – the feature that has been added
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:
- Parameters:
registry (
Gst.Registry
) – The object which received the signalplugin (
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)