From d2d42082c3034bf28336fe434c85df460ce1c537 Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Wed, 3 Nov 2010 16:37:10 +0100 Subject: [PATCH] fakesink: Print sink-message events like a message and the GstMessage structure --- plugins/elements/gstfakesink.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index d480f92..b7b4000 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -402,14 +402,26 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event) GST_OBJECT_LOCK (sink); g_free (sink->last_message); - if ((s = gst_event_get_structure (event))) - sstr = gst_structure_to_string (s); - else - sstr = g_strdup (""); - - sink->last_message = - g_strdup_printf ("event ******* E (type: %d, %s) %p", - GST_EVENT_TYPE (event), sstr, event); + if (GST_EVENT_TYPE (event) == GST_EVENT_SINK_MESSAGE) { + GstMessage *msg; + + gst_event_parse_sink_message (event, &msg); + sstr = gst_structure_to_string (msg->structure); + sink->last_message = + g_strdup_printf ("message ******* M (type: %d, %s) %p", + GST_MESSAGE_TYPE (msg), sstr, msg); + gst_message_unref (msg); + } else { + if ((s = gst_event_get_structure (event))) { + sstr = gst_structure_to_string (s); + } else { + sstr = g_strdup (""); + } + + sink->last_message = + g_strdup_printf ("event ******* E (type: %d, %s) %p", + GST_EVENT_TYPE (event), sstr, event); + } g_free (sstr); GST_OBJECT_UNLOCK (sink); -- 2.7.4