mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
bluez: a2dpsink: Add support for LDAC to a2dpsink
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1621>
This commit is contained in:
parent
ef3085c743
commit
8aa6db2c8d
2 changed files with 35 additions and 6 deletions
|
@ -2272,7 +2272,7 @@
|
|||
"long-name": "Bluetooth A2DP sink",
|
||||
"pad-templates": {
|
||||
"sink": {
|
||||
"caps": "audio/x-sbc:\n rate: { (int)16000, (int)32000, (int)44100, (int)48000 }\n channels: [ 1, 2 ]\n channel-mode: { (string)mono, (string)dual, (string)stereo, (string)joint }\n blocks: { (int)4, (int)8, (int)12, (int)16 }\n subbands: { (int)4, (int)8 }\nallocation-method: { (string)snr, (string)loudness }\n bitpool: [ 2, 64 ]\naudio/mpeg:\n",
|
||||
"caps": "audio/x-sbc:\n rate: { (int)16000, (int)32000, (int)44100, (int)48000 }\n channels: [ 1, 2 ]\n channel-mode: { (string)mono, (string)dual, (string)stereo, (string)joint }\n blocks: { (int)4, (int)8, (int)12, (int)16 }\n subbands: { (int)4, (int)8 }\nallocation-method: { (string)snr, (string)loudness }\n bitpool: [ 2, 64 ]\naudio/mpeg:\naudio/x-ldac:\n",
|
||||
"direction": "sink",
|
||||
"presence": "always"
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@ static GstStaticPadTemplate gst_a2dp_sink_factory =
|
|||
"blocks = (int) { 4, 8, 12, 16 }, "
|
||||
"subbands = (int) { 4, 8 }, "
|
||||
"allocation-method = (string) { snr, loudness }, "
|
||||
"bitpool = (int) [ 2, " TEMPLATE_MAX_BITPOOL_STR " ]; " "audio/mpeg"));
|
||||
"bitpool = (int) [ 2, " TEMPLATE_MAX_BITPOOL_STR " ]; "
|
||||
"audio/mpeg; " "audio/x-ldac"));
|
||||
|
||||
static gboolean gst_a2dp_sink_handle_event (GstPad * pad,
|
||||
GstObject * pad_parent, GstEvent * event);
|
||||
|
@ -316,8 +317,8 @@ gst_a2dp_sink_get_caps (GstA2dpSink * self)
|
|||
GstCaps *caps = NULL;
|
||||
|
||||
if (self->sink != NULL) {
|
||||
GST_LOG_OBJECT (self, "Getting device caps");
|
||||
caps = gst_a2dp_sink_get_device_caps (self);
|
||||
GST_LOG_OBJECT (self, "Got device caps %" GST_PTR_FORMAT, caps);
|
||||
}
|
||||
|
||||
if (!caps)
|
||||
|
@ -404,6 +405,28 @@ gst_a2dp_sink_init_rtp_mpeg_element (GstA2dpSink * self)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_a2dp_sink_init_rtp_ldac_element (GstA2dpSink * self)
|
||||
{
|
||||
GstElement *rtppay;
|
||||
|
||||
/* check if we don't need a new rtp */
|
||||
if (self->rtp)
|
||||
return TRUE;
|
||||
|
||||
GST_LOG_OBJECT (self, "Initializing rtp ldac element");
|
||||
|
||||
rtppay = gst_a2dp_sink_init_element (self, "rtpldacpay", "rtp");
|
||||
if (rtppay == NULL)
|
||||
return FALSE;
|
||||
|
||||
self->rtp = rtppay;
|
||||
|
||||
gst_element_set_state (rtppay, GST_STATE_PAUSED);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_a2dp_sink_init_dynamic_elements (GstA2dpSink * self, GstCaps * caps)
|
||||
{
|
||||
|
@ -411,6 +434,7 @@ gst_a2dp_sink_init_dynamic_elements (GstA2dpSink * self, GstCaps * caps)
|
|||
GstEvent *event;
|
||||
gboolean crc;
|
||||
gchar *mode = NULL;
|
||||
guint mtu;
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
|
@ -423,13 +447,17 @@ gst_a2dp_sink_init_dynamic_elements (GstA2dpSink * self, GstCaps * caps)
|
|||
GST_LOG_OBJECT (self, "mp3 media received");
|
||||
if (!gst_a2dp_sink_init_rtp_mpeg_element (self))
|
||||
return FALSE;
|
||||
} else if (gst_structure_has_name (structure, "audio/x-ldac")) {
|
||||
GST_LOG_OBJECT (self, "ldac media received");
|
||||
if (!gst_a2dp_sink_init_rtp_ldac_element (self))
|
||||
return FALSE;
|
||||
} else {
|
||||
GST_ERROR_OBJECT (self, "Unexpected media type");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_element_link (GST_ELEMENT (self->rtp), GST_ELEMENT (self->sink))) {
|
||||
GST_ERROR_OBJECT (self, "couldn't link rtpsbcpay " "to avdtpsink");
|
||||
GST_ERROR_OBJECT (self, "couldn't link rtp payloader to avdtpsink");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -452,8 +480,9 @@ gst_a2dp_sink_init_dynamic_elements (GstA2dpSink * self, GstCaps * caps)
|
|||
g_free (mode);
|
||||
}
|
||||
|
||||
g_object_set (self->rtp, "mtu",
|
||||
gst_avdtp_sink_get_link_mtu (self->sink), NULL);
|
||||
mtu = gst_avdtp_sink_get_link_mtu (self->sink);
|
||||
GST_INFO_OBJECT (self, "Setting MTU to %u", mtu);
|
||||
g_object_set (self->rtp, "mtu", mtu, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue