From c086db87a3574183315fe2d0e9061efbc3dafc48 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 3 May 2007 16:44:34 +0000 Subject: [PATCH] libs/gst/base/gstbasetransform.c: Properly set the last_stop position on GstSegment. This will only happen if there i... Original commit message from CVS: * libs/gst/base/gstbasetransform.c: (gst_base_transform_chain): Properly set the last_stop position on GstSegment. This will only happen if there is a buffer to push out. --- ChangeLog | 6 ++++++ libs/gst/base/gstbasetransform.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4b612d900d..cbc222bc28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-05-03 Edward Hervey + + * libs/gst/base/gstbasetransform.c: (gst_base_transform_chain): + Properly set the last_stop position on GstSegment. This will only happen + if there is a buffer to push out. + 2007-05-03 Wim Taymans * libs/gst/base/gstbasetransform.c: diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 525a9c3ad5..b29718ade7 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1566,10 +1566,19 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer) { GstBaseTransform *trans; GstFlowReturn ret; + GstClockTime last_stop = GST_CLOCK_TIME_NONE; GstBuffer *outbuf = NULL; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); + /* calculate end position of the incoming buffer */ + if (GST_BUFFER_TIMESTAMP (buffer) != GST_CLOCK_TIME_NONE) { + if (GST_BUFFER_DURATION (buffer) != GST_CLOCK_TIME_NONE) + last_stop = GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer); + else + last_stop = GST_BUFFER_TIMESTAMP (buffer); + } + /* protect transform method and concurrent buffer alloc */ g_mutex_lock (trans->transform_lock); ret = gst_base_transform_handle_buffer (trans, buffer, &outbuf); @@ -1579,6 +1588,11 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer) * GST_BASE_TRANSFORM_FLOW_DROPPED we will not push either. */ if (outbuf != NULL) { if ((ret == GST_FLOW_OK)) { + /* Remember last stop position */ + if ((last_stop != GST_CLOCK_TIME_NONE) && + (trans->segment.format == GST_FORMAT_TIME)) + gst_segment_set_last_stop (&trans->segment, GST_FORMAT_TIME, last_stop); + /* apply DISCONT flag if the buffer is not yet marked as such */ if (trans->priv->discont) { if (!GST_BUFFER_IS_DISCONT (outbuf)) {