[prev in list] [next in list] [prev in thread] [next in thread]
List: gstreamer-cvs
Subject: [gst-cvs] gstreamer: identity: print unset buffer timestamps or
From: tpm () kemper ! freedesktop ! org (Tim Müller)
Date: 2011-01-28 20:00:36
Message-ID: 20110128200036.70852F80B4 () kemper ! freedesktop ! org
[Download RAW message or body]
Module: gstreamer
Branch: master
Commit: 5c778e25a538def05da61bcd7eed6aa8584bce19
URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=5c778e25a538def05da61bcd7eed6aa8584bce19
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date: Thu Jan 27 09:28:07 2011 +0000
identity: print unset buffer timestamps or durations as 'none'
Like fakesink and fakesrc do.
---
plugins/elements/gstidentity.c | 62 +++++++++++++++++++++++----------------
1 files changed, 36 insertions(+), 26 deletions(-)
diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c
index 8dc0643..9929533 100644
--- a/plugins/elements/gstidentity.c
+++ b/plugins/elements/gstidentity.c
@@ -548,6 +548,40 @@ gst_identity_check_imperfect_offset (GstIdentity * identity, \
GstBuffer * buf) }
}
+static const gchar *
+print_pretty_time (gchar * ts_str, gsize ts_str_len, GstClockTime ts)
+{
+ if (ts == GST_CLOCK_TIME_NONE)
+ return "none";
+
+ g_snprintf (ts_str, ts_str_len, "%" GST_TIME_FORMAT, GST_TIME_ARGS (ts));
+ return ts_str;
+}
+
+static void
+gst_identity_update_last_message_for_buffer (GstIdentity * identity,
+ const gchar * action, GstBuffer * buf)
+{
+ gchar ts_str[64], dur_str[64];
+
+ GST_OBJECT_LOCK (identity);
+
+ g_free (identity->last_message);
+ identity->last_message = g_strdup_printf ("%s ******* (%s:%s)i "
+ "(%u bytes, timestamp: %s, duration: %s, offset: %" G_GINT64_FORMAT ", "
+ "offset_end: % " G_GINT64_FORMAT ", flags: %d) %p", action,
+ GST_DEBUG_PAD_NAME (GST_BASE_TRANSFORM_CAST (identity)->sinkpad),
+ GST_BUFFER_SIZE (buf),
+ print_pretty_time (ts_str, sizeof (ts_str), GST_BUFFER_TIMESTAMP (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), buf);
+
+ GST_OBJECT_UNLOCK (identity);
+
+ gst_identity_notify_last_message (identity);
+}
+
static GstFlowReturn
gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
{
@@ -580,19 +614,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * \
buf) if (identity->drop_probability > 0.0) {
if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
if (!identity->silent) {
- GST_OBJECT_LOCK (identity);
- g_free (identity->last_message);
- identity->last_message =
- g_strdup_printf
- ("dropping ******* (%s:%s)i (%d bytes, timestamp: %"
- GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
- G_GINT64_FORMAT ", offset_end: % " G_GINT64_FORMAT
- ", flags: %d) %p", GST_DEBUG_PAD_NAME (trans->sinkpad),
- GST_BUFFER_SIZE (buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
- GST_BUFFER_OFFSET_END (buf), GST_BUFFER_FLAGS (buf), buf);
- GST_OBJECT_UNLOCK (identity);
- gst_identity_notify_last_message (identity);
+ gst_identity_update_last_message_for_buffer (identity, "dropping", buf);
}
/* return DROPPED to basetransform. */
return GST_BASE_TRANSFORM_FLOW_DROPPED;
@@ -604,19 +626,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * \
buf) }
if (!identity->silent) {
- GST_OBJECT_LOCK (identity);
- g_free (identity->last_message);
- identity->last_message =
- g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, timestamp: %"
- GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
- G_GINT64_FORMAT ", offset_end: % " G_GINT64_FORMAT ", flags: %d) %p",
- GST_DEBUG_PAD_NAME (trans->sinkpad), GST_BUFFER_SIZE (buf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
- GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
- GST_BUFFER_FLAGS (buf), buf);
- GST_OBJECT_UNLOCK (identity);
- gst_identity_notify_last_message (identity);
+ gst_identity_update_last_message_for_buffer (identity, "chain", buf);
}
if (identity->datarate > 0) {
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
gstreamer-cvs mailing list
gstreamer-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic