From a8571d4655efbd9197a1f9aa0242140ae08a78fa Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Fri, 11 May 2007 08:29:10 +0000 Subject: [PATCH] gst/gstplugin.c (gst_plugin_load_file): gst/gstregistry.c (GST_CAT_DEFAULT, gst_registry_lookup_feature_locked, gst_r... Original commit message from CVS: * gst/gstplugin.c (gst_plugin_load_file): * gst/gstregistry.c (GST_CAT_DEFAULT, gst_registry_lookup_feature_locked, gst_registry_scan_path_level): Print a g_warning if there was an error when loading a plugins during registry scan. The shuld help beginners starting with gst-plugin template. --- ChangeLog | 9 +++++++++ gst/gstplugin.c | 3 ++- gst/gstregistry.c | 27 +++++++++++++++++++++------ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b36fb5..2a0686f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-05-11 Stefan Kost + + * gst/gstplugin.c (gst_plugin_load_file): + * gst/gstregistry.c (GST_CAT_DEFAULT, + gst_registry_lookup_feature_locked, gst_registry_scan_path_level): + Print a g_warning if there was an error when loading a plugins during + registry scan. The shuld help beginners starting with gst-plugin + template. + 2007-05-10 Wim Taymans * plugins/elements/gstqueue.c: (gst_queue_class_init), diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 1a77940..f75ea50 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -413,7 +413,8 @@ gst_plugin_load_file (const gchar * filename, GError ** error) GST_CAT_WARNING (GST_CAT_PLUGIN_LOADING, "module_open failed: %s", g_module_error ()); g_set_error (error, - GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_MODULE, "Opening module failed"); + GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_MODULE, "Opening module failed: %s", + g_module_error ()); goto return_error; } diff --git a/gst/gstregistry.c b/gst/gstregistry.c index a94d109..7846799 100644 --- a/gst/gstregistry.c +++ b/gst/gstregistry.c @@ -28,7 +28,7 @@ * * One registry holds the metadata of a set of plugins. * All registries build the #GstRegistryPool. - * + * * Design: * * The #GstRegistry object is a list of plugins and some functions for dealing @@ -109,7 +109,7 @@ #define GST_CAT_DEFAULT GST_CAT_REGISTRY -/* the one instance of the default registry and the mutex protecting the +/* the one instance of the default registry and the mutex protecting the * variable. */ static GStaticMutex _gst_registry_mutex = G_STATIC_MUTEX_INIT; static GstRegistry *_gst_registry_default = NULL; @@ -718,7 +718,7 @@ gst_registry_lookup_feature_locked (GstRegistry * registry, const char *name) * @name: a #GstPluginFeature name * * Find a #GstPluginFeature with @name in @registry. - * + * * Returns: a #GstPluginFeature with its refcount incremented, use * gst_object_unref() after usage. * @@ -803,6 +803,7 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path, GstPlugin *plugin; GstPlugin *newplugin; gboolean changed = FALSE; + GError *err = NULL; dir = g_dir_open (path, 0, NULL); if (!dir) @@ -867,7 +868,7 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path, GST_LOG_OBJECT (registry, "marking plugin %p as registered as %s", plugin, filename); plugin->registered = TRUE; - /* Update the file path on which we've seen this cached plugin + /* Update the file path on which we've seen this cached plugin * to ensure the registry cache will reflect up to date information */ if (strcmp (plugin->filename, filename) != 0) { g_free (plugin->filename); @@ -881,12 +882,19 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path, G_GINT64_FORMAT, plugin->file_mtime, file_status.st_mtime, (gint64) plugin->file_size, (gint64) file_status.st_size); gst_registry_remove_plugin (gst_registry_get_default (), plugin); - newplugin = gst_plugin_load_file (filename, NULL); + newplugin = gst_plugin_load_file (filename, &err); if (newplugin) { GST_DEBUG_OBJECT (registry, "marking new plugin %p as registered", newplugin); newplugin->registered = TRUE; gst_object_unref (newplugin); + } else { + if (err) { + /* Report error to user, and free error */ + g_warning ("Failed to load plugin: %s", err->message); + g_error_free (err); + err = NULL; + } } changed = TRUE; } @@ -894,11 +902,18 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path, } else { GST_DEBUG_OBJECT (registry, "file %s not yet in registry", filename); - newplugin = gst_plugin_load_file (filename, NULL); + newplugin = gst_plugin_load_file (filename, &err); if (newplugin) { newplugin->registered = TRUE; gst_object_unref (newplugin); changed = TRUE; + } else { + if (err) { + /* Report error to user, and free error */ + g_warning ("Failed to load plugin: %s", err->message); + g_error_free (err); + err = NULL; + } } } -- 2.7.4