2006-10-18 Wim Taymans <wim@fluendo.com>
+ * gst/gstsegment.c: (gst_segment_set_last_stop),
+ (gst_segment_set_seek), (gst_segment_set_newsegment_full):
+ _set_last_stop() must be with a value != -1
+ A _TYPE_SET to -1 means seek to 0.
+ Calc last_stop correctly for negative rates.
+ Make sure we work with positive durations when updating a segment.
+
+2006-10-18 Wim Taymans <wim@fluendo.com>
+
* docs/design/part-live-source.txt:
* gst/gstclock.h:
Small docs fixes.
gint64 position)
{
g_return_if_fail (segment != NULL);
+ g_return_if_fail (position != -1);
if (G_UNLIKELY (segment->format == GST_FORMAT_UNDEFINED))
segment->format = format;
update_start = FALSE;
break;
case GST_SEEK_TYPE_SET:
- /* start holds desired position */
+ /* start holds desired position, map -1 to the start */
+ if (start == -1)
+ start = 0;
break;
case GST_SEEK_TYPE_CUR:
/* add start to currently configure segment */
segment->last_stop = start;
}
if (update_stop && rate < 0.0) {
- if (stop == -1)
- segment->last_stop = segment->duration;
- else
+ if (stop != -1)
segment->last_stop = stop;
+ else {
+ if (segment->duration != -1)
+ segment->last_stop = segment->duration;
+ else
+ segment->last_stop = 0;
+ }
}
segment->time = start;
segment->stop = stop;
if (update) {
/* an update to the current segment is done, elapsed time is
* difference between the old start and new start. */
- duration = start - segment->start;
+ if (start > segment->start)
+ duration = start - segment->start;
+ else
+ duration = 0;
} else {
/* the new segment has to be aligned with the old segment.
* We first update the accumulated time of the previous