bluez5: Configure LC3 codec capabilities

Currently, the PipeWire daemon registers BlueZ LE Media Endpoints
with audio capabilities covering all settings defined in the BAP spec.
However, some scenarios might require the capabilities to be restricted
to specific configurations.

This adds a method to read LC3 codec specific capabilities from the
Wireplumber config file, and provide those settings when registering
Media Endpoint objects with BlueZ. If the values are not present in
the config file, all settings will be used by default.

Below is an example of how to set the LC3 capabilities in the config
file, to support the 16_2 setting from the BAP spec:

bluez5.bap-server-capabilities.rates = [16000]
bluez5.bap-server-capabilities.durations = [10]
bluez5.bap-server-capabilities.channels = [1, 2]
bluez5.bap-server-capabilities.framelen_min = 40
bluez5.bap-server-capabilities.framelen_max = 40
bluez5.bap-server-capabilities.max_frames = 2
This commit is contained in:
Iulia Tanasescu 2024-11-29 16:55:40 +02:00 committed by Wim Taymans
parent b5490954d0
commit 9a5b2d42f9
12 changed files with 204 additions and 22 deletions

View file

@ -25,15 +25,42 @@
LC3_FREQ_44KHZ | \
LC3_FREQ_48KHZ)
#define LC3_VAL_FREQ_8KHZ 8000
#define LC3_VAL_FREQ_11KHZ 11025
#define LC3_VAL_FREQ_16KHZ 16000
#define LC3_VAL_FREQ_22KHZ 22050
#define LC3_VAL_FREQ_24KHZ 24000
#define LC3_VAL_FREQ_32KHZ 32000
#define LC3_VAL_FREQ_44KHZ 44100
#define LC3_VAL_FREQ_48KHZ 48000
#define LC3_TYPE_DUR 0x02
#define LC3_DUR_7_5 (1 << 0)
#define LC3_DUR_10 (1 << 1)
#define LC3_DUR_ANY (LC3_DUR_7_5 | \
LC3_DUR_10)
#define LC3_VAL_DUR_7_5 7.5
#define LC3_VAL_DUR_10 10
#define LC3_TYPE_CHAN 0x03
#define LC3_CHAN_1 (1 << 0)
#define LC3_CHAN_2 (1 << 1)
#define LC3_CHAN_3 (1 << 2)
#define LC3_CHAN_4 (1 << 3)
#define LC3_CHAN_5 (1 << 4)
#define LC3_CHAN_6 (1 << 5)
#define LC3_CHAN_7 (1 << 6)
#define LC3_CHAN_8 (1 << 7)
#define LC3_VAL_CHAN_1 1
#define LC3_VAL_CHAN_2 2
#define LC3_VAL_CHAN_3 3
#define LC3_VAL_CHAN_4 4
#define LC3_VAL_CHAN_5 5
#define LC3_VAL_CHAN_6 6
#define LC3_VAL_CHAN_7 7
#define LC3_VAL_CHAN_8 8
#define LC3_TYPE_FRAMELEN 0x04
#define LC3_TYPE_BLKS 0x05