diff options
author | Thibault Saunier <tsaunier@gnome.org> | 2015-07-21 13:35:33 +0200 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2015-08-05 17:32:00 -0400 |
commit | 749810b238396c608c6992d3fb6745f892df4541 (patch) | |
tree | bc909f9dcef81faf775268b61cfd52a17cacf467 /gst | |
parent | e24e902d2faea6cfa59ea5152ad65939c6f97f62 (diff) |
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
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gst_private.h | 4 | ||||
-rw-r--r-- | gst/gstplugin.c | 14 | ||||
-rw-r--r-- | gst/gstregistry.c | 3 |
3 files changed, 17 insertions, 4 deletions
diff --git a/gst/gst_private.h b/gst/gst_private.h index 044feada0..6de9013ec 100644 --- a/gst/gst_private.h +++ b/gst/gst_private.h @@ -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); diff --git a/gst/gstplugin.c b/gst/gstplugin.c index ba3dd6028..4b7a14005 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -677,19 +677,27 @@ 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; GModule *module; 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); diff --git a/gst/gstregistry.c b/gst/gstregistry.c index 27a3f76e9..090f81409 100644 --- a/gst/gstregistry.c +++ b/gst/gstregistry.c @@ -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) { |