+2006-05-08 Wim Taymans <wim@fluendo.com>
+
+ * libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
+ (gst_base_sink_do_sync), (gst_base_sink_chain_unlocked),
+ (gst_base_sink_get_position), (gst_base_sink_change_state):
+ Store the sync time of the buffer end position separatly in a
+ new variable eos_rtime so we can properly sync the EOS event.
+ Fixes #340697.
+ Fix the docs for gst_base_sink_set_qos_enabled().
+ Don't set segment start to invalid value when we receive a
+ non TIME newsegment.
+ get closer to handling position reporting for negative rates
+ correctly.
+
2006-05-07 Stefan Kost <ensonic@users.sf.net>
* gst/gstcaps.c:
- Docs about how to print caps for debug purposes.
-
+ Docs about how to print caps for debug purposes.
+
* gst/gstpadtemplate.c: (gst_static_pad_template_get):
- use gst_caps_make_writable instead of gst_caps_copy, Fixes #340608
+ use gst_caps_make_writable instead of gst_caps_copy, Fixes #340608
2006-05-07 Stefan Kost <ensonic@users.sf.net>
GstClockTime current_rstop;
GstClockTimeDiff current_jitter;
+ /* EOS sync time in running time */
+ GstClockTime eos_rtime;
+
/* last buffer that arrived in time, running time */
GstClockTime last_in_time;
/* when the last buffer left the sink, running time */
/**
* gst_base_sink_set_qos_enabled:
* @sink: the sink
- * @qos: the new qos value.
+ * @enabled: the new qos value.
*
* Configures @sink to send QoS events upstream.
*
/* EOS event needs syncing */
case GST_EVENT_EOS:
sstart = sstop = basesink->priv->current_sstop;
- rstart = rstop = basesink->priv->current_rstop;
+ rstart = rstop = basesink->priv->eos_rtime;
+ *do_sync = rstart != -1;
+ GST_DEBUG_OBJECT (basesink, "sync times for EOS %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (rstart));
goto done;
/* other events do not need syncing */
/* FIXME, maybe NEWSEGMENT might need synchronisation
}
GST_DEBUG_OBJECT (basesink, "got times start: %" GST_TIME_FORMAT
- ", stop: %" GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
+ ", stop: %" GST_TIME_FORMAT ", do_sync %d", GST_TIME_ARGS (start),
+ GST_TIME_ARGS (stop), *do_sync);
/* collect segment and format for code clarity */
segment = &basesink->segment;
/* store timing info for current object */
basesink->priv->current_rstart = rstart;
basesink->priv->current_rstop = (rstop != -1 ? rstop : rstart);
+ /* save sync time for eos when the previous object needed sync */
+ basesink->priv->eos_rtime = (do_sync ? basesink->priv->current_rstop : -1);
+
/* lock because we read this when answering the POSITION
* query. */
GST_OBJECT_LOCK (basesink);
}
basesink->have_newsegment = TRUE;
- /* this means this sink will not use segment info for sync */
- clip_segment->start = -1;
+ /* this means this sink will assume timestamps start from 0 */
+ clip_segment->start = 0;
clip_segment->stop = -1;
- /* and we set the rendering segment to invalid as well */
- basesink->segment.start = -1;
+ basesink->segment.start = 0;
basesink->segment.stop = -1;
}
{
GstClockTime now, base;
gint64 time, accum;
- gdouble abs_rate;
+ gdouble rate;
gint64 last;
/* we can answer time format */
base = GST_ELEMENT_CAST (basesink)->base_time;
accum = basesink->segment.accum;
- abs_rate = basesink->segment.abs_rate;
+ rate = basesink->segment.rate;
gst_base_sink_get_position_last (basesink, &last);
gst_object_ref (clock);
GST_OBJECT_UNLOCK (basesink);
now = gst_clock_get_time (clock);
+ /* subtract base time and accumulated time from the clock time.
+ * Make sure we don't go negative. This is the current time in
+ * the segment which we need to scale with the rate */
base += accum;
base = MIN (now, base);
- *cur = gst_guint64_to_gdouble (now - base) * abs_rate + time;
+ /* for negative rate this will count back from the segment time */
+ *cur = time + gst_guint64_to_gdouble (now - base) * rate;
/* never report more than last seen position */
if (last != -1)
basesink->playing_async = TRUE;
basesink->priv->current_sstart = 0;
basesink->priv->current_sstop = 0;
+ basesink->priv->eos_rtime = -1;
basesink->eos = FALSE;
gst_base_sink_reset_qos (basesink);
ret = GST_STATE_CHANGE_ASYNC;