summaryrefslogtreecommitdiff
path: root/ext/opus/gstopusheader.c
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2011-12-08 19:47:55 +0000
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2011-12-09 15:04:20 +0000
commit554c64ae95dbd86713bab48a5059ba59c6346c85 (patch)
tree1329e4625e53401bdf5d33e226e0ada59f14cbdb /ext/opus/gstopusheader.c
parentb48b3c2c86b5017502c14e32822bd19987139a07 (diff)
downloadgstreamer-plugins-bad-554c64ae95dbd86713bab48a5059ba59c6346c85.tar.gz
opus: include streams count in caps
https://bugzilla.gnome.org/show_bug.cgi?id=665078
Diffstat (limited to 'ext/opus/gstopusheader.c')
-rw-r--r--ext/opus/gstopusheader.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ext/opus/gstopusheader.c b/ext/opus/gstopusheader.c
index 7f49e4711..185c85ef1 100644
--- a/ext/opus/gstopusheader.c
+++ b/ext/opus/gstopusheader.c
@@ -150,11 +150,26 @@ void
gst_opus_header_create_caps_from_headers (GstCaps ** caps, GSList ** headers,
GstBuffer * buf1, GstBuffer * buf2)
{
+ int n_streams, family;
+
g_return_if_fail (caps);
g_return_if_fail (headers && !*headers);
+ g_return_if_fail (GST_BUFFER_SIZE (buf1) >= 19);
+
+ /* work out the number of streams */
+ family = GST_BUFFER_DATA (buf1)[18];
+ if (family == 0) {
+ n_streams = 1;
+ } else {
+ /* only included in the header for family > 0 */
+ g_return_if_fail (GST_BUFFER_SIZE (buf1) >= 20);
+ n_streams = GST_BUFFER_DATA (buf1)[19];
+ }
/* mark and put on caps */
- *caps = gst_caps_from_string ("audio/x-opus");
+ *caps =
+ gst_caps_new_simple ("audio/x-opus", "streams", G_TYPE_INT, n_streams,
+ NULL);
*caps = _gst_caps_set_buffer_array (*caps, "streamheader", buf1, buf2, NULL);
*headers = g_slist_prepend (*headers, buf2);