From c6dffa0538819d2995d105e63b445359faa340d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 5 Jun 2008 11:07:17 +0000 Subject: gst/interleave/: Properly implement duration and position queries in bytes format. We have to take the upstream reply... Original commit message from CVS: * gst/interleave/deinterleave.c: (gst_deinterleave_add_new_pads), (gst_deinterleave_src_query): * gst/interleave/interleave.c: (gst_interleave_src_query_duration), (gst_interleave_src_query): Properly implement duration and position queries in bytes format. We have to take the upstream reply and divide/multiply it by the number of channels to get the correct result. --- gst/interleave/interleave.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gst/interleave/interleave.c') diff --git a/gst/interleave/interleave.c b/gst/interleave/interleave.c index 32c50ccc..76843e45 100644 --- a/gst/interleave/interleave.c +++ b/gst/interleave/interleave.c @@ -974,6 +974,11 @@ gst_interleave_src_query_duration (GstInterleave * self, GstQuery * query) gst_iterator_free (it); if (res) { + /* If in bytes format we have to multiply with the number of channels + * to get the correct results. All other formats should be fine */ + if (format == GST_FORMAT_BYTES && max != -1) + max *= self->channels; + /* and store the max */ GST_DEBUG_OBJECT (self, "Total duration in format %s: %" GST_TIME_FORMAT, gst_format_get_name (format), GST_TIME_ARGS (max)); @@ -1095,6 +1100,11 @@ gst_interleave_src_query (GstPad * pad, GstQuery * query) gst_query_set_position (query, format, self->timestamp); res = TRUE; break; + case GST_FORMAT_BYTES: + gst_query_set_position (query, format, + self->offset * self->channels * self->width); + res = TRUE; + break; case GST_FORMAT_DEFAULT: gst_query_set_position (query, format, self->offset); res = TRUE; -- cgit v1.2.1