![]() |
![]() |
![]() |
GStreamer 0.10 Core Reference Manual | ![]() |
---|---|---|---|---|
GstRegistryGstRegistry — Abstract base class for management of GstPlugin objects |
#include <gst/gst.h> GstRegistry; GstRegistry* gst_registry_get_default (void); GList* gst_registry_get_feature_list (GstRegistry *registry, GType type); GList* gst_registry_get_feature_list_by_plugin (GstRegistry *registry, const gchar *name); GList* gst_registry_get_path_list (GstRegistry *registry); GList* gst_registry_get_plugin_list (GstRegistry *registry); gboolean gst_registry_add_plugin (GstRegistry *registry, GstPlugin *plugin); void gst_registry_remove_plugin (GstRegistry *registry, GstPlugin *plugin); GList* gst_registry_plugin_filter (GstRegistry *registry, GstPluginFilter filter, gboolean first, gpointer user_data); GList* gst_registry_feature_filter (GstRegistry *registry, GstPluginFeatureFilter filter, gboolean first, gpointer user_data); GstPlugin* gst_registry_find_plugin (GstRegistry *registry, const gchar *name); GstPluginFeature* gst_registry_find_feature (GstRegistry *registry, const gchar *name, GType type); GstPluginFeature* gst_registry_lookup_feature (GstRegistry *registry, const char *name); gboolean gst_registry_scan_path (GstRegistry *registry, const gchar *path); gboolean gst_registry_xml_read_cache (GstRegistry *registry, const char *location); gboolean gst_registry_xml_write_cache (GstRegistry *registry, const char *location); GstPlugin* gst_registry_lookup (GstRegistry *registry, const char *filename); void gst_registry_remove_feature (GstRegistry *registry, GstPluginFeature *feature); gboolean gst_registry_add_feature (GstRegistry *registry, GstPluginFeature *feature); gboolean gst_default_registry_check_feature_version (const gchar *feature_name, guint min_major, guint min_minor, guint min_micro); #define gst_default_registry_get_path_list() #define gst_default_registry_add_plugin (plugin) #define gst_default_registry_add_path (path) #define gst_default_registry_find_plugin(name) #define gst_default_registry_find_feature(name,type) #define gst_default_registry_get_plugin_list() #define gst_default_registry_feature_filter(filter,first,user_data)
One registry holds the metadata of a set of plugins. All registries build the GstRegistryPool.
Design:
The GstRegistry object is a list of plugins and some functions for dealing with them. GstPlugins are matched 1-1 with a file on disk, and may or may not be loaded at a given time. There may be multiple GstRegistry objects, but the "default registry" is the only object that has any meaning to the core.
The registry.xml file is actually a cache of plugin information. This is unlike versions prior to 0.10, where the registry file was the primary source of plugin information, and was created by the gst-register command.
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.xml file.
On startup, plugins are searched for in the plugin search path. This path can
be set directly using the GST_PLUGIN_PATH
environment variable. The registry
file is loaded from ~/.gstreamer-$GST_MAJORMINOR/registry-$ARCH.xml or the
file listed in the GST_REGISTRY
env var. The only 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 "default 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 intitialization.
GstRegistry* gst_registry_get_default (void);
Retrieves the default registry. The caller does not own a reference on the registry, as it is alive as long as GStreamer is initialized.
Returns : | The default GstRegistry. |
GList* gst_registry_get_feature_list (GstRegistry *registry, GType type);
Retrieves a GList of GstPluginFeature of type
.
registry
:registry
a GstRegistry
a GstRegistry
GstRegistryGstRegistrytype
:type
a GType.
a GType.
GTypeGTypeReturns :Returns a GList of GstPluginFeature of type
. gst_plugin_feature_list_free
after usage.
MT safe.
a GList of GstPluginFeature of type
. gst_plugin_feature_list_free
after usage.
MT safe.
GListGListGstPluginFeatureGstPluginFeaturetype
registry : |
a GstRegistry |
type : |
a GType. |
Returns : | a GList of GstPluginFeature of type . gst_plugin_feature_list_free
after usage.
MT safe.
|
GList* gst_registry_get_feature_list_by_plugin (GstRegistry *registry, const gchar *name);
Retrieves a GList of features of the plugin with name name
.
registry
:registry
a GstRegistry.
a GstRegistry.
GstRegistryGstRegistryname
:name
a plugin name.
a plugin name.
Returns :Returns a GList of GstPluginFeature. gst_plugin_feature_list_free()
after usage.
a GList of GstPluginFeature. gst_plugin_feature_list_free()
after usage.
GListGListGstPluginFeatureGstPluginFeaturegst_plugin_feature_list_free()
gst_plugin_feature_list_free()
registry : |
a GstRegistry. |
name : |
a plugin name. |
Returns : | a GList of GstPluginFeature. gst_plugin_feature_list_free() after usage.
|
GList* gst_registry_get_path_list (GstRegistry *registry);
Get the list of paths for the given registry.
registry
:registry
the registry to get the pathlist of
the registry to get the pathlist of
Returns :Returns A Glist of paths as strings. g_list_free after use.
MT safe.
A Glist of paths as strings. g_list_free after use.
MT safe.
registry : |
the registry to get the pathlist of |
Returns : | A Glist of paths as strings. g_list_free after use. MT safe. |
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.
registry
:registry
the registry to search
the registry to search
Returns :Returns a GList of GstPlugin. gst_plugin_list_free after use.
MT safe.
a GList of GstPlugin. gst_plugin_list_free after use.
MT safe.
GListGListGstPluginGstPlugin
registry : |
the registry to search |
Returns : | a GList of GstPlugin. gst_plugin_list_free after use. MT safe. |
gboolean gst_registry_add_plugin (GstRegistry *registry, GstPlugin *plugin);
Add the plugin to the registry. The plugin-added signal will be emitted.
This function will sink plugin
.
registry
:registry
the registry to add the plugin to
the registry to add the plugin to
plugin
:plugin
the plugin to add
the plugin to add
Returns :Returns TRUE on success.
MT safe.
TRUE on success.
MT safe.
registry : |
the registry to add the plugin to |
plugin : |
the plugin to add |
Returns : | TRUE on success. MT safe. |
void gst_registry_remove_plugin (GstRegistry *registry, GstPlugin *plugin);
Remove the plugin from the registry.
MT safe.
registry
:registry
the registry to remove the plugin from
the registry to remove the plugin from
plugin
:plugin
the plugin to remove
the plugin to remove
registry : |
the registry to remove the plugin from |
plugin : |
the plugin to remove |
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.
registry
:registry
registry to query
registry to query
filter
:filter
the filter to use
the filter to use
first
:first
only return first match
only return first match
user_data
:user_data
user data passed to the filter function
user data passed to the filter function
Returns :Returns a GList of GstPlugin. Use gst_plugin_list_free()
after usage.
MT safe.
a GList of GstPlugin. Use gst_plugin_list_free()
after usage.
MT safe.
GListGListGstPluginGstPlugingst_plugin_list_free()
gst_plugin_list_free()
registry : |
registry to query |
filter : |
the filter to use |
first : |
only return first match |
user_data : |
user data passed to the filter function |
Returns : | a GList of GstPlugin. Use gst_plugin_list_free() after usage.
MT safe.
|
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).
registry
:registry
registry to query
registry to query
filter
:filter
the filter to use
the filter to use
first
:first
only return first match
only return first match
user_data
:user_data
user data passed to the filter function
user data passed to the filter function
Returns :Returns a GList of plugin features, gst_plugin_feature_list_free after use.
MT safe.
a GList of plugin features, gst_plugin_feature_list_free after use.
MT safe.
registry : |
registry to query |
filter : |
the filter to use |
first : |
only return first match |
user_data : |
user data passed to the filter function |
Returns : | a GList of plugin features, gst_plugin_feature_list_free after use. MT safe. |
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.
registry
:registry
the registry to search
the registry to search
name
:name
the plugin name to find
the plugin name to find
Returns :Returns The plugin with the given name or NULL if the plugin was not found.
gst_object_unref()
after usage.
MT safe.
The plugin with the given name or NULL if the plugin was not found.
gst_object_unref()
after usage.
MT safe.
gst_object_unref()
gst_object_unref()
registry : |
the registry to search |
name : |
the plugin name to find |
Returns : | The plugin with the given name or NULL if the plugin was not found.
gst_object_unref() after usage.
MT safe.
|
GstPluginFeature* gst_registry_find_feature (GstRegistry *registry, const gchar *name, GType type);
Find the pluginfeature with the given name and type in the registry.
registry
:registry
the registry to search
the registry to search
name
:name
the pluginfeature name to find
the pluginfeature name to find
type
:type
the pluginfeature type to find
the pluginfeature type to find
Returns :Returns The pluginfeature with the given name and type or NULL
if the plugin was not found. gst_object_unref()
after usage.
MT safe.
The pluginfeature with the given name and type or NULL
if the plugin was not found. gst_object_unref()
after usage.
MT safe.
gst_object_unref()
gst_object_unref()
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.
|
GstPluginFeature* gst_registry_lookup_feature (GstRegistry *registry, const char *name);
Find a GstPluginFeature with name
in registry
.
registry
:registry
a GstRegistry
a GstRegistry
GstRegistryGstRegistryname
:name
a GstPluginFeature name
a GstPluginFeature name
GstPluginFeatureGstPluginFeatureReturns :Returns a GstPluginFeature with its refcount incremented, use
gst_object_unref()
after usage.
MT safe.
a GstPluginFeature with its refcount incremented, use
gst_object_unref()
after usage.
MT safe.
GstPluginFeatureGstPluginFeaturegst_object_unref()
gst_object_unref()
registry : |
a GstRegistry |
name : |
a GstPluginFeature name |
Returns : | a GstPluginFeature with its refcount incremented, use
gst_object_unref() after usage.
MT safe.
|
gboolean gst_registry_scan_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.
registry
:registry
the registry to add the path to
the registry to add the path to
path
:path
the path to add to the registry
the path to add to the registry
Returns :Returns TRUE
if registry changed
TRUE
if registry changed
TRUE
TRUE
registry : |
the registry to add the path to |
path : |
the path to add to the registry |
Returns : | TRUE if registry changed
|
gboolean gst_registry_xml_read_cache (GstRegistry *registry, const char *location);
Read the contents of the XML cache file at location
location
into registry
.
registry
:registry
a GstRegistry
a GstRegistry
GstRegistryGstRegistrylocation
:location
a filename
a filename
Returns :Returns TRUE on success.
TRUE on success.
registry : |
a GstRegistry |
location : |
a filename |
Returns : | TRUE on success. |
gboolean gst_registry_xml_write_cache (GstRegistry *registry, const char *location);
Write registry
in an XML format at the location given by
location
. Directories are automatically created.
registry
:registry
a GstRegistry
a GstRegistry
GstRegistryGstRegistrylocation
:location
a filename
a filename
Returns :Returns TRUE on success.
TRUE on success.
registry : |
a GstRegistry |
location : |
a filename |
Returns : | TRUE on success. |
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.
registry
:registry
the registry to look up in
the registry to look up in
filename
:filename
the name of the file to look up
the name of the file to look up
Returns :Returns the GstPlugin if found, or NULL if not. gst_object_unref()
after usage.
the GstPlugin if found, or NULL if not. gst_object_unref()
after usage.
GstPluginGstPlugingst_object_unref()
gst_object_unref()
registry : |
the registry to look up in |
filename : |
the name of the file to look up |
Returns : | the GstPlugin if found, or NULL if not. gst_object_unref()
after usage.
|
void gst_registry_remove_feature (GstRegistry *registry, GstPluginFeature *feature);
Remove the feature from the registry.
MT safe.
registry
:registry
the registry to remove the feature from
the registry to remove the feature from
feature
:feature
the feature to remove
the feature to remove
registry : |
the registry to remove the feature from |
feature : |
the feature to remove |
gboolean gst_registry_add_feature (GstRegistry *registry, GstPluginFeature *feature);
Add the feature to the registry. The feature-added signal will be emitted.
This function sinks feature
.
registry
:registry
the registry to add the plugin to
the registry to add the plugin to
feature
:feature
the feature to add
the feature to add
Returns :Returns TRUE on success.
MT safe.
TRUE on success.
MT safe.
registry : |
the registry to add the plugin to |
feature : |
the feature to add |
Returns : | TRUE on success. MT safe. |
gboolean gst_default_registry_check_feature_version (const gchar *feature_name, guint min_major, guint min_minor, guint min_micro);
Checks whether a plugin feature by the given name exists in the default registry and whether its version is at least the version required.
feature_name
:feature_name
the name of the feature (e.g. "oggdemux")
the name of the feature (e.g. "oggdemux")
min_major
:min_major
the minimum major version number
the minimum major version number
min_minor
:min_minor
the minimum minor version number
the minimum minor version number
min_micro
:min_micro
the minimum micro version number
the minimum micro version number
Returns :Returns TRUE if the feature could be found and the version is
the same as the required version or newer, and FALSE otherwise.
TRUE if the feature could be found and the version is
the same as the required version or newer, and FALSE otherwise.
TRUETRUEFALSEFALSE
feature_name : |
the name of the feature (e.g. "oggdemux") |
min_major : |
the minimum major version number |
min_minor : |
the minimum minor version number |
min_micro : |
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. |
#define gst_default_registry_get_path_list()
Get the list of paths for the default registry.
#define gst_default_registry_add_plugin(plugin)
Add the plugin to the default registry. The plugin-added signal will be emitted.
plugin
:plugin
the plugin to add
the plugin to add
plugin : |
the plugin to add |
#define gst_default_registry_add_path(path)
Add the given path to the default registry. The syntax of the path is specific to the registry. If the path has already been added, do nothing.
path
:path
the path to add to the registry
the path to add to the registry
path : |
the path to add to the registry |
#define gst_default_registry_find_plugin(name)
Find the plugin with the given name in the default registry. The plugin will be reffed; caller is responsible for unreffing.
name
:name
the plugin name to find
the plugin name to find
name : |
the plugin name to find |
#define gst_default_registry_find_feature(name,type)
Find the pluginfeature with the given name and type in the default registry.
name
:name
the pluginfeature name to find
the pluginfeature name to find
type
:type
the pluginfeature type to find
the pluginfeature type to find
name : |
the pluginfeature name to find |
type : |
the pluginfeature type to find |
#define gst_default_registry_get_plugin_list()
Get a copy of all plugins registered in the default registry.
#define gst_default_registry_feature_filter(filter,first,user_data)
Runs a filter against all features of the plugins in the default 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).
filter
:filter
the filter to use
the filter to use
first
:first
only return first match
only return first match
user_data
:user_data
user data passed to the filter function
user data passed to the filter function
filter : |
the filter to use |
first : |
only return first match |
user_data : |
user data passed to the filter function |