Top |
GstRegistryGstRegistry — Abstract base class for management of GstPlugin objects |
Functions
Description
One registry holds the metadata of a set of plugins.
Design:
The GstRegistry object is a list of plugins and some functions for dealing with them. Each GstPlugin 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_PLUGIN_FLAG_CACHED
bit. These plugins are
removed at the end of initialization.
Functions
gst_registry_get ()
GstRegistry *
gst_registry_get (void
);
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.
gst_registry_get_feature_list ()
GList * gst_registry_get_feature_list (GstRegistry *registry
,GType type
);
Retrieves a GList of GstPluginFeature of type
.
Returns
a GList of
GstPluginFeature of type
. Use gst_plugin_feature_list_free()
after use
MT safe.
[transfer full][element-type Gst.PluginFeature]
gst_registry_get_feature_list_cookie ()
guint32
gst_registry_get_feature_list_cookie (GstRegistry *registry
);
Returns the registry's feature list cookie. This changes every time a feature is added or removed from the registry.
gst_registry_get_feature_list_by_plugin ()
GList * gst_registry_get_feature_list_by_plugin (GstRegistry *registry
,const gchar *name
);
Retrieves a GList of features of the plugin with name name
.
Returns
a GList of
GstPluginFeature. Use gst_plugin_feature_list_free()
after usage.
[transfer full][element-type Gst.PluginFeature]
gst_registry_get_plugin_list ()
GList *
gst_registry_get_plugin_list (GstRegistry *registry
);
Get a copy of all plugins registered in the given registry. The refcount of each element in the list in incremented.
Returns
a GList of GstPlugin.
Use gst_plugin_list_free()
after usage.
MT safe.
[transfer full][element-type Gst.Plugin]
gst_registry_add_plugin ()
gboolean gst_registry_add_plugin (GstRegistry *registry
,GstPlugin *plugin
);
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()
)
gst_registry_remove_plugin ()
void gst_registry_remove_plugin (GstRegistry *registry
,GstPlugin *plugin
);
Remove the plugin from the registry.
MT safe.
gst_registry_plugin_filter ()
GList * gst_registry_plugin_filter (GstRegistry *registry
,GstPluginFilter filter
,gboolean first
,gpointer user_data
);
Runs a filter against all plugins in the registry and returns a GList 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.
Parameters
registry |
registry to query |
|
filter |
the filter to use. |
[scope call] |
first |
only return first match |
|
user_data |
user data passed to the filter function. |
[closure] |
Returns
a GList of GstPlugin.
Use gst_plugin_list_free()
after usage.
MT safe.
[transfer full][element-type Gst.Plugin]
gst_registry_feature_filter ()
GList * gst_registry_feature_filter (GstRegistry *registry
,GstPluginFeatureFilter filter
,gboolean first
,gpointer user_data
);
Runs a filter against all features of the plugins in the registry and returns a GList with the results. If the first flag is set, only the first match is returned (as a list with a single object).
Parameters
registry |
registry to query |
|
filter |
the filter to use. |
[scope call] |
first |
only return first match |
|
user_data |
user data passed to the filter function. |
[closure] |
Returns
a GList of
GstPluginFeature. Use gst_plugin_feature_list_free()
after usage.
MT safe.
[transfer full][element-type Gst.PluginFeature]
gst_registry_find_plugin ()
GstPlugin * gst_registry_find_plugin (GstRegistry *registry
,const gchar *name
);
Find the plugin with the given name in the registry. The plugin will be reffed; caller is responsible for unreffing.
Returns
the plugin with the given name
or NULL
if the plugin was not found. gst_object_unref()
after
usage.
MT safe.
[transfer full][nullable]
gst_registry_find_feature ()
GstPluginFeature * gst_registry_find_feature (GstRegistry *registry
,const gchar *name
,GType type
);
Find the pluginfeature with the given name and type in the registry.
Parameters
registry |
the registry to search |
|
name |
the pluginfeature name to find |
|
type |
the pluginfeature type to find |
Returns
the pluginfeature with the
given name and type or NULL
if the plugin was not
found. gst_object_unref()
after usage.
MT safe.
[transfer full][nullable]
gst_registry_lookup_feature ()
GstPluginFeature * gst_registry_lookup_feature (GstRegistry *registry
,const char *name
);
Find a GstPluginFeature with name
in registry
.
Returns
a GstPluginFeature with its refcount incremented,
use gst_object_unref()
after usage.
MT safe.
[transfer full]
gst_registry_add_path ()
void gst_registry_add_path (GstRegistry *registry
,const gchar *path
);
Add the given path to the registry. The syntax of the path is specific to the registry. If the path has already been added, do nothing.
gst_registry_get_path_list ()
GList *
gst_registry_get_path_list (GstRegistry *registry
);
Get the list of paths for the given registry.
Returns
A GList of paths as strings. g_list_free after use.
MT safe.
[transfer container][element-type char*]
gst_registry_scan_path ()
gboolean gst_registry_scan_path (GstRegistry *registry
,const gchar *path
);
Scan the given path for plugins to add to the registry. The syntax of the path is specific to the registry.
gst_registry_lookup ()
GstPlugin * gst_registry_lookup (GstRegistry *registry
,const char *filename
);
Look up a plugin in the given registry with the given filename. If found, plugin is reffed.
Returns
the GstPlugin if found, or
NULL
if not. gst_object_unref()
after usage.
[transfer full][nullable]
gst_registry_remove_feature ()
void gst_registry_remove_feature (GstRegistry *registry
,GstPluginFeature *feature
);
Remove the feature from the registry.
MT safe.
gst_registry_add_feature ()
gboolean gst_registry_add_feature (GstRegistry *registry
,GstPluginFeature *feature
);
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()
)
gst_registry_check_feature_version ()
gboolean gst_registry_check_feature_version (GstRegistry *registry
,const gchar *feature_name
,guint min_major
,guint min_minor
,guint min_micro
);
Checks whether a plugin feature by the given name exists in
registry
and whether its version is at least the
version required.
Signal Details
The “feature-added”
signal
void user_function (GstRegistry *registry, GstPluginFeature *feature, gpointer user_data)
Signals that a feature has been added to the registry (possibly replacing a previously-added one by the same name)
Parameters
registry |
the registry that emitted the signal |
|
feature |
the feature that has been added |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “plugin-added”
signal
void user_function (GstRegistry *registry, GstPlugin *plugin, gpointer user_data)
Signals that a plugin has been added to the registry (possibly replacing a previously-added one by the same name)
Parameters
registry |
the registry that emitted the signal |
|
plugin |
the plugin that has been added |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last