-/* get the end position of the last seen object, this is used
- * for EOS and for making sure that we don't report a position we
- * have not reached yet. With LOCK. */
-static gboolean
-gst_base_sink_get_position_last (GstBaseSink * basesink, GstFormat format,
- gint64 * cur, gboolean * upstream)
-{
- GstFormat oformat;
- GstSegment *segment;
- gboolean ret = TRUE;
-
- segment = &basesink->segment;
- oformat = segment->format;
-
- if (oformat == GST_FORMAT_TIME) {
- /* return last observed stream time, we keep the stream time around in the
- * time format. */
- *cur = basesink->priv->current_sstop;
- } else {
- /* convert last stop to stream time */
- *cur = gst_segment_to_stream_time (segment, oformat, segment->last_stop);
- }
-
- if (*cur != -1 && oformat != format) {
- GST_OBJECT_UNLOCK (basesink);
- /* convert to the target format if we need to, release lock first */
- ret =
- gst_pad_query_convert (basesink->sinkpad, oformat, *cur, &format, cur);
- if (!ret) {
- *cur = -1;
- *upstream = TRUE;
- }
- GST_OBJECT_LOCK (basesink);
- }
-
- GST_DEBUG_OBJECT (basesink, "POSITION: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (*cur));
-
- return ret;
-}
-
-/* get the position when we are PAUSED, this is the stream time of the buffer
- * that prerolled. If no buffer is prerolled (we are still flushing), this
- * value will be -1. With LOCK. */
-static gboolean
-gst_base_sink_get_position_paused (GstBaseSink * basesink, GstFormat format,
- gint64 * cur, gboolean * upstream)
-{
- gboolean res;
- gint64 time;
- GstSegment *segment;
- GstFormat oformat;
-
- /* we don't use the clip segment in pull mode, when seeking we update the
- * main segment directly with the new segment values without it having to be
- * activated by the rendering after preroll */
- if (basesink->pad_mode == GST_ACTIVATE_PUSH)
- segment = basesink->abidata.ABI.clip_segment;
- else
- segment = &basesink->segment;
- oformat = segment->format;
-
- if (oformat == GST_FORMAT_TIME) {
- *cur = basesink->priv->current_sstart;
- if (segment->rate < 0.0 &&
- GST_CLOCK_TIME_IS_VALID (basesink->priv->current_sstop)) {
- /* for reverse playback we prefer the stream time stop position if we have
- * one */
- *cur = basesink->priv->current_sstop;
- }
- } else {
- *cur = gst_segment_to_stream_time (segment, oformat, segment->last_stop);
- }
-
- time = segment->time;
-
- if (*cur != -1) {
- *cur = MAX (*cur, time);
- GST_DEBUG_OBJECT (basesink, "POSITION as max: %" GST_TIME_FORMAT
- ", time %" GST_TIME_FORMAT, GST_TIME_ARGS (*cur), GST_TIME_ARGS (time));
- } else {
- /* we have no buffer, use the segment times. */
- if (segment->rate >= 0.0) {
- /* forward, next position is always the time of the segment */
- *cur = time;
- GST_DEBUG_OBJECT (basesink, "POSITION as time: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (*cur));
- } else {
- /* reverse, next expected timestamp is segment->stop. We use the function
- * to get things right for negative applied_rates. */
- *cur = gst_segment_to_stream_time (segment, oformat, segment->stop);
- GST_DEBUG_OBJECT (basesink, "reverse POSITION: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (*cur));
- }
- }
-
- res = (*cur != -1);
- if (res && oformat != format) {
- GST_OBJECT_UNLOCK (basesink);
- res =
- gst_pad_query_convert (basesink->sinkpad, oformat, *cur, &format, cur);
- if (!res) {
- *cur = -1;
- *upstream = TRUE;
- }
- GST_OBJECT_LOCK (basesink);
- }
-
- return res;
-}
-