gst/: Don't print a g_warning for any failure to load a shared object.

Original commit message from CVS:
* gst/gstplugin.c: (gst_plugin_load_file):
* gst/gstregistry.c: (gst_registry_scan_path_level):
Don't print a g_warning for any failure to load a shared object.
Instead, push this down into gstplugin.c, and warn _only_ if we
failed to open the module (i.e. failure to link).
Avoids warnings on normal, working, non-plugin .so files.
This commit is contained in:
Michael Smith 2007-05-11 10:56:48 +00:00
parent a8571d4655
commit 05181a07da
3 changed files with 18 additions and 17 deletions

View file

@ -1,3 +1,12 @@
2007-05-11 Michael Smith <msmith@fluendo.com>
* gst/gstplugin.c: (gst_plugin_load_file):
* gst/gstregistry.c: (gst_registry_scan_path_level):
Don't print a g_warning for any failure to load a shared object.
Instead, push this down into gstplugin.c, and warn _only_ if we
failed to open the module (i.e. failure to link).
Avoids warnings on normal, working, non-plugin .so files.
2007-05-11 Stefan Kost <ensonic@users.sf.net> 2007-05-11 Stefan Kost <ensonic@users.sf.net>
* gst/gstplugin.c (gst_plugin_load_file): * gst/gstplugin.c (gst_plugin_load_file):

View file

@ -415,6 +415,10 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
g_set_error (error, g_set_error (error,
GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_MODULE, "Opening module failed: %s", GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_MODULE, "Opening module failed: %s",
g_module_error ()); g_module_error ());
/* If we failed to open the shared object, then it's probably because a
* plugin is linked against the wrong libraries. Print out an easy-to-see
* message in this case. */
g_warning ("Failed to load plugin: %s", g_module_error ());
goto return_error; goto return_error;
} }

View file

@ -803,7 +803,6 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
GstPlugin *plugin; GstPlugin *plugin;
GstPlugin *newplugin; GstPlugin *newplugin;
gboolean changed = FALSE; gboolean changed = FALSE;
GError *err = NULL;
dir = g_dir_open (path, 0, NULL); dir = g_dir_open (path, 0, NULL);
if (!dir) if (!dir)
@ -882,19 +881,15 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
G_GINT64_FORMAT, plugin->file_mtime, file_status.st_mtime, G_GINT64_FORMAT, plugin->file_mtime, file_status.st_mtime,
(gint64) plugin->file_size, (gint64) file_status.st_size); (gint64) plugin->file_size, (gint64) file_status.st_size);
gst_registry_remove_plugin (gst_registry_get_default (), plugin); gst_registry_remove_plugin (gst_registry_get_default (), plugin);
newplugin = gst_plugin_load_file (filename, &err); /* 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);
if (newplugin) { if (newplugin) {
GST_DEBUG_OBJECT (registry, "marking new plugin %p as registered", GST_DEBUG_OBJECT (registry, "marking new plugin %p as registered",
newplugin); newplugin);
newplugin->registered = TRUE; newplugin->registered = TRUE;
gst_object_unref (newplugin); 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; changed = TRUE;
} }
@ -902,18 +897,11 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
} else { } else {
GST_DEBUG_OBJECT (registry, "file %s not yet in registry", filename); GST_DEBUG_OBJECT (registry, "file %s not yet in registry", filename);
newplugin = gst_plugin_load_file (filename, &err); newplugin = gst_plugin_load_file (filename, NULL);
if (newplugin) { if (newplugin) {
newplugin->registered = TRUE; newplugin->registered = TRUE;
gst_object_unref (newplugin); gst_object_unref (newplugin);
changed = TRUE; 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;
}
} }
} }