diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2012-01-02 02:22:51 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2012-01-02 02:22:51 +0000 |
commit | ed80a5cd4b0f35c19bad786402239317e65546a5 (patch) | |
tree | fd5497a24db03caf807c506152e7ddf321c4e95f | |
parent | 2836cbee946f00f7876fb070c5385e36af92aff8 (diff) |
registry: rename gst_registry_get_default() to gst_registry_get()
It's not really a default if there is only one that can't be changed.
Should we return a ref like e.g. g_volume_monitor_get() does?
-rw-r--r-- | docs/random/porting-to-0.11.txt | 5 | ||||
-rw-r--r-- | gst/gst.c | 2 | ||||
-rw-r--r-- | gst/gstelementfactory.c | 8 | ||||
-rw-r--r-- | gst/gstplugin.c | 12 | ||||
-rw-r--r-- | gst/gstpluginfeature.c | 5 | ||||
-rw-r--r-- | gst/gstpluginloader.c | 2 | ||||
-rw-r--r-- | gst/gstregistry.c | 17 | ||||
-rw-r--r-- | gst/gstregistry.h | 2 | ||||
-rw-r--r-- | gst/gsttypefind.c | 2 | ||||
-rw-r--r-- | gst/gsttypefindfactory.c | 2 | ||||
-rw-r--r-- | gst/gsturi.c | 2 | ||||
-rw-r--r-- | libs/gst/check/gstcheck.c | 2 | ||||
-rw-r--r-- | tests/check/generic/states.c | 4 | ||||
-rw-r--r-- | tests/check/gst/gstplugin.c | 16 | ||||
-rw-r--r-- | tests/check/gst/gstregistry.c | 4 | ||||
-rw-r--r-- | tools/gst-inspect.c | 22 | ||||
-rw-r--r-- | win32/common/libgstreamer.def | 2 |
17 files changed, 57 insertions, 52 deletions
diff --git a/docs/random/porting-to-0.11.txt b/docs/random/porting-to-0.11.txt index 51e04de2d8..c31f3ad9cc 100644 --- a/docs/random/porting-to-0.11.txt +++ b/docs/random/porting-to-0.11.txt @@ -462,3 +462,8 @@ The 0.11 porting guide Set the "mode" gobject property on the control-source instead. The possible enum values have been renamed from GST_INTERPOLATE_XXX to GST_INTERPOLATION_MODE_XXX. + +* GstRegistry + + gst_registry_get_default() -> gst_registry_get() + gst_default_registry_*(...) -> gst_registry_*(gst_registry_get(), ...) @@ -842,7 +842,7 @@ gst_debug_help (void) if (!init_post (NULL, NULL, NULL, NULL)) exit (1); - list2 = gst_registry_plugin_filter (gst_registry_get_default (), + list2 = gst_registry_plugin_filter (gst_registry_get (), select_all, FALSE, NULL); /* FIXME this is gross. why don't debug have categories PluginFeatures? */ diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 2d0d8fd3b3..b405f71350 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -134,7 +134,7 @@ gst_element_factory_find (const gchar * name) g_return_val_if_fail (name != NULL, NULL); - feature = gst_registry_find_feature (gst_registry_get_default (), name, + feature = gst_registry_find_feature (gst_registry_get (), name, GST_TYPE_ELEMENT_FACTORY); if (feature) return GST_ELEMENT_FACTORY (feature); @@ -206,7 +206,7 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank, g_return_val_if_fail (name != NULL, FALSE); g_return_val_if_fail (g_type_is_a (type, GST_TYPE_ELEMENT), FALSE); - registry = gst_registry_get_default (); + registry = gst_registry_get (); /* check if feature already exists, if it exists there is no need to update it * when the registry is getting updated, outdated plugins and all their @@ -739,8 +739,8 @@ gst_element_factory_list_get_elements (GstElementFactoryListType type, data.minrank = minrank; /* get the feature list using the filter */ - result = gst_default_registry_feature_filter ((GstPluginFeatureFilter) - element_filter, FALSE, &data); + result = gst_registry_feature_filter (gst_registry_get (), + (GstPluginFeatureFilter) element_filter, FALSE, &data); /* sort on rank and name */ result = g_list_sort (result, gst_plugin_feature_rank_compare_func); diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 3d7136a533..cd60dff110 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -128,7 +128,7 @@ gst_plugin_finalize (GObject * object) /* FIXME: make registry add a weak ref instead */ #if 0 - GstRegistry *registry = gst_registry_get_default (); + GstRegistry *registry = gst_registry_get (); GList *g; for (g = registry->plugins; g; g = g->next) { if (g->data == (gpointer) plugin) { @@ -226,7 +226,7 @@ gst_plugin_register_static (gint major_version, gint minor_version, plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL); if (gst_plugin_register_func (plugin, &desc, NULL) != NULL) { GST_INFO ("registered static plugin \"%s\"", name); - res = gst_default_registry_add_plugin (plugin); + res = gst_registry_add_plugin (gst_registry_get (), plugin); GST_INFO ("added static plugin \"%s\", result: %d", name, res); } return res; @@ -296,7 +296,7 @@ gst_plugin_register_static_full (gint major_version, gint minor_version, plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL); if (gst_plugin_register_func (plugin, &desc, user_data) != NULL) { GST_INFO ("registered static plugin \"%s\"", name); - res = gst_default_registry_add_plugin (plugin); + res = gst_registry_add_plugin (gst_registry_get (), plugin); GST_INFO ("added static plugin \"%s\", result: %d", name, res); } return res; @@ -691,7 +691,7 @@ gst_plugin_load_file (const gchar * filename, GError ** error) g_return_val_if_fail (filename != NULL, NULL); - registry = gst_registry_get_default (); + registry = gst_registry_get (); g_static_mutex_lock (&gst_plugin_loading_mutex); plugin = gst_registry_lookup (registry, filename); @@ -833,7 +833,7 @@ gst_plugin_load_file (const gchar * filename, GError ** error) if (new_plugin) { gst_object_ref (plugin); - gst_default_registry_add_plugin (plugin); + gst_registry_add_plugin (gst_registry_get (), plugin); } g_static_mutex_unlock (&gst_plugin_loading_mutex); @@ -1264,7 +1264,7 @@ gst_plugin_load_by_name (const gchar * name) GError *error = NULL; GST_DEBUG ("looking up plugin %s in default registry", name); - plugin = gst_registry_find_plugin (gst_registry_get_default (), name); + plugin = gst_registry_find_plugin (gst_registry_get (), name); if (plugin) { GST_DEBUG ("loading plugin %s from file %s", name, plugin->filename); newplugin = gst_plugin_load_file (plugin->filename, &error); diff --git a/gst/gstpluginfeature.c b/gst/gstpluginfeature.c index 9263265b30..58bab7ec87 100644 --- a/gst/gstpluginfeature.c +++ b/gst/gstpluginfeature.c @@ -114,8 +114,7 @@ gst_plugin_feature_load (GstPluginFeature * feature) GST_DEBUG ("loaded plugin %s", feature->plugin_name); gst_object_unref (plugin); - real_feature = - gst_registry_lookup_feature (gst_registry_get_default (), + real_feature = gst_registry_lookup_feature (gst_registry_get (), GST_OBJECT_NAME (feature)); if (real_feature == NULL) @@ -287,7 +286,7 @@ gst_plugin_feature_check_version (GstPluginFeature * feature, GST_DEBUG ("Looking up plugin '%s' containing plugin feature '%s'", feature->plugin_name, GST_OBJECT_NAME (feature)); - registry = gst_registry_get_default (); + registry = gst_registry_get (); plugin = gst_registry_find_plugin (registry, feature->plugin_name); if (plugin) { diff --git a/gst/gstpluginloader.c b/gst/gstpluginloader.c index 8bb2df8539..4539421578 100644 --- a/gst/gstpluginloader.c +++ b/gst/gstpluginloader.c @@ -701,7 +701,7 @@ do_plugin_load (GstPluginLoader * l, const gchar * filename, guint tag) /* Now serialise the plugin details and send */ if (!_priv_gst_registry_chunks_save_plugin (&chunks, - gst_registry_get_default (), newplugin)) + gst_registry_get (), newplugin)) goto fail; /* Store where the header is, write an empty one, then write diff --git a/gst/gstregistry.c b/gst/gstregistry.c index b378e6a5c4..470d3c1f8d 100644 --- a/gst/gstregistry.c +++ b/gst/gstregistry.c @@ -317,15 +317,16 @@ gst_registry_finalize (GObject * object) } /** - * gst_registry_get_default: + * gst_registry_get: * - * Retrieves the default registry. The caller does not own a reference on the - * registry, as it is alive as long as GStreamer is initialized. + * 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. * - * Returns: (transfer none): The default #GstRegistry. + * Returns: (transfer none): the #GstRegistry. */ GstRegistry * -gst_registry_get_default (void) +gst_registry_get (void) { GstRegistry *registry; @@ -1424,7 +1425,7 @@ gst_default_registry_check_feature_version (const gchar * feature_name, GST_DEBUG ("Looking up plugin feature '%s'", feature_name); - registry = gst_registry_get_default (); + 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, @@ -1452,7 +1453,7 @@ load_plugin_func (gpointer data, gpointer user_data) if (plugin) { GST_INFO ("Loaded plugin: \"%s\"", filename); - gst_default_registry_add_plugin (plugin); + gst_registry_add_plugin (gst_registry_get (), plugin); } else { if (err) { /* Report error to user, and free error */ @@ -1655,7 +1656,7 @@ ensure_current_registry (GError ** error) gboolean do_update = TRUE; gboolean have_cache = TRUE; - default_registry = gst_registry_get_default (); + default_registry = gst_registry_get (); registry_file = g_strdup (g_getenv ("GST_REGISTRY")); if (registry_file == NULL) { registry_file = g_build_filename (g_get_user_cache_dir (), diff --git a/gst/gstregistry.h b/gst/gstregistry.h index bcbe282157..8a7576ed1b 100644 --- a/gst/gstregistry.h +++ b/gst/gstregistry.h @@ -59,7 +59,7 @@ struct _GstRegistryClass { GType gst_registry_get_type (void); -GstRegistry * gst_registry_get_default (void); +GstRegistry * gst_registry_get (void); gboolean gst_registry_scan_path (GstRegistry *registry, const gchar *path); void gst_registry_add_path (GstRegistry * registry, const gchar * path); diff --git a/gst/gsttypefind.c b/gst/gsttypefind.c index 9474c4ce68..d635388a83 100644 --- a/gst/gsttypefind.c +++ b/gst/gsttypefind.c @@ -108,7 +108,7 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank, } GST_PLUGIN_FEATURE_CAST (factory)->loaded = TRUE; - gst_registry_add_feature (gst_registry_get_default (), + gst_registry_add_feature (gst_registry_get (), GST_PLUGIN_FEATURE_CAST (factory)); return TRUE; diff --git a/gst/gsttypefindfactory.c b/gst/gsttypefindfactory.c index be461cbefd..aca0698d42 100644 --- a/gst/gsttypefindfactory.c +++ b/gst/gsttypefindfactory.c @@ -154,7 +154,7 @@ gst_type_find_factory_dispose (GObject * object) GList * gst_type_find_factory_get_list (void) { - return gst_registry_get_feature_list (gst_registry_get_default (), + return gst_registry_get_feature_list (gst_registry_get (), GST_TYPE_TYPE_FIND_FACTORY); } diff --git a/gst/gsturi.c b/gst/gsturi.c index 6d49a39ed0..5b09965b86 100644 --- a/gst/gsturi.c +++ b/gst/gsturi.c @@ -523,7 +523,7 @@ get_element_factories_from_uri_protocol (const GstURIType type, entry.type = type; entry.protocol = protocol; - possibilities = gst_registry_feature_filter (gst_registry_get_default (), + possibilities = gst_registry_feature_filter (gst_registry_get (), search_by_entry, FALSE, &entry); return possibilities; diff --git a/libs/gst/check/gstcheck.c b/libs/gst/check/gstcheck.c index 4b6210d965..83fdd19941 100644 --- a/libs/gst/check/gstcheck.c +++ b/libs/gst/check/gstcheck.c @@ -98,7 +98,7 @@ print_plugins (void) { GList *plugins, *l; - plugins = gst_default_registry_get_plugin_list (); + plugins = gst_registry_get_plugin_list (gst_registry_get ()); plugins = g_list_sort (plugins, (GCompareFunc) sort_plugins); for (l = plugins; l != NULL; l = l->next) { GstPlugin *plugin = GST_PLUGIN (l->data); diff --git a/tests/check/generic/states.c b/tests/check/generic/states.c index 4ab3442e5a..3c2ad7fa08 100644 --- a/tests/check/generic/states.c +++ b/tests/check/generic/states.c @@ -45,7 +45,7 @@ setup (void) ignorelist = g_strsplit (STATE_IGNORE_ELEMENTS, " ", 0); } - plugins = gst_registry_get_plugin_list (gst_registry_get_default ()); + plugins = gst_registry_get_plugin_list (gst_registry_get ()); for (p = plugins; p; p = p->next) { GstPlugin *plugin = p->data; @@ -54,7 +54,7 @@ setup (void) continue; features = - gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), + gst_registry_get_feature_list_by_plugin (gst_registry_get (), gst_plugin_get_name (plugin)); for (f = features; f; f = f->next) { diff --git a/tests/check/gst/gstplugin.c b/tests/check/gst/gstplugin.c index bce90a0ce4..cc7da7e79d 100644 --- a/tests/check/gst/gstplugin.c +++ b/tests/check/gst/gstplugin.c @@ -53,7 +53,7 @@ GST_START_TEST (test_registry) GList *list, *g; GstRegistry *registry; - registry = gst_registry_get_default (); + registry = gst_registry_get (); list = gst_registry_get_plugin_list (registry); for (g = list; g; g = g->next) { @@ -88,7 +88,8 @@ GST_START_TEST (test_load_coreelements) GstPlugin *unloaded_plugin; GstPlugin *loaded_plugin; - unloaded_plugin = gst_default_registry_find_plugin ("coreelements"); + unloaded_plugin = gst_registry_find_plugin (gst_registry_get (), + "coreelements"); fail_if (unloaded_plugin == NULL, "Failed to find coreelements plugin"); fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 2, "Refcount of unloaded plugin in registry initially should be 2"); @@ -117,11 +118,11 @@ GST_START_TEST (test_registry_get_plugin_list) GList *list; GstPlugin *plugin; - plugin = gst_default_registry_find_plugin ("coreelements"); + plugin = gst_registry_find_plugin (gst_registry_get (), "coreelements"); fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2, "Refcount of plugin in registry should be 2"); - list = gst_registry_get_plugin_list (gst_registry_get_default ()); + list = gst_registry_get_plugin_list (gst_registry_get ()); fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3, "Refcount of plugin in registry+list should be 3"); @@ -140,8 +141,7 @@ GST_START_TEST (test_find_plugin) { GstPlugin *plugin; - plugin = gst_registry_find_plugin (gst_registry_get_default (), - "coreelements"); + plugin = gst_registry_find_plugin (gst_registry_get (), "coreelements"); fail_if (plugin == NULL, "Failed to find coreelements plugin"); ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2); @@ -161,7 +161,7 @@ GST_START_TEST (test_find_feature) { GstPluginFeature *feature; - feature = gst_registry_find_feature (gst_registry_get_default (), + feature = gst_registry_find_feature (gst_registry_get (), "identity", GST_TYPE_ELEMENT_FACTORY); fail_if (feature == NULL, "Failed to find identity element factory"); fail_if (strcmp (feature->plugin_name, "coreelements"), @@ -222,7 +222,7 @@ GST_START_TEST (test_typefind) "Refcount of plugin in registry should be 2"); fail_if (gst_plugin_is_loaded (plugin), "Expected plugin to be unloaded"); - feature = gst_registry_find_feature (gst_registry_get_default (), + feature = gst_registry_find_feature (gst_registry_get (), "audio/x-au", GST_TYPE_TYPE_FIND_FACTORY); fail_if (feature == NULL, "Failed to find audio/x-aw typefind factory"); fail_if (feature->plugin != plugin, diff --git a/tests/check/gst/gstregistry.c b/tests/check/gst/gstregistry.c index 2487f95ec0..13d9772ebb 100644 --- a/tests/check/gst/gstregistry.c +++ b/tests/check/gst/gstregistry.c @@ -71,12 +71,12 @@ GST_START_TEST (test_registry_update) GstRegistry *registry; GList *plugins_before, *plugins_after, *l; - registry = gst_registry_get_default (); + registry = gst_registry_get (); fail_unless (registry != NULL); ASSERT_OBJECT_REFCOUNT (registry, "default registry", 1); /* refcount should still be 1 the second time */ - registry = gst_registry_get_default (); + registry = gst_registry_get (); fail_unless (registry != NULL); ASSERT_OBJECT_REFCOUNT (registry, "default registry", 1); diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 452f4fa431..b81c2e670e 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -955,7 +955,7 @@ print_blacklist (void) g_print ("%s\n", _("Blacklisted files:")); - plugins = gst_default_registry_get_plugin_list (); + plugins = gst_registry_get_plugin_list (gst_registry_get ()); for (cur = plugins; cur != NULL; cur = g_list_next (cur)) { GstPlugin *plugin = (GstPlugin *) (cur->data); if (plugin->flags & GST_PLUGIN_FLAG_BLACKLISTED) { @@ -978,7 +978,7 @@ print_element_list (gboolean print_all) int plugincount = 0, featurecount = 0, blacklistcount = 0; GList *plugins, *orig_plugins; - orig_plugins = plugins = gst_default_registry_get_plugin_list (); + orig_plugins = plugins = gst_registry_get_plugin_list (gst_registry_get ()); while (plugins) { GList *features, *orig_features; GstPlugin *plugin; @@ -993,7 +993,7 @@ print_element_list (gboolean print_all) } orig_features = features = - gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), + gst_registry_get_feature_list_by_plugin (gst_registry_get (), plugin->desc.name); while (features) { GstPluginFeature *feature; @@ -1077,13 +1077,13 @@ print_all_uri_handlers (void) { GList *plugins, *p, *features, *f; - plugins = gst_default_registry_get_plugin_list (); + plugins = gst_registry_get_plugin_list (gst_registry_get ()); for (p = plugins; p; p = p->next) { GstPlugin *plugin = (GstPlugin *) (p->data); features = - gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), + gst_registry_get_feature_list_by_plugin (gst_registry_get (), plugin->desc.name); for (f = features; f; f = f->next) { @@ -1193,7 +1193,7 @@ print_plugin_features (GstPlugin * plugin) gint num_other = 0; origlist = features = - gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), + gst_registry_get_feature_list_by_plugin (gst_registry_get (), plugin->desc.name); while (features) { @@ -1274,7 +1274,7 @@ print_element_features (const gchar * element_name) return 0; } #endif - feature = gst_default_registry_find_feature (element_name, + feature = gst_registry_find_feature (gst_registry_get (), element_name, GST_TYPE_TYPE_FIND_FACTORY); if (feature) { n_print ("%s: a typefind function\n", element_name); @@ -1314,7 +1314,7 @@ print_element_info (GstElementFactory * factory, gboolean print_names) if (GST_PLUGIN_FEATURE (factory)->plugin_name) { GstPlugin *plugin; - plugin = gst_registry_find_plugin (gst_registry_get_default (), + plugin = gst_registry_find_plugin (gst_registry_get (), GST_PLUGIN_FEATURE (factory)->plugin_name); if (plugin) { print_plugin_info (plugin); @@ -1447,7 +1447,7 @@ print_plugin_automatic_install_info (GstPlugin * plugin) plugin_name = gst_plugin_get_name (plugin); /* not interested in typefind factories, only element factories */ - features = gst_registry_get_feature_list (gst_registry_get_default (), + features = gst_registry_get_feature_list (gst_registry_get (), GST_TYPE_ELEMENT_FACTORY); for (l = features; l != NULL; l = l->next) { @@ -1476,7 +1476,7 @@ print_all_plugin_automatic_install_info (void) { GList *plugins, *orig_plugins; - orig_plugins = plugins = gst_default_registry_get_plugin_list (); + orig_plugins = plugins = gst_registry_get_plugin_list (gst_registry_get ()); while (plugins) { GstPlugin *plugin; @@ -1592,7 +1592,7 @@ main (int argc, char *argv[]) /* otherwise check if it's a plugin */ if (retval) { - plugin = gst_default_registry_find_plugin (arg); + plugin = gst_registry_find_plugin (gst_registry_get (), arg); /* if there is such a plugin, print out info */ if (plugin) { diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index e549479cec..a994767e3d 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -904,7 +904,7 @@ EXPORTS gst_registry_find_plugin gst_registry_fork_is_enabled gst_registry_fork_set_enabled - gst_registry_get_default + gst_registry_get gst_registry_get_feature_list gst_registry_get_feature_list_by_plugin gst_registry_get_feature_list_cookie |