diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-29 12:17:57 +0200 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-29 12:17:57 +0200 |
commit | f2b14c68d504612e13d1f9bed1b4b92ecb8a4de0 (patch) | |
tree | 1f4925b87df46c873a0a408368f1892ddac2243a /ext/timidity | |
parent | 6812f96de4a8845a2d7aafa2fdc975274d530409 (diff) | |
download | gstreamer-plugins-bad-f2b14c68d504612e13d1f9bed1b4b92ecb8a4de0.tar.gz |
midi: Fix handling of the SEGMENT query
Diffstat (limited to 'ext/timidity')
-rw-r--r-- | ext/timidity/gsttimidity.c | 22 | ||||
-rw-r--r-- | ext/timidity/gstwildmidi.c | 22 |
2 files changed, 36 insertions, 8 deletions
diff --git a/ext/timidity/gsttimidity.c b/ext/timidity/gsttimidity.c index 0cea95198..086779538 100644 --- a/ext/timidity/gsttimidity.c +++ b/ext/timidity/gsttimidity.c @@ -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); diff --git a/ext/timidity/gstwildmidi.c b/ext/timidity/gstwildmidi.c index 29306710c..24e67401a 100644 --- a/ext/timidity/gstwildmidi.c +++ b/ext/timidity/gstwildmidi.c @@ -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); |