From ae438434363a536418f2de655142c4e9962745b1 Mon Sep 17 00:00:00 2001 From: Zaheer Abbas Merali Date: Wed, 7 Mar 2007 16:58:42 +0000 Subject: [PATCH] plugins/elements/gstidentity.*: Emit bus message if check-perfect is true and we encounter a non-perfect stream betwe... Original commit message from CVS: 2007-03-07 Zaheer Abbas Merali * 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 | 9 +++++++++ plugins/elements/gstidentity.c | 30 ++++++++++++++++++++++++++++++ plugins/elements/gstidentity.h | 1 + 3 files changed, 40 insertions(+) diff --git a/ChangeLog b/ChangeLog index 41df688fb4..541d156cfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-03-07 Zaheer Abbas Merali + + * 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 * configure.ac: diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index 04992ac9d7..8c1acaabaa 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -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; } diff --git a/plugins/elements/gstidentity.h b/plugins/elements/gstidentity.h index 990bcb2d35..e781eb3b57 100644 --- a/plugins/elements/gstidentity.h +++ b/plugins/elements/gstidentity.h @@ -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;