mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
midi: Fix handling of the SEGMENT query
This commit is contained in:
parent
6812f96de4
commit
f2b14c68d5
3 changed files with 54 additions and 12 deletions
|
@ -279,11 +279,25 @@ gst_timidity_src_query (GstPad * pad, GstQuery * query)
|
|||
gst_query_set_formats (query, 3,
|
||||
GST_FORMAT_TIME, GST_FORMAT_BYTES, GST_FORMAT_DEFAULT);
|
||||
break;
|
||||
case GST_QUERY_SEGMENT:
|
||||
gst_query_set_segment (query, timidity->o_segment->rate,
|
||||
timidity->o_segment->format, timidity->o_segment->start,
|
||||
timidity->o_segment->stop);
|
||||
case GST_QUERY_SEGMENT:{
|
||||
GstFormat format;
|
||||
gint64 start, stop;
|
||||
|
||||
format = timidity->o_segment->format;
|
||||
|
||||
start =
|
||||
gst_segment_to_stream_time (timidity->o_segment, format,
|
||||
timidity->o_segment->start);
|
||||
if ((stop = timidity->o_segment->stop) == -1)
|
||||
stop = timidity->o_segment->duration;
|
||||
else
|
||||
stop = gst_segment_to_stream_time (timidity->o_segment, format, stop);
|
||||
|
||||
gst_query_set_segment (query, timidity->o_segment->rate, format, start,
|
||||
stop);
|
||||
res = TRUE;
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_SEEKING:
|
||||
gst_query_set_seeking (query, timidity->o_segment->format,
|
||||
TRUE, 0, timidity->o_len);
|
||||
|
|
|
@ -383,11 +383,25 @@ gst_wildmidi_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
gst_query_set_formats (query, 3,
|
||||
GST_FORMAT_TIME, GST_FORMAT_BYTES, GST_FORMAT_DEFAULT);
|
||||
break;
|
||||
case GST_QUERY_SEGMENT:
|
||||
gst_query_set_segment (query, wildmidi->o_segment->rate,
|
||||
wildmidi->o_segment->format, wildmidi->o_segment->start,
|
||||
wildmidi->o_segment->stop);
|
||||
case GST_QUERY_SEGMENT:{
|
||||
GstFormat format;
|
||||
gint64 start, stop;
|
||||
|
||||
format = wildmidi->o_segment->format;
|
||||
|
||||
start =
|
||||
gst_segment_to_stream_time (wildmidi->o_segment, format,
|
||||
wildmidi->o_segment->start);
|
||||
if ((stop = wildmidi->o_segment->stop) == -1)
|
||||
stop = wildmidi->o_segment->duration;
|
||||
else
|
||||
stop = gst_segment_to_stream_time (wildmidi->o_segment, format, stop);
|
||||
|
||||
gst_query_set_segment (query, wildmidi->o_segment->rate, format, start,
|
||||
stop);
|
||||
res = TRUE;
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_SEEKING:
|
||||
gst_query_set_seeking (query, wildmidi->o_segment->format,
|
||||
TRUE, 0, wildmidi->o_len);
|
||||
|
|
|
@ -211,11 +211,25 @@ gst_midi_parse_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
case GST_QUERY_FORMATS:
|
||||
gst_query_set_formats (query, 1, GST_FORMAT_TIME);
|
||||
break;
|
||||
case GST_QUERY_SEGMENT:
|
||||
gst_query_set_segment (query, midiparse->segment.rate,
|
||||
midiparse->segment.format, midiparse->segment.start,
|
||||
midiparse->segment.stop);
|
||||
case GST_QUERY_SEGMENT:{
|
||||
GstFormat format;
|
||||
gint64 start, stop;
|
||||
|
||||
format = midiparse->segment.format;
|
||||
|
||||
start =
|
||||
gst_segment_to_stream_time (&midiparse->segment, format,
|
||||
midiparse->segment.start);
|
||||
if ((stop = midiparse->segment.stop) == -1)
|
||||
stop = midiparse->segment.duration;
|
||||
else
|
||||
stop = gst_segment_to_stream_time (&midiparse->segment, format, stop);
|
||||
|
||||
gst_query_set_segment (query, midiparse->segment.rate, format, start,
|
||||
stop);
|
||||
res = TRUE;
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_SEEKING:
|
||||
gst_query_set_seeking (query, midiparse->segment.format,
|
||||
FALSE, 0, midiparse->segment.duration);
|
||||
|
|
Loading…
Reference in a new issue