summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-03-23 11:56:09 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-03-23 11:56:09 +0100
commite252b13dd00c1a237b08dd34ffbfeca93180d815 (patch)
treecca4a74001461cf33301c66f05f8dc9084094bba
parentfcce2fe05913d1ea0fdf6ab656951b9a010fb2b9 (diff)
downloadgstreamer-plugins-base-e252b13dd00c1a237b08dd34ffbfeca93180d815.tar.gz
opusheader: Put number of channels and sample rate into the caps
https://bugzilla.gnome.org/show_bug.cgi?id=746617
-rw-r--r--ext/opus/gstopusheader.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/opus/gstopusheader.c b/ext/opus/gstopusheader.c
index d190cc227..53969602b 100644
--- a/ext/opus/gstopusheader.c
+++ b/ext/opus/gstopusheader.c
@@ -157,6 +157,7 @@ gst_opus_header_create_caps_from_headers (GstCaps ** caps, GSList ** headers,
GstBuffer * buf1, GstBuffer * buf2)
{
int n_streams, family;
+ gint channels, rate;
gboolean multistream;
GstMapInfo map;
guint8 *data;
@@ -168,6 +169,9 @@ gst_opus_header_create_caps_from_headers (GstCaps ** caps, GSList ** headers,
gst_buffer_map (buf1, &map, GST_MAP_READ);
data = map.data;
+ channels = data[9];
+ rate = GST_READ_UINT32_LE (data + 12);
+
/* work out the number of streams */
family = data[18];
if (family == 0) {
@@ -183,12 +187,16 @@ gst_opus_header_create_caps_from_headers (GstCaps ** caps, GSList ** headers,
}
}
+ /* TODO: should probably also put the channel mapping into the caps too once
+ * we actually support multi channel, and pre-skip and other fields */
+
gst_buffer_unmap (buf1, &map);
/* mark and put on caps */
multistream = n_streams > 1;
*caps = gst_caps_new_simple ("audio/x-opus",
- "multistream", G_TYPE_BOOLEAN, multistream, NULL);
+ "multistream", G_TYPE_BOOLEAN, multistream,
+ "channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, rate, NULL);
*caps = _gst_caps_set_buffer_array (*caps, "streamheader", buf1, buf2, NULL);
*headers = g_slist_prepend (*headers, gst_buffer_ref (buf2));