mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
opusheader: Put number of channels and sample rate into the caps
https://bugzilla.gnome.org/show_bug.cgi?id=746617
This commit is contained in:
parent
fcce2fe059
commit
e252b13dd0
1 changed files with 9 additions and 1 deletions
|
@ -157,6 +157,7 @@ gst_opus_header_create_caps_from_headers (GstCaps ** caps, GSList ** headers,
|
||||||
GstBuffer * buf1, GstBuffer * buf2)
|
GstBuffer * buf1, GstBuffer * buf2)
|
||||||
{
|
{
|
||||||
int n_streams, family;
|
int n_streams, family;
|
||||||
|
gint channels, rate;
|
||||||
gboolean multistream;
|
gboolean multistream;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
guint8 *data;
|
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);
|
gst_buffer_map (buf1, &map, GST_MAP_READ);
|
||||||
data = map.data;
|
data = map.data;
|
||||||
|
|
||||||
|
channels = data[9];
|
||||||
|
rate = GST_READ_UINT32_LE (data + 12);
|
||||||
|
|
||||||
/* work out the number of streams */
|
/* work out the number of streams */
|
||||||
family = data[18];
|
family = data[18];
|
||||||
if (family == 0) {
|
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);
|
gst_buffer_unmap (buf1, &map);
|
||||||
|
|
||||||
/* mark and put on caps */
|
/* mark and put on caps */
|
||||||
multistream = n_streams > 1;
|
multistream = n_streams > 1;
|
||||||
*caps = gst_caps_new_simple ("audio/x-opus",
|
*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);
|
*caps = _gst_caps_set_buffer_array (*caps, "streamheader", buf1, buf2, NULL);
|
||||||
|
|
||||||
*headers = g_slist_prepend (*headers, gst_buffer_ref (buf2));
|
*headers = g_slist_prepend (*headers, gst_buffer_ref (buf2));
|
||||||
|
|
Loading…
Reference in a new issue