diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-06-05 11:07:17 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-06-05 11:07:17 +0000 |
commit | 7537a1c39fafd800c5d90dc641ffb059155f57cf (patch) | |
tree | 4040bb41c8577a541c46346d5eeacea5a447027e /gst/interleave/interleave.c | |
parent | 61a15f8c5f61282ef9f8eef5852dda52b2f9b948 (diff) |
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.
Diffstat (limited to 'gst/interleave/interleave.c')
-rw-r--r-- | gst/interleave/interleave.c | 10 |
1 files changed, 10 insertions, 0 deletions
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; |