summaryrefslogtreecommitdiff
path: root/gst/gstsegment.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-07-27 14:53:03 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2012-07-27 15:24:51 +0200
commit104ef4e7e05e25334b81073e37a02ba3fb1b9fc8 (patch)
treeeb6c5788d882a748d3eaa9263a21f4457c0c922d /gst/gstsegment.c
parent5aaf00a7dedec3566dcfc99444d89584dc287898 (diff)
segment: small cleanup
Move the code to update the segment at the end of the function.
Diffstat (limited to 'gst/gstsegment.c')
-rw-r--r--gst/gstsegment.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/gst/gstsegment.c b/gst/gstsegment.c
index cc4931d5a..bcabcc872 100644
--- a/gst/gstsegment.c
+++ b/gst/gstsegment.c
@@ -240,13 +240,6 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
position = segment->position;
- if (flags & GST_SEEK_FLAG_FLUSH) {
- /* flush resets the running_time */
- base = 0;
- } else {
- base = gst_segment_to_running_time (segment, format, position);
- }
-
/* segment->start is never invalid */
switch (start_type) {
case GST_SEEK_TYPE_NONE:
@@ -311,20 +304,12 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
}
}
- segment->rate = rate;
- segment->applied_rate = 1.0;
- segment->base = base;
- /* be explicit about our GstSeekFlag -> GstSegmentFlag conversion */
- segment->flags = GST_SEGMENT_FLAG_NONE;
- if ((flags & GST_SEEK_FLAG_FLUSH) != 0)
- segment->flags |= GST_SEGMENT_FLAG_RESET;
- if ((flags & GST_SEEK_FLAG_SKIP) != 0)
- segment->flags |= GST_SEGMENT_FLAG_SKIP;
- if ((flags & GST_SEEK_FLAG_SEGMENT) != 0)
- segment->flags |= GST_SEGMENT_FLAG_SEGMENT;
- segment->start = start;
- segment->stop = stop;
- segment->time = start;
+ if (flags & GST_SEEK_FLAG_FLUSH) {
+ /* flush resets the running_time */
+ base = 0;
+ } else {
+ base = gst_segment_to_running_time (segment, format, position);
+ }
if (update_start && rate > 0.0) {
position = start;
@@ -343,7 +328,21 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
if (update)
*update = position != segment->position;
- /* update new position */
+ /* update new values */
+ segment->rate = rate;
+ segment->applied_rate = 1.0;
+ segment->base = base;
+ /* be explicit about our GstSeekFlag -> GstSegmentFlag conversion */
+ segment->flags = GST_SEGMENT_FLAG_NONE;
+ if ((flags & GST_SEEK_FLAG_FLUSH) != 0)
+ segment->flags |= GST_SEGMENT_FLAG_RESET;
+ if ((flags & GST_SEEK_FLAG_SKIP) != 0)
+ segment->flags |= GST_SEGMENT_FLAG_SKIP;
+ if ((flags & GST_SEEK_FLAG_SEGMENT) != 0)
+ segment->flags |= GST_SEGMENT_FLAG_SEGMENT;
+ segment->start = start;
+ segment->stop = stop;
+ segment->time = start;
segment->position = position;
return TRUE;