plugins/elements/gstidentity.*: Emit bus message if check-perfect is true and we...
authorZaheer Abbas Merali <zaheerabbas@merali.org>
Wed, 7 Mar 2007 16:58:42 +0000 (16:58 +0000)
committerZaheer Abbas Merali <zaheerabbas@merali.org>
Wed, 7 Mar 2007 16:58:42 +0000 (16:58 +0000)
Original commit message from CVS:
2007-03-07  Zaheer Abbas Merali  <zaheerabbas at merali dot org>

* plugins/elements/gstidentity.c: (gst_identity_check_perfect),
(gst_identity_start):
* plugins/elements/gstidentity.h:
Emit bus message if check-perfect is true and we encounter a
non-perfect stream between 2 consecutive buffers.
Fixes #415394.

ChangeLog
plugins/elements/gstidentity.c
plugins/elements/gstidentity.h

index 41df688fb4349a2848311b819d53605523b76c7a..541d156cfe1b7450020a6a5ffa31c1e06cf01591 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-03-07  Zaheer Abbas Merali  <zaheerabbas at merali dot org>
+
+       * plugins/elements/gstidentity.c: (gst_identity_check_perfect),
+       (gst_identity_start):
+       * plugins/elements/gstidentity.h:
+       Emit bus message if check-perfect is true and we encounter a
+       non-perfect stream between 2 consecutive buffers.
+       Fixes #415394.
+
 2007-03-07  Jan Schmidt  <thaytan@mad.scientist.com>
 
        * configure.ac:
index 04992ac9d7d65d43073ce74fb5ff8d3726e2ca08..8c1acaabaa66f640310596213aef71418a310d35 100644 (file)
@@ -334,6 +334,34 @@ gst_identity_check_perfect (GstIdentity * identity, GstBuffer * buf)
             GST_TIME_ARGS (identity->prev_duration), GST_TIME_ARGS (timestamp),
             GST_TIME_ARGS (t_expected), (dt < 0) ? '-' : '+',
             GST_TIME_ARGS ((dt < 0) ? (GstClockTime) (-dt) : dt));
+        /*
+         * "non-perfect" bus message:
+         * @identity: the identity instance
+         * @prev-timestamp: the previous buffer timestamp
+         * @prev-duration: the previous buffer duration
+         * @prev-offset: the previous buffer offset
+         * @prev-offset-end: the previous buffer offset end
+         * @cur-timestamp: the current buffer timestamp 
+         * @cur-duration: the current buffer duration
+         * @cur-offset: the current buffer offset
+         * @cur-offset_end: the current buffer offset end
+         *
+         * This bus message gets emitted if check-perfect property is set and
+         * a non perfect stream is detected between the last buffer and
+         * the newly received buffer.
+         */
+        gst_element_post_message (GST_ELEMENT (identity),
+            gst_message_new_element (GST_OBJECT (identity),
+                gst_structure_new ("non-perfect", "prev-timestamp",
+                    G_TYPE_UINT64, identity->prev_timestamp, "prev-duration",
+                    G_TYPE_UINT64, identity->prev_duration, "prev-offset",
+                    G_TYPE_UINT64, identity->prev_offset, "prev-offset-end",
+                    G_TYPE_UINT64, identity->prev_offset_end, "cur-timestamp",
+                    G_TYPE_UINT64, timestamp, "cur-duration", G_TYPE_UINT64,
+                    GST_BUFFER_DURATION (buf), "cur-offset", G_TYPE_UINT64,
+                    GST_BUFFER_OFFSET (buf), "cur-offset-end", G_TYPE_UINT64,
+                    GST_BUFFER_OFFSET_END (buf), NULL)));
+
       }
 
       offset = GST_BUFFER_OFFSET (buf);
@@ -352,6 +380,7 @@ gst_identity_check_perfect (GstIdentity * identity, GstBuffer * buf)
     identity->prev_timestamp = timestamp;
     identity->prev_duration = GST_BUFFER_DURATION (buf);
     identity->prev_offset_end = GST_BUFFER_OFFSET_END (buf);
+    identity->prev_offset = GST_BUFFER_OFFSET (buf);
   }
 }
 
@@ -576,6 +605,7 @@ gst_identity_start (GstBaseTransform * trans)
   identity->prev_timestamp = GST_CLOCK_TIME_NONE;
   identity->prev_duration = GST_CLOCK_TIME_NONE;
   identity->prev_offset_end = -1;
+  identity->prev_offset = -1;
 
   return TRUE;
 }
index 990bcb2d354e5fd1cd517a85ca80ae9f0fa8ca1a..e781eb3b5738be9a65448984fddace3abe74e850 100644 (file)
@@ -66,6 +66,7 @@ struct _GstIdentity {
   gboolean      single_segment;
   GstClockTime   prev_timestamp;
   GstClockTime   prev_duration;
+  guint64        prev_offset;
   guint64        prev_offset_end;
   gchar        *last_message;
   guint64        offset;