make -launch receive and print out errors.
authorBenjamin Otte <otte@gnome.org>
Wed, 6 Feb 2002 19:10:38 +0000 (19:10 +0000)
committerBenjamin Otte <otte@gnome.org>
Wed, 6 Feb 2002 19:10:38 +0000 (19:10 +0000)
Original commit message from CVS:
make -launch receive and print out errors.
There is also a fix to allow printing gint64 variables. This should be removed when GLib does it. Glib1.3.13 does not.

tools/gst-launch.c

index ec4306f..c1bf8ea 100644 (file)
@@ -51,7 +51,11 @@ property_change_callback (GObject *object, GstObject *orig, GParamSpec *pspec)
   if (pspec->flags & G_PARAM_READABLE) {
     g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
     g_object_get_property (G_OBJECT (orig), pspec->name, &value);
-    str = g_strdup_value_contents (&value);
+    /* fix current bug with g_strdup_value_contents not working with gint64 */
+    if (G_IS_PARAM_SPEC_INT64 (pspec))
+      str = g_strdup_printf ("%lld", g_value_get_int64 (&value));
+    else
+      str = g_strdup_value_contents (&value);
     g_print ("%s: %s = %s\n", GST_OBJECT_NAME (orig), pspec->name, str);
     g_free (str);
     g_value_unset(&value);
@@ -60,6 +64,12 @@ property_change_callback (GObject *object, GstObject *orig, GParamSpec *pspec)
   }
 }
 
+static void
+error_callback (GObject *object, GstObject *orig, gchar *error)
+{
+  g_print ("ERROR: %s: %s\n", GST_OBJECT_NAME (orig), error);
+}
+
 static GstElement*
 xmllaunch_parse_cmdline (const gchar **argv) 
 {
@@ -166,6 +176,7 @@ main(int argc, char *argv[])
   }
   
   g_signal_connect (pipeline, "deep_notify", G_CALLBACK (property_change_callback), NULL);
+  g_signal_connect (pipeline, "error", G_CALLBACK (error_callback), NULL);
   
 #ifndef GST_DISABLE_LOADSAVE
   if (save_pipeline) {