segment: take offset into account in _to_position()

Take the offset into account when converting between running-time and
segment positions.
This commit is contained in:
Wim Taymans 2014-01-08 15:23:00 +01:00
parent 6d3fc584d5
commit f664fbd198

View file

@ -651,7 +651,7 @@ gst_segment_to_position (const GstSegment * segment, GstFormat format,
if (G_LIKELY (segment->rate > 0.0)) {
/* bring to corrected position in segment */
result += start;
result += start + segment->offset;
/* outside of the segment boundary stop */
if (G_UNLIKELY (stop != -1 && result > stop))
@ -663,7 +663,7 @@ gst_segment_to_position (const GstSegment * segment, GstFormat format,
return -1;
/* bring to corrected position in segment */
result = stop - result;
result = stop - result - segment->offset;
}
return result;
}