From b78ef6baa12c1b822d7ffee5d0435a6e363e5d79 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Thu, 2 Sep 2004 16:39:14 +0000 Subject: [PATCH] added better error reporting for plugin loading Original commit message from CVS: added better error reporting for plugin loading --- docs/gst/tmpl/gstvalue.sgml | 71 ++++++++++++++++++++++++++++++--------------- gst/gst.c | 11 +++++-- gst/gstplugin.c | 5 +++- 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/docs/gst/tmpl/gstvalue.sgml b/docs/gst/tmpl/gstvalue.sgml index 27ecf0c..70e712e 100644 --- a/docs/gst/tmpl/gstvalue.sgml +++ b/docs/gst/tmpl/gstvalue.sgml @@ -17,7 +17,11 @@ GValue implementations specific to GStreamer will transform four characters into a host-endiannness guint32 fourcc: -guint32 fourcc = GST_MAKE_FOURCC ('M','J','P','G'); + + +guint32 fourcc = GST_MAKE_FOURCC ('M','J','P','G'); + + @a: the first component @@ -28,17 +32,27 @@ will transform four characters into a host-endiannness guint32 fourcc: - +Creates a fourcc from an input string. The input string should consisnt +of at least four characters (this is not checked for!). + + +guint32 fourcc = GST_STR_FOURCC("MJPG"); + + -@f: +@f: a string with four characters Can be used to properly output a fourcc (a guint32) value in a printf()-style text message. -printf ("fourcc: %" GST_FOURCC_FORMAT "\n", GST_FOURCC_ARGS (fcc)); + + +printf ("fourcc: %" GST_FOURCC_FORMAT "\n", GST_FOURCC_ARGS (fcc)); + + @@ -47,7 +61,11 @@ printf()-style text message. Can be used to properly output a fourcc (a guint32) value in a printf()-style text message. -printf ("fourcc: %" GST_FOURCC_FORMAT "\n", GST_FOURCC_ARGS (fcc)); + + +printf ("fourcc: %" GST_FOURCC_FORMAT "\n", GST_FOURCC_ARGS (fcc)); + + @fourcc: the fourcc value to print @@ -55,84 +73,88 @@ printf()-style text message. - +Checks if the give GValue contains a FOURCC value. -@x: +@x: the #GValue to check - +Checks if the give GValue contains a INT_RANGE value. -@x: +@x: the #GValue to check - +Checks if the give GValue contains a DOUBLE_RANGE value. -@x: +@x: the #GValue to check - +Checks if the give GValue contains a LIST value. -@x: +@x: the #GValue to check - +Checks if the give GValue contains a FIXED_LIST value. -@x: +@x: the #GValue to check - +Checks if the give GValue contains a CAPS value. -@x: +@x: the #GValue to check - +Checks if the give GValue contains a FRACTION value. -@x: +@x: the #GValue to check - +Indicates that the first value provided to a comparison function +(gst_value_compare()) is lesser than the second one. - +Indicates that the first value provided to a comparison function +(gst_value_compare()) is equal to the second one. - +Indicates that the first value provided to a comparison function +(gst_value_compare()) is greater than the second one. - +Indicates that the comparison function (gst_value_compare()) can not +determine a order for the two provided values. @@ -144,7 +166,8 @@ printf()-style text message. @value1: @value2: -@Returns: +@Returns: one of GST_VALUE_LESS_THAN, GST_VALUE_EQUAL, +GST_VALUE_GREATER_THAN or GST_VALUE_UNORDERED diff --git a/gst/gst.c b/gst/gst.c index d9961b3..4627f22 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -409,17 +409,24 @@ load_plugin_func (gpointer data, gpointer user_data) { GstPlugin *plugin; const gchar *filename; + GError *err = NULL; filename = (const gchar *) data; - plugin = gst_plugin_load_file (filename, NULL); + plugin = gst_plugin_load_file (filename, &err); if (plugin) { GST_INFO ("Loaded plugin: \"%s\"", filename); gst_registry_pool_add_plugin (plugin); } else { - GST_WARNING ("Failed to load plugin: \"%s\"", filename); + if (err) { + /* Report error to user, and free error */ + GST_ERROR ("Failed to load plugin: %s\n", err->message); + g_error_free (err); + } else { + GST_WARNING ("Failed to load plugin: \"%s\"", filename); + } } g_free (data); diff --git a/gst/gstplugin.c b/gst/gstplugin.c index ba1862a..170e1ba 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -32,6 +32,7 @@ #include #endif #include +#include #include "gst_private.h" @@ -324,7 +325,8 @@ gst_plugin_check_file (const gchar * filename, GError ** error) if (stat (filename, &file_status)) { g_set_error (error, GST_PLUGIN_ERROR, - GST_PLUGIN_ERROR_MODULE, "Problem opening file %s\n", filename); + GST_PLUGIN_ERROR_MODULE, "Problem accessing file %s: %s\n", filename, + strerror (errno)); return FALSE; } @@ -348,6 +350,7 @@ gst_plugin_check_file (const gchar * filename, GError ** error) return FALSE; } /* it's a plugin */ + GST_INFO ("looks like a gst plugin \"%s\"", filename); g_module_close (module); return TRUE; } -- 2.7.4