diff --git a/plugins/elements/gstelements_private.c b/plugins/elements/gstelements_private.c index cba04b1b7f..2c0ca580ac 100644 --- a/plugins/elements/gstelements_private.c +++ b/plugins/elements/gstelements_private.c @@ -52,7 +52,7 @@ G_STATIC_ASSERT ((1 << BUFFER_FLAG_SHIFT) == GST_MINI_OBJECT_FLAG_LAST); /* Returns a newly allocated string describing the flags on this buffer */ -char * +gchar * gst_buffer_get_flags_string (GstBuffer * buffer) { static const char flag_strings[] = @@ -84,6 +84,28 @@ gst_buffer_get_flags_string (GstBuffer * buffer) return flag_str; } +/* Returns a newly-allocated string describing the metas on this buffer, or NULL */ +gchar * +gst_buffer_get_meta_string (GstBuffer * buffer) +{ + gpointer state = NULL; + GstMeta *meta; + GString *s = NULL; + + while ((meta = gst_buffer_iterate_meta (buffer, &state))) { + const gchar *desc = g_type_name (meta->info->type); + + if (s == NULL) + s = g_string_new (NULL); + else + g_string_append (s, ", "); + + g_string_append (s, desc); + } + + return (s != NULL) ? g_string_free (s, FALSE) : NULL; +} + /* Define our own iovec structure here, so that we can use it unconditionally * in the code below and use almost the same code path for systems where * writev() is supported and those were it's not supported */ diff --git a/plugins/elements/gstelements_private.h b/plugins/elements/gstelements_private.h index d6a89081f1..d196594059 100644 --- a/plugins/elements/gstelements_private.h +++ b/plugins/elements/gstelements_private.h @@ -28,7 +28,10 @@ G_BEGIN_DECLS G_GNUC_INTERNAL -char * gst_buffer_get_flags_string (GstBuffer *buffer); +gchar * gst_buffer_get_flags_string (GstBuffer *buffer); + +G_GNUC_INTERNAL +gchar * gst_buffer_get_meta_string (GstBuffer * buffer); G_GNUC_INTERNAL GstFlowReturn gst_writev_buffers (GstObject * sink, gint fd, GstPoll * fdset, diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index 9f75e48864..0c7e84a550 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -448,7 +448,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf) if (!sink->silent) { gchar dts_str[64], pts_str[64], dur_str[64]; - gchar *flag_str; + gchar *flag_str, *meta_str; GST_OBJECT_LOCK (sink); g_free (sink->last_message); @@ -475,16 +475,19 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf) } flag_str = gst_buffer_get_flags_string (buf); + meta_str = gst_buffer_get_meta_string (buf); sink->last_message = g_strdup_printf ("chain ******* (%s:%s) (%u bytes, dts: %s, pts: %s" ", duration: %s, offset: %" G_GINT64_FORMAT ", offset_end: %" - G_GINT64_FORMAT ", flags: %08x %s) %p", + G_GINT64_FORMAT ", flags: %08x %s, meta: %s) %p", GST_DEBUG_PAD_NAME (GST_BASE_SINK_CAST (sink)->sinkpad), (guint) gst_buffer_get_size (buf), dts_str, pts_str, dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf), - GST_MINI_OBJECT_CAST (buf)->flags, flag_str, buf); + GST_MINI_OBJECT_CAST (buf)->flags, flag_str, + meta_str ? meta_str : "none", buf); g_free (flag_str); + g_free (meta_str); GST_OBJECT_UNLOCK (sink); gst_fake_sink_notify_last_message (sink); diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index e05ff1e319..58e5b3b5f7 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -537,23 +537,24 @@ gst_identity_update_last_message_for_buffer (GstIdentity * identity, const gchar * action, GstBuffer * buf, gsize size) { gchar dts_str[64], pts_str[64], dur_str[64]; - gchar *flag_str; + gchar *flag_str, *meta_str; GST_OBJECT_LOCK (identity); flag_str = gst_buffer_get_flags_string (buf); + meta_str = gst_buffer_get_meta_string (buf); g_free (identity->last_message); identity->last_message = g_strdup_printf ("%s ******* (%s:%s) " "(%" G_GSIZE_FORMAT " bytes, dts: %s, pts: %s, duration: %s, offset: %" G_GINT64_FORMAT ", " "offset_end: % " G_GINT64_FORMAT - ", flags: %08x %s) %p", action, + ", flags: %08x %s, meta: %s) %p", action, GST_DEBUG_PAD_NAME (GST_BASE_TRANSFORM_CAST (identity)->sinkpad), size, print_pretty_time (dts_str, sizeof (dts_str), GST_BUFFER_DTS (buf)), print_pretty_time (pts_str, sizeof (pts_str), GST_BUFFER_PTS (buf)), print_pretty_time (dur_str, sizeof (dur_str), GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf), - GST_BUFFER_FLAGS (buf), flag_str, buf); + GST_BUFFER_FLAGS (buf), flag_str, meta_str ? meta_str : "none", buf); g_free (flag_str); GST_OBJECT_UNLOCK (identity);