registry: Add plugins to the registry we are loading and not default one

When running gst_registry_scan_plugin_file we were losing the
information about the registry being loaded and ended up adding the
plugin to the default registry which was not correct.

https://bugzilla.gnome.org/show_bug.cgi?id=752662
This commit is contained in:
Thibault Saunier 2015-07-21 13:35:33 +02:00 committed by Nicolas Dufresne
parent e24e902d2f
commit 749810b238
3 changed files with 17 additions and 4 deletions

View file

@ -133,6 +133,10 @@ G_GNUC_INTERNAL void _priv_gst_registry_cleanup (void);
gboolean _gst_plugin_loader_client_run (void);
G_GNUC_INTERNAL GstPlugin * _priv_gst_plugin_load_file_for_registry (const gchar *filename,
GstRegistry * registry,
GError** error);
/* Used in GstBin for manual state handling */
G_GNUC_INTERNAL void _priv_gst_element_state_changed (GstElement *element,
GstState oldstate, GstState newstate, GstState pending);

View file

@ -676,6 +676,13 @@ static GMutex gst_plugin_loading_mutex;
*/
GstPlugin *
gst_plugin_load_file (const gchar * filename, GError ** error)
{
return _priv_gst_plugin_load_file_for_registry (filename, NULL, error);
}
GstPlugin *
_priv_gst_plugin_load_file_for_registry (const gchar * filename,
GstRegistry * registry, GError ** error)
{
GstPluginDesc *desc;
GstPlugin *plugin;
@ -683,13 +690,14 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
gboolean ret;
gpointer ptr;
GStatBuf file_status;
GstRegistry *registry;
gboolean new_plugin = TRUE;
GModuleFlags flags;
g_return_val_if_fail (filename != NULL, NULL);
registry = gst_registry_get ();
if (registry == NULL)
registry = gst_registry_get ();
g_mutex_lock (&gst_plugin_loading_mutex);
plugin = gst_registry_lookup (registry, filename);
@ -835,7 +843,7 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
if (new_plugin) {
gst_object_ref (plugin);
gst_registry_add_plugin (gst_registry_get (), plugin);
gst_registry_add_plugin (registry, plugin);
}
g_mutex_unlock (&gst_plugin_loading_mutex);

View file

@ -1177,7 +1177,8 @@ gst_registry_scan_plugin_file (GstRegistryScanContext * context,
/* We don't use a GError here because a failure to load some shared
* objects as plugins is normal (particularly in the uninstalled case)
*/
newplugin = gst_plugin_load_file (filename, NULL);
newplugin = _priv_gst_plugin_load_file_for_registry (filename,
context->registry, NULL);
}
if (newplugin) {