From 675e54f1f491e065799376187db11efc24b891af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 6 Dec 2011 14:53:47 +0100 Subject: [PATCH] fakesrc: Make event/buffer verbose output consistent with identity and print buffer flags --- plugins/elements/gstfakesrc.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index 997b41a7d3..8ba1b0998b 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -445,7 +445,8 @@ gst_fake_src_event_handler (GstBaseSrc * basesrc, GstEvent * event) sstr = g_strdup (""); src->last_message = - g_strdup_printf ("event ******* E (type: %d, %s) %p", + g_strdup_printf ("event ******* (%s:%s) E (type: %d, %s) %p", + GST_DEBUG_PAD_NAME (GST_BASE_SRC_CAST (src)->srcpad), GST_EVENT_TYPE (event), sstr, event); g_free (sstr); GST_OBJECT_UNLOCK (src); @@ -827,6 +828,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, if (!src->silent) { gchar ts_str[64], dur_str[64]; + gchar flag_str[100]; GST_OBJECT_LOCK (src); g_free (src->last_message); @@ -845,12 +847,34 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, g_strlcpy (dur_str, "none", sizeof (dur_str)); } + { + const char *flag_list[12] = { + "ro", "media4", "", "", + "preroll", "discont", "incaps", "gap", + "delta_unit", "media1", "media2", "media3" + }; + int i; + char *end = flag_str; + end[0] = '\0'; + for (i = 0; i < 12; i++) { + if (GST_MINI_OBJECT_CAST (buf)->flags & (1 << i)) { + strcpy (end, flag_list[i]); + end += strlen (end); + end[0] = ' '; + end[1] = '\0'; + end++; + } + } + } + src->last_message = - g_strdup_printf ("get ******* > (%5d bytes, timestamp: %s" + g_strdup_printf ("create ******* (%s:%s) (%u bytes, timestamp: %s" ", duration: %s, offset: %" G_GINT64_FORMAT ", offset_end: %" - G_GINT64_FORMAT ", flags: %d) %p", GST_BUFFER_SIZE (buf), ts_str, - dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf), - GST_MINI_OBJECT (buf)->flags, buf); + G_GINT64_FORMAT ", flags: %d %s) %p", + GST_DEBUG_PAD_NAME (GST_BASE_SRC_CAST (src)->srcpad), + GST_BUFFER_SIZE (buf), ts_str, dur_str, GST_BUFFER_OFFSET (buf), + GST_BUFFER_OFFSET_END (buf), GST_MINI_OBJECT (buf)->flags, flag_str, + buf); GST_OBJECT_UNLOCK (src); #if !GLIB_CHECK_VERSION(2,26,0)