mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05: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",
|
"long-name": "Bluetooth A2DP sink",
|
||||||
"pad-templates": {
|
"pad-templates": {
|
||||||
"sink": {
|
"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",
|
"direction": "sink",
|
||||||
"presence": "always"
|
"presence": "always"
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,8 @@ static GstStaticPadTemplate gst_a2dp_sink_factory =
|
||||||
"blocks = (int) { 4, 8, 12, 16 }, "
|
"blocks = (int) { 4, 8, 12, 16 }, "
|
||||||
"subbands = (int) { 4, 8 }, "
|
"subbands = (int) { 4, 8 }, "
|
||||||
"allocation-method = (string) { snr, loudness }, "
|
"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,
|
static gboolean gst_a2dp_sink_handle_event (GstPad * pad,
|
||||||
GstObject * pad_parent, GstEvent * event);
|
GstObject * pad_parent, GstEvent * event);
|
||||||
|
@ -316,8 +317,8 @@ gst_a2dp_sink_get_caps (GstA2dpSink * self)
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
|
||||||
if (self->sink != NULL) {
|
if (self->sink != NULL) {
|
||||||
GST_LOG_OBJECT (self, "Getting device caps");
|
|
||||||
caps = gst_a2dp_sink_get_device_caps (self);
|
caps = gst_a2dp_sink_get_device_caps (self);
|
||||||
|
GST_LOG_OBJECT (self, "Got device caps %" GST_PTR_FORMAT, caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!caps)
|
if (!caps)
|
||||||
|
@ -404,6 +405,28 @@ gst_a2dp_sink_init_rtp_mpeg_element (GstA2dpSink * self)
|
||||||
return TRUE;
|
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
|
static gboolean
|
||||||
gst_a2dp_sink_init_dynamic_elements (GstA2dpSink * self, GstCaps * caps)
|
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;
|
GstEvent *event;
|
||||||
gboolean crc;
|
gboolean crc;
|
||||||
gchar *mode = NULL;
|
gchar *mode = NULL;
|
||||||
|
guint mtu;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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");
|
GST_LOG_OBJECT (self, "mp3 media received");
|
||||||
if (!gst_a2dp_sink_init_rtp_mpeg_element (self))
|
if (!gst_a2dp_sink_init_rtp_mpeg_element (self))
|
||||||
return FALSE;
|
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 {
|
} else {
|
||||||
GST_ERROR_OBJECT (self, "Unexpected media type");
|
GST_ERROR_OBJECT (self, "Unexpected media type");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_element_link (GST_ELEMENT (self->rtp), GST_ELEMENT (self->sink))) {
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,8 +480,9 @@ gst_a2dp_sink_init_dynamic_elements (GstA2dpSink * self, GstCaps * caps)
|
||||||
g_free (mode);
|
g_free (mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_set (self->rtp, "mtu",
|
mtu = gst_avdtp_sink_get_link_mtu (self->sink);
|
||||||
gst_avdtp_sink_get_link_mtu (self->sink), NULL);
|
GST_INFO_OBJECT (self, "Setting MTU to %u", mtu);
|
||||||
|
g_object_set (self->rtp, "mtu", mtu, NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue