gst/elements/: Print more buffer info in fakesink.
authorWim Taymans <wim.taymans@gmail.com>
Wed, 9 Jun 2004 14:19:50 +0000 (14:19 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 9 Jun 2004 14:19:50 +0000 (14:19 +0000)
Original commit message from CVS:
* gst/elements/gstfakesink.c: (gst_fakesink_chain):
* gst/elements/gstidentity.c: (gst_identity_init),
(gst_identity_chain):
Print more buffer info in fakesink.
Make identity output similar to fakesink.

ChangeLog
gst/elements/gstfakesink.c
gst/elements/gstidentity.c
plugins/elements/gstfakesink.c
plugins/elements/gstidentity.c

index 48d4de0..7365962 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-06-09  Wim Taymans  <wim@fluendo.com>
+
+       * gst/elements/gstfakesink.c: (gst_fakesink_chain):
+       * gst/elements/gstidentity.c: (gst_identity_init),
+       (gst_identity_chain):
+       Print more buffer info in fakesink.
+       Make identity output similar to fakesink.
+
 2004-06-07  Daniel Gazard  <dany42@free.fr>
 
        reviewed by Benjamin Otte  <otte@gnome.org>
index 2a11619..e9f1653 100644 (file)
@@ -348,10 +348,11 @@ gst_fakesink_chain (GstPad * pad, GstData * _data)
     fakesink->last_message =
         g_strdup_printf ("chain   ******* (%s:%s)< (%d bytes, timestamp: %"
         GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
-        G_GINT64_FORMAT ", flags: %d) %p", GST_DEBUG_PAD_NAME (pad),
-        GST_BUFFER_SIZE (buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
+        G_GINT64_FORMAT ", offset_end: %" G_GINT64_FORMAT ", flags: %d) %p",
+        GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf),
+        GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
         GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
-        GST_BUFFER_FLAGS (buf), buf);
+        GST_BUFFER_OFFSET_END (buf), GST_BUFFER_FLAGS (buf), buf);
 
     g_object_notify (G_OBJECT (fakesink), "last_message");
   }
index 937fa01..b6006ba 100644 (file)
@@ -168,6 +168,8 @@ gst_identity_init (GstIdentity * identity)
   identity->dump = FALSE;
   identity->last_message = NULL;
   identity->srccaps = NULL;
+
+  GST_FLAG_SET (identity, GST_ELEMENT_EVENT_AWARE);
 }
 
 static void
@@ -183,6 +185,22 @@ gst_identity_chain (GstPad * pad, GstData * _data)
 
   identity = GST_IDENTITY (gst_pad_get_parent (pad));
 
