From 138bb17bf9d47de8318302dc15aba1803f81aa6f Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Fri, 7 Oct 2011 16:36:10 +0200 Subject: [PATCH] GST_PTR_FORMAT: Add GstBuffer ptr format and use in GST_SCHEDULING GstBuffer pointers can now be printed using GST_PTR_FORMAT. This is used in the very useful GST_SCHEDULING debug logs in gstpad.c and allows for easier and more information tracking of buffer progress through a pipeline with just debug logging. --- gst/gstinfo.c | 17 +++++++++++++++++ gst/gstpad.c | 12 ++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 83ab86b767..266feed04a 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -632,6 +632,23 @@ gst_debug_print_object (gpointer ptr) if (*(GType *) ptr == GST_TYPE_STRUCTURE) { return gst_info_structure_to_string ((GstStructure *) ptr); } + if (GST_IS_BUFFER (ptr)) { + GstBuffer *buf = (GstBuffer *) ptr; + gchar *caps, *ret; + + caps = gst_caps_to_string (GST_BUFFER_CAPS (buf)); + ret = + g_strdup_printf ("%p, data %p, malloc %p, ts %" GST_TIME_FORMAT + ", dur %" GST_TIME_FORMAT ", size %u, offset %" G_GUINT64_FORMAT + ", offset_end %" G_GUINT64_FORMAT ", caps: %s", buf, + GST_BUFFER_DATA (buf), GST_BUFFER_MALLOCDATA (buf), + GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), + GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_SIZE (buf), + GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf), caps); + + g_free (caps); + return ret; + } #ifdef USE_POISONING if (*(guint32 *) ptr == 0xffffffff) { return g_strdup_printf ("", ptr); diff --git a/gst/gstpad.c b/gst/gstpad.c index 1f666508a5..a0040f82f9 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -4258,10 +4258,8 @@ gst_pad_chain_data_unchecked (GstPad * pad, gboolean is_buffer, void *data, goto no_function; GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, - "calling chainfunction &%s with %s buffer %p, ts %" GST_TIME_FORMAT, - GST_DEBUG_FUNCPTR_NAME (chainfunc), - (caps) ? gst_structure_get_name (gst_caps_get_structure (caps, 0)) : "", - GST_BUFFER (data), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); + "calling chainfunction &%s with buffer %" GST_PTR_FORMAT, + GST_DEBUG_FUNCPTR_NAME (chainfunc), GST_BUFFER (data)); if (cache) { cache->peer = gst_object_ref (pad); @@ -4704,10 +4702,8 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer) goto invalid; GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, - "calling chainfunction &%s with %s buffer %p, ts %" GST_TIME_FORMAT, - GST_DEBUG_FUNCPTR_NAME (GST_PAD_CHAINFUNC (peer)), - (caps) ? gst_structure_get_name (gst_caps_get_structure (caps, 0)) : "", - GST_BUFFER (buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer))); + "calling chainfunction &%s with buffer %" GST_PTR_FORMAT, + GST_DEBUG_FUNCPTR_NAME (GST_PAD_CHAINFUNC (peer)), buffer); ret = GST_PAD_CHAINFUNC (peer) (peer, buffer);