mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
base: Fix handling of SEGMENT query
The values should be in stream-time, and start/stop should not be swapped for negative rates.
This commit is contained in:
parent
4aef70fed1
commit
ef8455d395
3 changed files with 25 additions and 19 deletions
|
@ -3696,13 +3696,6 @@ gst_base_parse_src_query_default (GstBaseParse * parse, GstQuery * query)
|
|||
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;
|
||||
|
|
|
@ -4714,8 +4714,21 @@ default_element_query (GstElement * element, GstQuery * query)
|
|||
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);
|
||||
|
|
|
@ -1078,23 +1078,23 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * 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;
|
||||
|
|
Loading…
Reference in a new issue