registry: get rid of gst_default_registry_*() convenience macros

They're not really worth it: hardly save any typing, and aren't
great for bindings or gobject-introspection.
This commit is contained in:
Tim-Philipp Müller 2012-01-02 02:32:49 +00:00
parent ed80a5cd4b
commit 8ff3102116
4 changed files with 13 additions and 113 deletions

View file

@ -1400,7 +1400,7 @@ _priv_gst_registry_cleanup (void)
}
/**
* gst_default_registry_check_feature_version:
* gst_registry_check_feature_version:
* @feature_name: the name of the feature (e.g. "oggdemux")
* @min_major: the minimum major version number
* @min_minor: the minimum minor version number
@ -1414,18 +1414,17 @@ _priv_gst_registry_cleanup (void)
* the same as the required version or newer, and #FALSE otherwise.
*/
gboolean
gst_default_registry_check_feature_version (const gchar * feature_name,
guint min_major, guint min_minor, guint min_micro)
gst_registry_check_feature_version (GstRegistry * registry,
const gchar * feature_name, guint min_major, guint min_minor,
guint min_micro)
{
GstPluginFeature *feature;
GstRegistry *registry;
gboolean ret = FALSE;
g_return_val_if_fail (feature_name != NULL, FALSE);
GST_DEBUG ("Looking up plugin feature '%s'", feature_name);
registry = gst_registry_get ();
feature = gst_registry_lookup_feature (registry, feature_name);
if (feature) {
ret = gst_plugin_feature_check_version (feature, min_major, min_minor,

View file

@ -90,113 +90,11 @@ GstPluginFeature* gst_registry_find_feature (GstRegistry *registry,
GstPlugin * gst_registry_lookup (GstRegistry *registry, const char *filename);
GstPluginFeature * gst_registry_lookup_feature (GstRegistry *registry, const char *name);
/* convinience defines for the default registry */
/**
* gst_default_registry_add_plugin:
* @plugin: (transfer full): the plugin to add
*
* Add the plugin to the default registry.
* The plugin-added signal will be emitted.
*
* Returns: TRUE on success.
*/
#define gst_default_registry_add_plugin(plugin) \
gst_registry_add_plugin (gst_registry_get_default(), plugin)
/**
* gst_default_registry_add_path:
* @path: the path to add to the registry
*
* 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.
*/
#define gst_default_registry_add_path(path) \
gst_registry_add_path (gst_registry_get_default(), path)
/**
* gst_default_registry_get_path_list:
*
* Get the list of paths for the default registry.
*
* Returns: (transfer container) (element-type char*): a #GList of paths as
* strings. g_list_free() after use.
*/
#define gst_default_registry_get_path_list() \
gst_registry_get_path_list (gst_registry_get_default())
/**
* gst_default_registry_get_plugin_list:
*
* Get a copy of all plugins registered in the default registry.
*
* Returns: (transfer full) (element-type Gst.Plugin): a copy of the list.
* Free after use.
*/
#define gst_default_registry_get_plugin_list() \
gst_registry_get_plugin_list (gst_registry_get_default())
/**
* gst_default_registry_find_feature:
* @name: the pluginfeature name to find
* @type: the pluginfeature type to find
*
* Find the pluginfeature with the given name and type in the default registry.
*
* Returns: (transfer full): the pluginfeature with the given name and type or
* NULL if the plugin was not found.
*/
#define gst_default_registry_find_feature(name,type) \
gst_registry_find_feature (gst_registry_get_default(),name,type)
/**
* gst_default_registry_find_plugin:
* @name: the plugin name to find
*
* Find the plugin with the given name in the default registry.
* The plugin will be reffed; caller is responsible for unreffing.
*
* Returns: (transfer full): The plugin with the given name or NULL if the
* plugin was not found.
*/
#define gst_default_registry_find_plugin(name) \
gst_registry_find_plugin (gst_registry_get_default(),name)
/**
* gst_default_registry_feature_filter:
* @filter: the filter to use
* @first: only return first match
* @user_data: user data passed to the filter function
*
* 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).
*
* Returns: (transfer full) (element-type Gst.PluginFeature): a #GList of
* plugin features, gst_plugin_feature_list_free after use.
*/
#define gst_default_registry_feature_filter(filter,first,user_data) \
gst_registry_feature_filter (gst_registry_get_default(),filter,first,user_data)
/**
* gst_default_registry_get_feature_list_cookie:
*
* Returns the default registrys feature list cookie. This changes
* every time a feature is added or removed from the registry.
*
* Returns: the feature list cookie.
*
* Since: 0.10.26
*/
#define gst_default_registry_get_feature_list_cookie() \
gst_registry_get_feature_list_cookie (gst_registry_get_default())
gboolean gst_default_registry_check_feature_version (const gchar *feature_name,
guint min_major,
guint min_minor,
guint min_micro);
gboolean gst_registry_check_feature_version (GstRegistry *registry,
const gchar *feature_name,
guint min_major,
guint min_minor,
guint min_micro);
G_END_DECLS

View file

@ -245,6 +245,9 @@ GST_START_TEST (test_typefind)
GST_END_TEST;
#endif
#define gst_default_registry_check_feature_version(name,a,b,c) \
gst_registry_check_feature_version(gst_registry_get(),(name),(a),(b),(c))
GST_START_TEST (test_version_checks)
{
fail_if (gst_default_registry_check_feature_version ("identity",

View file

@ -316,7 +316,6 @@ EXPORTS
gst_debug_set_default_threshold
gst_debug_set_threshold_for_name
gst_debug_unset_threshold_for_name
gst_default_registry_check_feature_version
gst_deinit
gst_double_range_get_type
gst_element_abort_state
@ -899,6 +898,7 @@ EXPORTS
gst_registry_add_feature
gst_registry_add_path
gst_registry_add_plugin
gst_registry_check_feature_version
gst_registry_feature_filter
gst_registry_find_feature
gst_registry_find_plugin