summaryrefslogtreecommitdiff
path: root/plugins/elements
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/elements')
-rw-r--r--plugins/elements/gstfdsink.c19
-rw-r--r--plugins/elements/gstfdsrc.c2
-rw-r--r--plugins/elements/gstfilesink.c20
-rw-r--r--plugins/elements/gstfunnel.c31
-rw-r--r--plugins/elements/gstidentity.c22
-rw-r--r--plugins/elements/gstinputselector.c61
-rw-r--r--plugins/elements/gstmultiqueue.c43
-rw-r--r--plugins/elements/gstoutputselector.c46
-rw-r--r--plugins/elements/gstqueue.c63
-rw-r--r--plugins/elements/gstqueue2.c56
10 files changed, 128 insertions, 235 deletions
diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c
index 76fe4aa90..22a326934 100644
--- a/plugins/elements/gstfdsink.c
+++ b/plugins/elements/gstfdsink.c
@@ -539,28 +539,27 @@ gst_fd_sink_event (GstBaseSink * sink, GstEvent * event)
type = GST_EVENT_TYPE (event);
switch (type) {
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
{
- gint64 start, stop, pos;
- GstFormat format;
- gst_event_parse_new_segment (event, NULL, NULL, NULL, &format, &start,
- &stop, &pos);
+ GstSegment segment;
- if (format == GST_FORMAT_BYTES) {
+ gst_event_parse_segment (event, &segment);
+
+ if (segment.format == GST_FORMAT_BYTES) {
/* only try to seek and fail when we are going to a different
* position */
- if (fdsink->current_pos != start) {
+ if (fdsink->current_pos != segment.start) {
/* FIXME, the seek should be performed on the pos field, start/stop are
* just boundaries for valid bytes offsets. We should also fill the file
* with zeroes if the new position extends the current EOF (sparse streams
* and segment accumulation). */
- if (!gst_fd_sink_do_seek (fdsink, (guint64) start))
+ if (!gst_fd_sink_do_seek (fdsink, (guint64) segment.start))
goto seek_failed;
}
} else {
GST_DEBUG_OBJECT (fdsink,
- "Ignored NEWSEGMENT event of format %u (%s)", (guint) format,
- gst_format_get_name (format));
+ "Ignored SEGMENT event of format %u (%s)", (guint) segment.format,
+ gst_format_get_name (segment.format));
}
break;
}
diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c
index 0eef85c07..8496b10d1 100644
--- a/plugins/elements/gstfdsrc.c
+++ b/plugins/elements/gstfdsrc.c
@@ -584,7 +584,7 @@ gst_fd_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
if (G_UNLIKELY (res < 0 || res != offset))
goto seek_failed;
- segment->last_stop = segment->start;
+ segment->position = segment->start;
segment->time = segment->start;
return TRUE;
diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c
index 3916dbcad..4773ac3a7 100644
--- a/plugins/elements/gstfilesink.c
+++ b/plugins/elements/gstfilesink.c
@@ -541,31 +541,29 @@ gst_file_sink_event (GstBaseSink * sink, GstEvent * event)
type = GST_EVENT_TYPE (event);
switch (type) {
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
{
- gint64 start, stop, pos;
- GstFormat format;
+ GstSegment segment;
- gst_event_parse_new_segment (event, NULL, NULL, NULL, &format, &start,
- &stop, &pos);
+ gst_event_parse_segment (event, &segment);
- if (format == GST_FORMAT_BYTES) {
+ if (segment.format == GST_FORMAT_BYTES) {
/* only try to seek and fail when we are going to a different
* position */
- if (filesink->current_pos != start) {
+ if (filesink->current_pos != segment.start) {
/* FIXME, the seek should be performed on the pos field, start/stop are
* just boundaries for valid bytes offsets. We should also fill the file
* with zeroes if the new position extends the current EOF (sparse streams
* and segment accumulation). */
- if (!gst_file_sink_do_seek (filesink, (guint64) start))
+ if (!gst_file_sink_do_seek (filesink, (guint64) segment.start))
goto seek_failed;
} else {
- GST_DEBUG_OBJECT (filesink, "Ignored NEWSEGMENT, no seek needed");
+ GST_DEBUG_OBJECT (filesink, "Ignored SEGMENT, no seek needed");
}
} else {
GST_DEBUG_OBJECT (filesink,
- "Ignored NEWSEGMENT event of format %u (%s)", (guint) format,
- gst_format_get_name (format));
+ "Ignored SEGMENT event of format %u (%s)", (guint) segment.format,
+ gst_format_get_name (segment.format));
}
break;
}
diff --git a/plugins/elements/gstfunnel.c b/plugins/elements/gstfunnel.c
index 532dd8310..7f287745f 100644
--- a/plugins/elements/gstfunnel.c
+++ b/plugins/elements/gstfunnel.c
@@ -247,13 +247,11 @@ gst_funnel_sink_chain (GstPad * pad, GstBuffer * buffer)
if (fpad->segment.format == GST_FORMAT_UNDEFINED) {
GST_WARNING_OBJECT (funnel, "Got buffer without segment,"
" setting segment [0,inf[");
- gst_segment_set_newsegment (&fpad->segment, FALSE, 1.0, 1.0,
- GST_FORMAT_TIME, 0, -1, 0);
+ gst_segment_init (&fpad->segment, GST_FORMAT_TIME);
}
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)))
- gst_segment_set_last_stop (&fpad->segment, fpad->segment.format,
- GST_BUFFER_TIMESTAMP (buffer));
+ fpad->segment.position = GST_BUFFER_TIMESTAMP (buffer);
newts = gst_segment_to_running_time (&fpad->segment,
fpad->segment.format, GST_BUFFER_TIMESTAMP (buffer));
@@ -263,8 +261,10 @@ gst_funnel_sink_chain (GstPad * pad, GstBuffer * buffer)
}
if (!funnel->has_segment) {
- event = gst_event_new_new_segment (FALSE, 1.0, 1.0, GST_FORMAT_TIME,
- 0, -1, 0);
+ GstSegment segment;
+
+ gst_segment_init (&segment, GST_FORMAT_TIME);
+ event = gst_event_new_segment (&segment);
funnel->has_segment = TRUE;
}
GST_OBJECT_UNLOCK (funnel);
@@ -312,34 +312,23 @@ gst_funnel_sink_event (GstPad * pad, GstEvent * event)
}
switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
{
- gboolean update;
- gdouble rate, arate;
- GstFormat format;
- gint64 start;
- gint64 stop;
- gint64 time;
-
- gst_event_parse_new_segment (event, &update, &rate, &arate,
- &format, &start, &stop, &time);
-
GST_OBJECT_LOCK (funnel);
- gst_segment_set_newsegment (&fpad->segment, update, rate, arate,
- format, start, stop, time);
+ gst_event_parse_segment (event, &fpad->segment);
GST_OBJECT_UNLOCK (funnel);
forward = FALSE;
- }
break;
+ }
case GST_EVENT_FLUSH_STOP:
{
GST_OBJECT_LOCK (funnel);
gst_segment_init (&fpad->segment, GST_FORMAT_UNDEFINED);
funnel->has_segment = FALSE;
GST_OBJECT_UNLOCK (funnel);
- }
break;
+ }
default:
break;
}
diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c
index 23cbf6d39..00e3a6b08 100644
--- a/plugins/elements/gstidentity.c
+++ b/plugins/elements/gstidentity.c
@@ -197,7 +197,7 @@ gst_identity_class_init (GstIdentityClass * klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_SINGLE_SEGMENT,
g_param_spec_boolean ("single-segment", "Single Segment",
- "Timestamp buffers and eat newsegments so as to appear as one segment",
+ "Timestamp buffers and eat segments so as to appear as one segment",
DEFAULT_SINGLE_SEGMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
pspec_last_message = g_param_spec_string ("last-message", "last-message",
"last-message", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -348,17 +348,16 @@ gst_identity_event (GstBaseTransform * trans, GstEvent * event)
gst_identity_notify_last_message (identity);
}
- if (identity->single_segment
- && (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT)) {
- if (trans->have_newsegment == FALSE) {
+ if (identity->single_segment && (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT)) {
+ if (trans->have_segment == FALSE) {
GstEvent *news;
- GstFormat format;
+ GstSegment segment;
- gst_event_parse_new_segment (event, NULL, NULL, NULL, &format, NULL, NULL,
- NULL);
+ gst_event_parse_segment (event, &segment);
- /* This is the first newsegment, send out a (0, -1) newsegment */
- news = gst_event_new_new_segment (TRUE, 1.0, 1.0, format, 0, -1, 0);
+ /* This is the first segment, send out a (0, -1) segment */
+ gst_segment_init (&segment, segment.format);
+ news = gst_event_new_segment (&segment);
gst_pad_event_default (trans->sinkpad, news);
}
@@ -366,15 +365,14 @@ gst_identity_event (GstBaseTransform * trans, GstEvent * event)
/* Reset previous timestamp, duration and offsets on NEWSEGMENT
* to prevent false warnings when checking for perfect streams */
- if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
+ if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
identity->prev_timestamp = identity->prev_duration = GST_CLOCK_TIME_NONE;
identity->prev_offset = identity->prev_offset_end = GST_BUFFER_OFFSET_NONE;
}
ret = GST_BASE_TRANSFORM_CLASS (parent_class)->event (trans, event);
- if (identity->single_segment
- && (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT)) {
+ if (identity->single_segment && (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT)) {
/* eat up segments */
ret = FALSE;
}
diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index 57f5a421d..c7a7bba5c 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -292,11 +292,11 @@ gst_selector_pad_get_running_time (GstSelectorPad * pad)
GST_OBJECT_LOCK (pad);
if (pad->active) {
- gint64 last_stop = pad->segment.last_stop;
+ gint64 position = pad->segment.position;
- if (last_stop >= 0)
+ if (position >= 0)
ret = gst_segment_to_running_time (&pad->segment, GST_FORMAT_TIME,
- last_stop);
+ position);
}
GST_OBJECT_UNLOCK (pad);
@@ -393,26 +393,13 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
sel->pending_close = FALSE;
GST_INPUT_SELECTOR_UNLOCK (sel);
break;
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
{
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- GST_DEBUG_OBJECT (pad,
- "configured NEWSEGMENT update %d, rate %lf, applied rate %lf, "
- "format %d, "
- "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
- G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
-
GST_INPUT_SELECTOR_LOCK (sel);
GST_OBJECT_LOCK (selpad);
- gst_segment_set_newsegment (&selpad->segment, update,
- rate, arate, format, start, stop, time);
+ gst_event_parse_segment (event, &selpad->segment);
+ GST_DEBUG_OBJECT (pad, "configured SEGMENT %" GST_SEGMENT_FORMAT,
+ &selpad->segment);
GST_OBJECT_UNLOCK (selpad);
/* If we aren't forwarding the event because the pad is not the
@@ -543,7 +530,7 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
GstSelectorPad *selpad;
GstClockTime start_time;
GstSegment *seg;
- GstEvent *close_event = NULL, *start_event = NULL;
+ GstEvent *start_event = NULL;
#if 0
GstCaps *caps;
#endif
@@ -572,7 +559,7 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
GST_TIME_ARGS (start_time + GST_BUFFER_DURATION (buf)));
GST_OBJECT_LOCK (pad);
- gst_segment_set_last_stop (seg, seg->format, start_time);
+ seg->position = start_time;
GST_OBJECT_UNLOCK (pad);
}
@@ -580,22 +567,6 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
if (pad != active_sinkpad)
goto ignore;
- if (G_UNLIKELY (sel->pending_close)) {
- GstSegment *cseg = &sel->segment;
-
- GST_DEBUG_OBJECT (sel,
- "pushing close NEWSEGMENT update %d, rate %lf, applied rate %lf, "
- "format %d, "
- "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
- G_GINT64_FORMAT, TRUE, cseg->rate, cseg->applied_rate, cseg->format,
- cseg->start, cseg->stop, cseg->time);
-
- /* create update segment */
- close_event = gst_event_new_new_segment (TRUE, cseg->rate,
- cseg->applied_rate, cseg->format, cseg->start, cseg->stop, cseg->time);
-
- sel->pending_close = FALSE;
- }
/* if we have a pending segment, push it out now */
if (G_UNLIKELY (selpad->segment_pending)) {
GST_DEBUG_OBJECT (pad,
@@ -605,8 +576,7 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
G_GINT64_FORMAT, FALSE, seg->rate, seg->applied_rate, seg->format,
seg->start, seg->stop, seg->time);
- start_event = gst_event_new_new_segment (FALSE, seg->rate,
- seg->applied_rate, seg->format, seg->start, seg->stop, seg->time);
+ start_event = gst_event_new_segment (seg);
selpad->segment_pending = FALSE;
}
@@ -618,9 +588,6 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
NOTIFY_MUTEX_UNLOCK ();
}
- if (close_event)
- gst_pad_push_event (sel->srcpad, close_event);
-
if (start_event)
gst_pad_push_event (sel->srcpad, start_event);
@@ -931,10 +898,10 @@ gst_input_selector_dispose (GObject * object)
static gint64
gst_segment_get_timestamp (GstSegment * segment, gint64 running_time)
{
- if (running_time <= segment->accum)
+ if (running_time <= segment->base)
return segment->start;
else
- return (running_time - segment->accum) * ABS (segment->rate) +
+ return (running_time - segment->base) * ABS (segment->rate) +
segment->start;
}
@@ -942,7 +909,7 @@ static void
gst_segment_set_stop (GstSegment * segment, gint64 running_time)
{
segment->stop = gst_segment_get_timestamp (segment, running_time);
- segment->last_stop = -1;
+ segment->position = -1;
}
static void
@@ -955,7 +922,7 @@ gst_segment_set_start (GstSegment * segment, gint64 running_time)
/* this is the duration we skipped */
duration = new_start - segment->start;
/* add the duration to the accumulated segment time */
- segment->accum += duration;
+ segment->base += duration;
/* move position in the segment */
segment->time += duration;
segment->start += duration;
diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c
index 7fe10fa73..32c7e8925 100644
--- a/plugins/elements/gstmultiqueue.c
+++ b/plugins/elements/gstmultiqueue.c
@@ -832,7 +832,7 @@ update_time_level (GstMultiQueue * mq, GstSingleQueue * sq)
if (sq->sink_tainted) {
sink_time = sq->sinktime =
gst_segment_to_running_time (&sq->sink_segment, GST_FORMAT_TIME,
- sq->sink_segment.last_stop);
+ sq->sink_segment.position);
if (G_UNLIKELY (sink_time != GST_CLOCK_TIME_NONE))
/* if we have a time, we become untainted and use the time */
@@ -843,7 +843,7 @@ update_time_level (GstMultiQueue * mq, GstSingleQueue * sq)
if (sq->src_tainted) {
src_time = sq->srctime =
gst_segment_to_running_time (&sq->src_segment, GST_FORMAT_TIME,
- sq->src_segment.last_stop);
+ sq->src_segment.position);
/* if we have a time, we become untainted and use the time */
if (G_UNLIKELY (src_time != GST_CLOCK_TIME_NONE))
sq->src_tainted = FALSE;
@@ -867,44 +867,33 @@ update_time_level (GstMultiQueue * mq, GstSingleQueue * sq)
return;
}
-/* take a NEWSEGMENT event and apply the values to segment, updating the time
+/* take a SEGMENT event and apply the values to segment, updating the time
* level of queue. */
static void
apply_segment (GstMultiQueue * mq, GstSingleQueue * sq, GstEvent * event,
GstSegment * segment)
{
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment (event, &update, &rate, &arate,
- &format, &start, &stop, &time);
+ gst_event_parse_segment (event, segment);
/* now configure the values, we use these to track timestamps on the
* sinkpad. */
- if (format != GST_FORMAT_TIME) {
+ if (segment->format != GST_FORMAT_TIME) {
/* non-time format, pretent the current time segment is closed with a
* 0 start and unknown stop time. */
- update = FALSE;
- format = GST_FORMAT_TIME;
- start = 0;
- stop = -1;
- time = 0;
+ segment->format = GST_FORMAT_TIME;
+ segment->start = 0;
+ segment->stop = -1;
+ segment->time = 0;
}
-
GST_MULTI_QUEUE_MUTEX_LOCK (mq);
- gst_segment_set_newsegment (segment, update,
- rate, arate, format, start, stop, time);
-
if (segment == &sq->sink_segment)
sq->sink_tainted = TRUE;
else
sq->src_tainted = TRUE;
GST_DEBUG_OBJECT (mq,
- "queue %d, configured NEWSEGMENT %" GST_SEGMENT_FORMAT, sq->id, segment);
+ "queue %d, configured SEGMENT %" GST_SEGMENT_FORMAT, sq->id, segment);
/* segment can update the time level of the queue */
update_time_level (mq, sq);
@@ -922,16 +911,16 @@ apply_buffer (GstMultiQueue * mq, GstSingleQueue * sq, GstClockTime timestamp,
/* if no timestamp is set, assume it's continuous with the previous
* time */
if (timestamp == GST_CLOCK_TIME_NONE)
- timestamp = segment->last_stop;
+ timestamp = segment->position;
/* add duration */
if (duration != GST_CLOCK_TIME_NONE)
timestamp += duration;
- GST_DEBUG_OBJECT (mq, "queue %d, last_stop updated to %" GST_TIME_FORMAT,
+ GST_DEBUG_OBJECT (mq, "queue %d, position updated to %" GST_TIME_FORMAT,
sq->id, GST_TIME_ARGS (timestamp));
- gst_segment_set_last_stop (segment, GST_FORMAT_TIME, timestamp);
+ segment->position = timestamp;
if (segment == &sq->sink_segment)
sq->sink_tainted = TRUE;
@@ -990,7 +979,7 @@ gst_single_queue_push_one (GstMultiQueue * mq, GstSingleQueue * sq,
case GST_EVENT_EOS:
result = GST_FLOW_UNEXPECTED;
break;
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
apply_segment (mq, sq, event, &sq->src_segment);
/* Applying the segment may have made the queue non-full again, unblock it if needed */
gst_data_queue_limits_changed (sq->queue);
@@ -1330,7 +1319,7 @@ gst_multi_queue_sink_event (GstPad * pad, GstEvent * event)
gst_single_queue_flush (mq, sq, FALSE);
goto done;
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
/* take ref because the queue will take ownership and we need the event
* afterwards to update the segment */
sref = gst_event_ref (event);
@@ -1371,7 +1360,7 @@ gst_multi_queue_sink_event (GstPad * pad, GstEvent * event)
update_buffering (mq, sq);
single_queue_overrun_cb (sq->queue, sq);
break;
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
apply_segment (mq, sq, sref, &sq->sink_segment);
gst_event_unref (sref);
break;
diff --git a/plugins/elements/gstoutputselector.c b/plugins/elements/gstoutputselector.c
index e29812caa..21913da28 100644
--- a/plugins/elements/gstoutputselector.c
+++ b/plugins/elements/gstoutputselector.c
@@ -411,19 +411,22 @@ gst_output_selector_switch (GstOutputSelector * osel)
osel->pending_srcpad = NULL;
GST_OBJECT_UNLOCK (GST_OBJECT (osel));
- /* Send NEWSEGMENT event and latest buffer if switching succeeded */
+ /* Send SEGMENT event and latest buffer if switching succeeded */
if (res) {
- /* Send NEWSEGMENT to the pad we are going to switch to */
+ /* Send SEGMENT to the pad we are going to switch to */
seg = &osel->segment;
- /* If resending then mark newsegment start and position accordingly */
+ /* If resending then mark segment start and position accordingly */
if (osel->resend_latest && osel->latest_buffer &&
GST_BUFFER_TIMESTAMP_IS_VALID (osel->latest_buffer)) {
start = position = GST_BUFFER_TIMESTAMP (osel->latest_buffer);
} else {
- start = position = seg->last_stop;
+ start = position = seg->position;
}
- ev = gst_event_new_new_segment (TRUE, seg->rate, seg->applied_rate,
- seg->format, start, seg->stop, position);
+
+ seg->start = start;
+ seg->position = position;
+ ev = gst_event_new_segment (seg);
+
if (!gst_pad_push_event (osel->active_srcpad, ev)) {
GST_WARNING_OBJECT (osel,
"newsegment handling failed in %" GST_PTR_FORMAT,
@@ -447,7 +450,7 @@ gst_output_selector_chain (GstPad * pad, GstBuffer * buf)
{
GstFlowReturn res;
GstOutputSelector *osel;
- GstClockTime last_stop, duration;
+ GstClockTime position, duration;
osel = GST_OUTPUT_SELECTOR (gst_pad_get_parent (pad));
@@ -479,15 +482,15 @@ gst_output_selector_chain (GstPad * pad, GstBuffer * buf)
/* Keep track of last stop and use it in NEWSEGMENT start after
switching to a new src pad */
- last_stop = GST_BUFFER_TIMESTAMP (buf);
- if (GST_CLOCK_TIME_IS_VALID (last_stop)) {
+ position = GST_BUFFER_TIMESTAMP (buf);
+ if (GST_CLOCK_TIME_IS_VALID (position)) {
duration = GST_BUFFER_DURATION (buf);
if (GST_CLOCK_TIME_IS_VALID (duration)) {
- last_stop += duration;
+ position += duration;
}
GST_LOG_OBJECT (osel, "setting last stop %" GST_TIME_FORMAT,
- GST_TIME_ARGS (last_stop));
- gst_segment_set_last_stop (&osel->segment, osel->segment.format, last_stop);
+ GST_TIME_ARGS (position));
+ osel->segment.position = position;
}
GST_LOG_OBJECT (osel, "pushing buffer to %" GST_PTR_FORMAT,
@@ -541,23 +544,12 @@ gst_output_selector_handle_sink_event (GstPad * pad, GstEvent * event)
}
switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
{
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- GST_DEBUG_OBJECT (sel,
- "configured NEWSEGMENT update %d, rate %lf, applied rate %lf, "
- "format %d, " "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
- G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
+ gst_event_parse_segment (event, &sel->segment);
- gst_segment_set_newsegment (&sel->segment, update,
- rate, arate, format, start, stop, time);
+ GST_DEBUG_OBJECT (sel, "configured SEGMENT update %" GST_SEGMENT_FORMAT,
+ &sel->segment);
/* Send newsegment to all src pads */
gst_pad_event_default (pad, event);
diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c
index 7db5861c3..526bc9080 100644
--- a/plugins/elements/gstqueue.c
+++ b/plugins/elements/gstqueue.c
@@ -542,7 +542,7 @@ update_time_level (GstQueue * queue)
if (queue->sink_tainted) {
queue->sinktime =
gst_segment_to_running_time (&queue->sink_segment, GST_FORMAT_TIME,
- queue->sink_segment.last_stop);
+ queue->sink_segment.position);
queue->sink_tainted = FALSE;
}
sink_time = queue->sinktime;
@@ -550,7 +550,7 @@ update_time_level (GstQueue * queue)
if (queue->src_tainted) {
queue->srctime =
gst_segment_to_running_time (&queue->src_segment, GST_FORMAT_TIME,
- queue->src_segment.last_stop);
+ queue->src_segment.position);
queue->src_tainted = FALSE;
}
src_time = queue->srctime;
@@ -564,41 +564,30 @@ update_time_level (GstQueue * queue)
queue->cur_level.time = 0;
}
-/* take a NEWSEGMENT event and apply the values to segment, updating the time
+/* take a SEGMENT event and apply the values to segment, updating the time
* level of queue. */
static void
apply_segment (GstQueue * queue, GstEvent * event, GstSegment * segment,
gboolean sink)
{
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment (event, &update, &rate, &arate,
- &format, &start, &stop, &time);
+ gst_event_parse_segment (event, segment);
/* now configure the values, we use these to track timestamps on the
* sinkpad. */
- if (format != GST_FORMAT_TIME) {
+ if (segment->format != GST_FORMAT_TIME) {
/* non-time format, pretent the current time segment is closed with a
* 0 start and unknown stop time. */
- update = FALSE;
- format = GST_FORMAT_TIME;
- start = 0;
- stop = -1;
- time = 0;
+ segment->format = GST_FORMAT_TIME;
+ segment->start = 0;
+ segment->stop = -1;
+ segment->time = 0;
}
- gst_segment_set_newsegment (segment, update,
- rate, arate, format, start, stop, time);
-
if (sink)
queue->sink_tainted = TRUE;
else
queue->src_tainted = TRUE;
- GST_DEBUG_OBJECT (queue,
- "configured NEWSEGMENT %" GST_SEGMENT_FORMAT, segment);
+ GST_DEBUG_OBJECT (queue, "configured SEGMENT %" GST_SEGMENT_FORMAT, segment);
/* segment can update the time level of the queue */
update_time_level (queue);
@@ -617,16 +606,16 @@ apply_buffer (GstQueue * queue, GstBuffer * buffer, GstSegment * segment,
/* if no timestamp is set, assume it's continuous with the previous
* time */
if (timestamp == GST_CLOCK_TIME_NONE)
- timestamp = segment->last_stop;
+ timestamp = segment->position;
/* add duration */
if (with_duration && duration != GST_CLOCK_TIME_NONE)
timestamp += duration;
- GST_LOG_OBJECT (queue, "last_stop updated to %" GST_TIME_FORMAT,
+ GST_LOG_OBJECT (queue, "position updated to %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp));
- gst_segment_set_last_stop (segment, GST_FORMAT_TIME, timestamp);
+ segment->position = timestamp;
if (sink)
queue->sink_tainted = TRUE;
else
@@ -691,7 +680,7 @@ gst_queue_locked_enqueue_event (GstQueue * queue, gpointer item)
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "got EOS from upstream");
queue->eos = TRUE;
break;
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
apply_segment (queue, event, &queue->sink_segment, TRUE);
/* if the queue is empty, apply sink segment on the source */
if (queue->queue->length == 0) {
@@ -747,7 +736,7 @@ gst_queue_locked_dequeue (GstQueue * queue, gboolean * is_buffer)
/* queue is empty now that we dequeued the EOS */
GST_QUEUE_CLEAR_LEVEL (queue->cur_level);
break;
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
/* apply newsegment if it has not already been applied */
if (G_LIKELY (!queue->newseg_applied_to_src)) {
apply_segment (queue, event, &queue->src_segment, FALSE);
@@ -1059,21 +1048,9 @@ out_unexpected:
static void
gst_queue_push_newsegment (GstQueue * queue)
{
- GstSegment *s;
GstEvent *event;
- s = &queue->src_segment;
-
- if (s->accum != 0) {
- event = gst_event_new_new_segment (FALSE, 1.0, 1.0, s->format, 0,
- s->accum, 0);
- GST_CAT_LOG_OBJECT (queue_dataflow, queue,
- "pushing accum newsegment event");
- gst_pad_push_event (queue->srcpad, event);
- }
-
- event = gst_event_new_new_segment (FALSE, s->rate, s->applied_rate,
- s->format, s->start, s->stop, s->time);
+ event = gst_event_new_segment (&queue->src_segment);
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "pushing real newsegment event");
gst_pad_push_event (queue->srcpad, event);
}
@@ -1138,7 +1115,7 @@ next:
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"got UNEXPECTED from downstream");
/* stop pushing buffers, we dequeue all items until we see an item that we
- * can push again, which is EOS or NEWSEGMENT. If there is nothing in the
+ * can push again, which is EOS or SEGMENT. If there is nothing in the
* queue we can push, we set a flag to make the sinkpad refuse more
* buffers with an UNEXPECTED return value. */
while ((data = gst_queue_locked_dequeue (queue, &is_buffer))) {
@@ -1150,7 +1127,7 @@ next:
GstEvent *event = GST_EVENT_CAST (data);
GstEventType type = GST_EVENT_TYPE (event);
- if (type == GST_EVENT_EOS || type == GST_EVENT_NEWSEGMENT) {
+ if (type == GST_EVENT_EOS || type == GST_EVENT_SEGMENT) {
/* we found a pushable item in the queue, push it out */
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"pushing pushable event %s after UNEXPECTED",
@@ -1164,7 +1141,7 @@ next:
}
/* no more items in the queue. Set the unexpected flag so that upstream
* make us refuse any more buffers on the sinkpad. Since we will still
- * accept EOS and NEWSEGMENT we return _FLOW_OK to the caller so that the
+ * accept EOS and SEGMENT we return _FLOW_OK to the caller so that the
* task function does not shut down. */
queue->unexpected = TRUE;
result = GST_FLOW_OK;
@@ -1175,7 +1152,7 @@ next:
GST_QUEUE_MUTEX_UNLOCK (queue);
- if (queue->push_newsegment && type != GST_EVENT_NEWSEGMENT) {
+ if (queue->push_newsegment && type != GST_EVENT_SEGMENT) {
gst_queue_push_newsegment (queue);
}
gst_pad_push_event (queue->srcpad, event);
diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c
index ca4e87508..7d433b18b 100644
--- a/plugins/elements/gstqueue2.c
+++ b/plugins/elements/gstqueue2.c
@@ -658,14 +658,14 @@ update_time_level (GstQueue2 * queue)
if (queue->sink_tainted) {
queue->sinktime =
gst_segment_to_running_time (&queue->sink_segment, GST_FORMAT_TIME,
- queue->sink_segment.last_stop);
+ queue->sink_segment.position);
queue->sink_tainted = FALSE;
}
if (queue->src_tainted) {
queue->srctime =
gst_segment_to_running_time (&queue->src_segment, GST_FORMAT_TIME,
- queue->src_segment.last_stop);
+ queue->src_segment.position);
queue->src_tainted = FALSE;
}
@@ -680,30 +680,18 @@ update_time_level (GstQueue2 * queue)
queue->cur_level.time = 0;
}
-/* take a NEWSEGMENT event and apply the values to segment, updating the time
+/* take a SEGMENT event and apply the values to segment, updating the time
* level of queue. */
static void
apply_segment (GstQueue2 * queue, GstEvent * event, GstSegment * segment,
gboolean is_sink)
{
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
+ gst_event_parse_segment (event, segment);
- gst_event_parse_new_segment (event, &update, &rate, &arate,
- &format, &start, &stop, &time);
-
- GST_DEBUG_OBJECT (queue,
- "received NEWSEGMENT update %d, rate %lf, applied rate %lf, "
- "format %d, "
- "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
- G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
-
- if (format == GST_FORMAT_BYTES) {
+ if (segment->format == GST_FORMAT_BYTES) {
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
/* start is where we'll be getting from and as such writing next */
- queue->current = add_range (queue, start);
+ queue->current = add_range (queue, segment->start);
/* update the stats for this range */
update_cur_level (queue, queue->current);
}
@@ -711,20 +699,16 @@ apply_segment (GstQueue2 * queue, GstEvent * event, GstSegment * segment,
/* now configure the values, we use these to track timestamps on the
* sinkpad. */
- if (format != GST_FORMAT_TIME) {
+ if (segment->format != GST_FORMAT_TIME) {
/* non-time format, pretent the current time segment is closed with a
* 0 start and unknown stop time. */
- update = FALSE;
- format = GST_FORMAT_TIME;
- start = 0;
- stop = -1;
- time = 0;
+ segment->format = GST_FORMAT_TIME;
+ segment->start = 0;
+ segment->stop = -1;
+ segment->time = 0;
}
- gst_segment_set_newsegment (segment, update,
- rate, arate, format, start, stop, time);
- GST_DEBUG_OBJECT (queue,
- "configured NEWSEGMENT %" GST_SEGMENT_FORMAT, segment);
+ GST_DEBUG_OBJECT (queue, "configured SEGMENT %" GST_SEGMENT_FORMAT, segment);
if (is_sink)
queue->sink_tainted = TRUE;
@@ -748,16 +732,16 @@ apply_buffer (GstQueue2 * queue, GstBuffer * buffer, GstSegment * segment,
/* if no timestamp is set, assume it's continuous with the previous
* time */
if (timestamp == GST_CLOCK_TIME_NONE)
- timestamp = segment->last_stop;
+ timestamp = segment->position;
/* add duration */
if (duration != GST_CLOCK_TIME_NONE)
timestamp += duration;
- GST_DEBUG_OBJECT (queue, "last_stop updated to %" GST_TIME_FORMAT,
+ GST_DEBUG_OBJECT (queue, "position updated to %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp));
- gst_segment_set_last_stop (segment, GST_FORMAT_TIME, timestamp);
+ segment->position = timestamp;
if (is_sink)
queue->sink_tainted = TRUE;
@@ -1825,7 +1809,7 @@ gst_queue2_locked_enqueue (GstQueue2 * queue, gpointer item, gboolean isbuffer)
GST_DEBUG_OBJECT (queue, "we have EOS");
queue->is_eos = TRUE;
break;
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
apply_segment (queue, event, &queue->sink_segment, TRUE);
/* This is our first new segment, we hold it
* as we can't save it on the temp file */
@@ -1934,7 +1918,7 @@ gst_queue2_locked_dequeue (GstQueue2 * queue, gboolean * is_buffer)
/* queue is empty now that we dequeued the EOS */
GST_QUEUE2_CLEAR_LEVEL (queue->cur_level);
break;
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
apply_segment (queue, event, &queue->src_segment, FALSE);
break;
default:
@@ -2228,7 +2212,7 @@ next:
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"got UNEXPECTED from downstream");
/* stop pushing buffers, we dequeue all items until we see an item that we
- * can push again, which is EOS or NEWSEGMENT. If there is nothing in the
+ * can push again, which is EOS or SEGMENT. If there is nothing in the
* queue we can push, we set a flag to make the sinkpad refuse more
* buffers with an UNEXPECTED return value until we receive something
* pushable again or we get flushed. */
@@ -2241,7 +2225,7 @@ next:
GstEvent *event = GST_EVENT_CAST (data);
GstEventType type = GST_EVENT_TYPE (event);
- if (type == GST_EVENT_EOS || type == GST_EVENT_NEWSEGMENT) {
+ if (type == GST_EVENT_EOS || type == GST_EVENT_SEGMENT) {
/* we found a pushable item in the queue, push it out */
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"pushing pushable event %s after UNEXPECTED",
@@ -2255,7 +2239,7 @@ next:
}
/* no more items in the queue. Set the unexpected flag so that upstream
* make us refuse any more buffers on the sinkpad. Since we will still
- * accept EOS and NEWSEGMENT we return _FLOW_OK to the caller so that the
+ * accept EOS and SEGMENT we return _FLOW_OK to the caller so that the
* task function does not shut down. */
queue->unexpected = TRUE;
result = GST_FLOW_OK;