[0.11] gstreamer: registry: get rid of gst_default_registry_*() convenience macros

Tim Müller tpm at kemper.freedesktop.org
Mon Jan 2 06:28:50 PST 2012


Module: gstreamer
Branch: 0.11
Commit: 8ff3102116baf94fd6874fccc1fc40677e7a906f
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=8ff3102116baf94fd6874fccc1fc40677e7a906f

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Mon Jan  2 02:32:49 2012 +0000

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.

---

 gst/gstregistry.c             |    9 ++--
 gst/gstregistry.h             |  112 ++---------------------------------------
 tests/check/gst/gstplugin.c   |    3 +
 win32/common/libgstreamer.def |    2 +-
 4 files changed, 13 insertions(+), 113 deletions(-)

diff --git a/gst/gstregistry.c b/gst/gstregistry.c
index 470d3c1..d4f0780 100644
--- a/gst/gstregistry.c
+++ b/gst/gstregistry.c
@@ -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,
diff --git a/gst/gstregistry.h b/gst/gstregistry.h
index 8a7576e..b7c4835 100644
--- a/gst/gstregistry.h
+++ b/gst/gstregistry.h
@@ -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
 
diff --git a/tests/check/gst/gstplugin.c b/tests/check/gst/gstplugin.c
index cc7da7e..3db1150 100644
--- a/tests/check/gst/gstplugin.c
+++ b/tests/check/gst/gstplugin.c
@@ -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",
diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def
index a994767..3f7ab8c 100644
--- a/win32/common/libgstreamer.def
+++ b/win32/common/libgstreamer.def
@@ -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



More information about the gstreamer-commits mailing list