mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 17:05:52 +00:00
segment: small cleanup
Move the code to update the segment at the end of the function.
This commit is contained in:
parent
5aaf00a7de
commit
104ef4e7e0
1 changed files with 21 additions and 22 deletions
|
@ -240,13 +240,6 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
|
||||||
|
|
||||||
position = segment->position;
|
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 */
|
/* segment->start is never invalid */
|
||||||
switch (start_type) {
|
switch (start_type) {
|
||||||
case GST_SEEK_TYPE_NONE:
|
case GST_SEEK_TYPE_NONE:
|
||||||
|
@ -311,20 +304,12 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
segment->rate = rate;
|
if (flags & GST_SEEK_FLAG_FLUSH) {
|
||||||
segment->applied_rate = 1.0;
|
/* flush resets the running_time */
|
||||||
segment->base = base;
|
base = 0;
|
||||||
/* be explicit about our GstSeekFlag -> GstSegmentFlag conversion */
|
} else {
|
||||||
segment->flags = GST_SEGMENT_FLAG_NONE;
|
base = gst_segment_to_running_time (segment, format, position);
|
||||||
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 (update_start && rate > 0.0) {
|
if (update_start && rate > 0.0) {
|
||||||
position = start;
|
position = start;
|
||||||
|
@ -343,7 +328,21 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
|
||||||
if (update)
|
if (update)
|
||||||
*update = position != segment->position;
|
*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;
|
segment->position = position;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue