tools/gst-launch.c: Make sure that we actually show the important message part of...
authorThomas Vander Stichele <thomas@apestaart.org>
Wed, 21 Feb 2007 15:30:53 +0000 (15:30 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Wed, 21 Feb 2007 15:30:53 +0000 (15:30 +0000)
Original commit message from CVS:
* tools/gst-launch.c: (event_loop):
Make sure that we actually show the important message part of a
warning message.
No need to check if the gerror is not NULL to free; first of all
g_free accepts NULL; and second the default error handler would
segfault if gerror was NULL.

ChangeLog
tools/gst-launch.c

index efa7cef..ac471af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-02-21  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * tools/gst-launch.c: (event_loop):
+         Make sure that we actually show the important message part of a
+         warning message.
+         No need to check if the gerror is not NULL to free; first of all
+         g_free accepts NULL; and second the default error handler would
+         segfault if gerror was NULL.
+
 2007-02-21  Wim Taymans  <wim@fluendo.com>
 
        * docs/gst/gstreamer-sections.txt:
index d4a7cbf..4f9f6b1 100644 (file)
@@ -433,16 +433,16 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
       case GST_MESSAGE_WARNING:{
         GError *gerror;
         gchar *debug;
+        gchar *name = gst_object_get_path_string (GST_MESSAGE_SRC (message));
 
         gst_message_parse_warning (message, &gerror, &debug);
+        g_print (_("WARNING: from element %s: %s\n"), name, gerror->message);
         if (debug) {
-          g_print ("WARNING: Element \"%s\" warns: %s\n",
-              GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
-              debug);
+          g_print (_("Additional debug info:\n%s\n"), debug);
         }
-        if (gerror)
-          g_error_free (gerror);
+        g_error_free (gerror);
         g_free (debug);
+        g_free (name);
         break;
       }
       case GST_MESSAGE_ERROR:{
@@ -451,8 +451,7 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
 
         gst_message_parse_error (message, &gerror, &debug);
         gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
-        if (gerror)
-          g_error_free (gerror);
+        g_error_free (gerror);
         g_free (debug);
         /* we have an error */
         res = TRUE;