debug: add pretty printer for events

Adder is using GST_PTR_FORMAT for events already, so we might actualy
implement this and print out some useful info.
This commit is contained in:
Stefan Kost 2010-02-23 23:50:36 +02:00
parent 7c1d33a8a3
commit 0765d4b812

View 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); return g_strdup_printf ("%p", ptr);
} }