mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-08 18:39:54 +00:00
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?
This commit is contained in:
parent
2836cbee94
commit
ed80a5cd4b
17 changed files with 57 additions and 52 deletions
|
@ -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? */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 (),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue