Commit graph

29 commits

Author SHA1 Message Date
Pauli Virtanen
73994feda9 bluez5: allow same codec ID to correspond to multiple endpoints
The codec IDs are user-visible properties.

Some codecs can have multiple endpoints (e.g. different caps struct, or
multiple possible vendor ids), so this detail should not leak to the
user.
2021-08-18 19:55:22 +00:00
Pauli Virtanen
fc2fe12794 bluez5: update a2dp-codecs.h from bluez with aptx-ll caps 2021-08-18 19:55:22 +00:00
Pauli Virtanen
5071589aea bluez5: enable SBC-XQ codec by default, if allowed by quirks
Enable SBC-XQ by default, and move it at the end of the codecs list, so
that bluez does not connect to it automatically except when it is the
codec used previously.

When the codec is disabled by quirks, it won't appear in the codecs
list, and so can't be selected by user (and so won't be connected
automatically).

However, since SelectConfiguration does not carry information which
device is in question, we cannot prevent BlueZ connecting to the codec
even if it's disabled for a specific device. If the "impossible" occurs
regardless, we won't reject the connection and the profile will be shown
as the generic "A2DP" one.  If the sound is garbled, the user can select
some other profile that works.
2021-08-13 18:45:16 +00:00
Barnabás Pőcze
f5d51162c4 treewide: mark things static and const
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.

All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
2021-06-30 14:44:08 +02:00
Huang-Huang Bao
9384ba5500 bluez5: add properties for A2DP codec sample rate & channel mode configuration
Those properties are set as reference sample rate and channels number for A2DP configuration selecting.
2021-05-03 10:07:42 +00:00
Huang-Huang Bao
5c93f780cf a2dp: improve a2dp sink codec data flushing
Let codec decides when rtp packet need to be sent (terminated by MTU size in most case).
LDAC encoding loop can now be terminated by reading if frame_num is written, no 'frame_count' updating is needed.
RTP payload fragmentation can now be implemented more easily based on this.
2021-03-31 11:14:58 +00:00
Pauli Virtanen
a552655edc bluez5: add bluetoothAudioCodec property to device
Also make the "codecless" profiles to automatically switch to the codec
profiles.
2021-03-26 16:59:07 +00:00
Huang-Huang Bao
1d390addb1 a2dp: allow codec to hold Props params
Initial Props value are parsed from device settings, further changes are triggered by 'set_param' on a2dp node.
Codec can then use props to tweak its transcoder.
2021-03-20 09:16:20 +00:00
Pauli Virtanen
b642c7f209 bluez5: support device capability checks beyond A2DP caps + split sbc-xq to separate codec
We would like to have BT device codec capability checks beyond what's
possible based on A2DP caps.

Split SBC-XQ to a separate codec, and enable it in the device-dependent
check (although currently it just uses the config option).
2021-02-02 09:56:29 +00:00
Pauli Virtanen
e860f2bb4e bluez5: basic codec-switching framework 2021-02-02 09:56:29 +00:00
Pauli Virtanen
0908588d0c bluez5: add codec check_caps + check vendor codec id for ldac & aptx 2021-02-02 09:56:29 +00:00
Huang-Huang
c778bd734c
a2dp: improve codec specific transport socket send buffer size setting 2021-01-31 09:01:40 +08:00
Wim Taymans
5bb7a0f573 a2dp-codecs: add settings to codec init function
To make it possible to add extra config options in init.
Also add a method to update settings in a codec.
2021-01-07 17:39:39 +01:00
Wim Taymans
ece8a95c29 bluez5: improve a2dp codec api
Pass dict to select_config to influence the selection
Make a method to validate a config.
Add spa_dict to the codec to pass more info around.
2021-01-07 17:28:49 +01:00
Huang-Huang Bao
16f5058af9
a2dp: add ldac ABR support
Signed-off-by: Huang-Huang Bao <eh5@sokka.cn>
2020-12-19 19:17:15 +08:00
Huang-Huang Bao
161c05d737 a2dp: fix aptx hd codec negotiation
Signed-off-by: Huang-Huang Bao <eh5@sokka.cn>
2020-12-17 14:17:37 +00:00
Wim Taymans
8b52e44836 bluez5: support other ldac bit depth
Make the format_info const in codec_init, we just need to read the
final negotiated format in some cases.
Add some more ldac bit depths we support.
2020-12-11 13:30:11 +01:00
Wim Taymans
106d597305 bluez5: add aptX and aptX HD codecs
They need the libopenaptx libraries from
https://github.com/pali/libopenaptx
2020-12-04 11:34:38 +01:00
Wim Taymans
8bf0b7b4db a2dp: delay codec init to after acquire
Some codecs need the MTU as a parameter so wait until we acquire
with creating the codec context.

Make some method to enumerate the parameters from the transport
config and use that for the EnumFormat param.
2020-12-03 18:05:57 +01:00
Wim Taymans
dd8573a5c2 bluez5: add ldac codec 2020-12-03 10:16:14 +01:00
Wim Taymans
3363544d05 bluez5: use start_decode to skip the header 2020-12-02 17:01:22 +01:00
Grzegorz Uriasz
c1530ba171 Use RegisterApplication in bluez5 for A2DP if possible 2020-11-02 09:14:37 +01:00
Wim Taymans
d727123b86 a2dp-codecs: add more codec params 2020-10-19 18:12:47 +02:00
Wim Taymans
53ee5ce72a bluez5: make codecs configurable
Make the list of supported codecs available.
Register all supported codecs endpoints
Find the codec from the endpoint name
Put the codec on the transport for the sink to find.
2020-10-19 13:27:11 +02:00
Wim Taymans
e18c4d76dc a2dp: move codecs to separate files 2020-10-19 12:12:21 +02:00
Wim Taymans
5c5b9f61bb a2dp: generate format info from config in init 2020-10-19 10:38:22 +02:00
Wim Taymans
6cfddde39c bluez: fix a2dp source
Actually compile the codec config and declare the config as extern
or else it's just all 0.
Only acquire the transport when ACTIVE.
Implement transport state_change signal and acquire the transport
when going to pending/active.
Try to acquire the transport before we expose the device if we
can.
Force device expose when we get the device ServicesResolved=1 property
update.
Free transport when the rfcomm is closed.
Implement various DBus signals to detect dynamic property updates.
2019-05-16 13:18:45 +02:00
Wim Taymans
1804e47a91 a2dp-codecs: also define functions for big endian 2018-01-23 16:23:39 +01:00
Wim Taymans
7d5f302f93 Add bluez5 plugins 2018-01-16 15:19:55 +01:00