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).
This commit is contained in:
Pauli Virtanen 2021-01-25 22:06:34 +02:00 committed by Wim Taymans
parent e860f2bb4e
commit b642c7f209
4 changed files with 73 additions and 24 deletions

View file

@ -125,16 +125,11 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
a2dp_sbc_t conf;
int bitpool;
bool xq = false;
const char *str;
if (caps_size < sizeof(conf))
return -EINVAL;
if (settings) {
if ((str = spa_dict_lookup(settings, "codec.sbc.enable-xq")) != NULL &&
(strcmp(str, "true") == 0 || atoi(str)))
xq = true;
}
xq = (strcmp(codec->name, "sbc_xq") == 0);
memcpy(&conf, caps, sizeof(conf));
@ -587,3 +582,25 @@ const struct a2dp_codec a2dp_codec_sbc = {
.reduce_bitpool = codec_reduce_bitpool,
.increase_bitpool = codec_increase_bitpool,
};
const struct a2dp_codec a2dp_codec_sbc_xq = {
.codec_id = A2DP_CODEC_SBC,
.name = "sbc_xq",
.description = "SBC-XQ",
.fill_caps = codec_fill_caps,
.select_config = codec_select_config,
.enum_config = codec_enum_config,
.validate_config = codec_validate_config,
.init = codec_init,
.deinit = codec_deinit,
.get_block_size = codec_get_block_size,
.get_num_blocks = codec_get_num_blocks,
.abr_process = codec_abr_process,
.start_encode = codec_start_encode,
.encode = codec_encode,
.start_decode = codec_start_decode,
.decode = codec_decode,
.reduce_bitpool = codec_reduce_bitpool,
.increase_bitpool = codec_increase_bitpool,
.feature_flag = "sbc-xq",
};