+  if (GST_IS_EVENT (buf)) {
+    GstEvent *event = GST_EVENT (buf);
+
+    if (!identity->silent) {
+      g_free (identity->last_message);
+
+      identity->last_message =
+          g_strdup_printf ("chain   ******* (%s:%s)E (type: %d) %p",
+          GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
+
+      g_object_notify (G_OBJECT (identity), "last_message");
+    }
+    gst_pad_event_default (pad, event);
+    return;
+  }
+
   if (identity->error_after >= 0) {
     identity->error_after--;
     if (identity->error_after == 0) {
@@ -197,9 +215,13 @@ gst_identity_chain (GstPad * pad, GstData * _data)
     if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
       g_free (identity->last_message);
       identity->last_message =
-          g_strdup_printf ("dropping   ******* (%s:%s)i (%d bytes, %"
-          G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
-          GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
+          g_strdup_printf ("dropping   ******* (%s:%s)i (%d bytes, timestamp: %"
+          GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
+          G_GINT64_FORMAT ", flags: %d) %p",
+          GST_DEBUG_PAD_NAME (identity->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_FLAGS (buf), buf);
       g_object_notify (G_OBJECT (identity), "last-message");
       gst_buffer_unref (buf);
       return;
@@ -213,11 +235,13 @@ gst_identity_chain (GstPad * pad, GstData * _data)
     if (!identity->silent) {
       g_free (identity->last_message);
       identity->last_message =
-          g_strdup_printf ("chain   ******* (%s:%s)i (%d bytes, ts %"
-          GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT ")",
+          g_strdup_printf ("chain   ******* (%s:%s)i (%d bytes, timestamp: %"
+          GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
+          G_GINT64_FORMAT ", flags: %d) %p",
           GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf),
           GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
-          GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
+          GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
+          GST_BUFFER_FLAGS (buf), buf);
       g_object_notify (G_OBJECT (identity), "last-message");
     }
 
index 2a11619..e9f1653 100644 (file)
@@ -348,10 +348,11 @@ gst_fakesink_chain (GstPad * pad, GstData * _data)
     fakesink->last_message =
         g_strdup_printf ("chain   ******* (%s:%s)< (%d bytes, timestamp: %"
         GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
-        G_GINT64_FORMAT ", flags: %d) %p", GST_DEBUG_PAD_NAME (pad),
-        GST_BUFFER_SIZE (buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
+        G_GINT64_FORMAT ", offset_end: %" G_GINT64_FORMAT ", flags: %d) %p",
+        GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf),
+        GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
         GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
-        GST_BUFFER_FLAGS (buf), buf);
+        GST_BUFFER_OFFSET_END (buf), GST_BUFFER_FLAGS (buf), buf);
 
     g_object_notify (G_OBJECT (fakesink), "last_message");
   }
index 937fa01..b6006ba 100644 (file)
@@ -168,6 +168,8 @@ gst_identity_init (GstIdentity * identity)
   identity->dump = FALSE;
   identity->last_message = NULL;
   identity->srccaps = NULL;
+
+  GST_FLAG_SET (identity, GST_ELEMENT_EVENT_AWARE);
 }
 
 static void
@@ -183,6 +185,22 @@ gst_identity_chain (GstPad * pad, GstData * _data)
 
   identity = GST_IDENTITY (gst_pad_get_parent (pad));
 
+  if (GST_IS_EVENT (buf)) {
+    GstEvent *event = GST_EVENT (buf);
+
+    if (!identity->silent) {
+      g_free (identity->last_message);
+
+      identity->last_message =
+          g_strdup_printf ("chain   ******* (%s:%s)E (type: %d) %p",
+          GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
+
+      g_object_notify (G_OBJECT (identity), "last_message");
+    }
+    gst_pad_event_default (pad, event);
+    return;
+  }
+
   if (identity->error_after >= 0) {
     identity->error_after--;
     if (identity->error_after == 0) {
@@ -197,9 +215,13 @@ gst_identity_chain (GstPad * pad, GstData * _data)
     if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
       g_free (identity->last_message);
       identity->last_message =
-          g_strdup_printf ("dropping   ******* (%s:%s)i (%d bytes, %"
-          G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
-          GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
+          g_strdup_printf ("dropping   ******* (%s:%s)i (%d bytes, timestamp: %"
+          GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
+          G_GINT64_FORMAT ", flags: %d) %p",
+          GST_DEBUG_PAD_NAME (identity->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_FLAGS (buf), buf);
       g_object_notify (G_OBJECT (identity), "last-message");
       gst_buffer_unref (buf);
       return;
@@ -213,11 +235,13 @@ gst_identity_chain (GstPad * pad, GstData * _data)
     if (!identity->silent) {
       g_free (identity->last_message);
       identity->last_message =
-          g_strdup_printf ("chain   ******* (%s:%s)i (%d bytes, ts %"
-          GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT ")",
+          g_strdup_printf ("chain   ******* (%s:%s)i (%d bytes, timestamp: %"
+          GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
+          G_GINT64_FORMAT ", flags: %d) %p",
           GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf),
           GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
-          GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
+          GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
+          GST_BUFFER_FLAGS (buf), buf);
       g_object_notify (G_OBJECT (identity), "last-message");
     }