else
stop = gst_segment_to_stream_time (&parse->segment, format, stop);
- if (parse->segment.rate < 0.0) {
- gint64 tmp;
- tmp = stop;
- stop = start;
- start = tmp;
- }
-
gst_query_set_segment (query, parse->segment.rate, format, start, stop);
res = TRUE;
break;
case GST_QUERY_SEGMENT:
{
if (basesink->pad_mode == GST_PAD_MODE_PULL) {
- gst_query_set_segment (query, basesink->segment.rate,
- GST_FORMAT_TIME, basesink->segment.start, basesink->segment.stop);
+ GstFormat format;
+ gint64 start, stop;
+
+ format = basesink->segment.format;
+
+ start =
+ gst_segment_to_stream_time (&basesink->segment, format,
+ basesink->segment.start);
+ if ((stop = basesink->segment.stop) == -1)
+ stop = basesink->segment.duration;
+ else
+ stop = gst_segment_to_stream_time (&basesink->segment, format, stop);
+
+ gst_query_set_segment (query, basesink->segment.rate, format, start,
+ stop);
res = TRUE;
} else {
res = gst_pad_peer_query (basesink->sinkpad, query);
}
case GST_QUERY_SEGMENT:
{
+ GstFormat format;
gint64 start, stop;
GST_OBJECT_LOCK (src);
- /* no end segment configured, current duration then */
+
+ format = src->segment.format;
+
+ start =
+ gst_segment_to_stream_time (&src->segment, format,
+ src->segment.start);
if ((stop = src->segment.stop) == -1)
stop = src->segment.duration;
- start = src->segment.start;
+ else
+ stop = gst_segment_to_stream_time (&src->segment, format, stop);
- /* adjust to stream time */
- if (src->segment.time != -1) {
- start -= src->segment.time;
- if (stop != -1)
- stop -= src->segment.time;
- }
+ gst_query_set_segment (query, src->segment.rate, format, start, stop);
- gst_query_set_segment (query, src->segment.rate, src->segment.format,
- start, stop);
GST_OBJECT_UNLOCK (src);
res = TRUE;
break;