debug: add pretty printer for events
authorStefan Kost <ensonic@users.sf.net>
Tue, 23 Feb 2010 21:50:36 +0000 (23:50 +0200)
committerStefan Kost <ensonic@users.sf.net>
Mon, 15 Mar 2010 07:10:05 +0000 (09:10 +0200)
Adder is using GST_PTR_FORMAT for events already, so we might actualy
implement this and print out some useful info.

gst/gstinfo.c

index 8a325c0..aebf48c 100644 (file)
@@ -641,6 +641,24 @@ gst_debug_print_object (gpointer ptr)
       }
     }
   }
+  if (GST_IS_EVENT (object)) {
+    GstEvent *event = GST_EVENT_CAST (object);
+    gchar *s, *ret;
+
+    if (event->structure) {
+      s = gst_info_structure_to_string (event->structure);
+    } else {
+      s = g_strdup ("(NULL)");
+    }
+
+    ret = g_strdup_printf ("%s event from '%s' at time %"
+        GST_TIME_FORMAT ": %s",
+        GST_EVENT_TYPE_NAME (event), (event->src != NULL) ?
+        GST_OBJECT_NAME (event->src) : "(NULL)",
+        GST_TIME_ARGS (event->timestamp), s);
+    g_free (s);
+    return ret;
+  }
 
   return g_strdup_printf ("%p", ptr);
 }