Bluetooth: Audio: BT_AUDIO_CODEC_LC3_ID -> BT_HCI_CODING_FORMAT_LC3

Replace the BT_AUDIO_CODEC_LC3_ID macro with the
BT_HCI_CODING_FORMAT_LC3 as there is no reason to
define and use the LC3 ID different than the other
allowed codec IDs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2023-09-12 10:38:43 +02:00 committed by Fabio Baltieri
commit f93caa3903
14 changed files with 20 additions and 22 deletions

View file

@ -20,16 +20,12 @@
#include <zephyr/sys/util_macro.h>
#include <zephyr/bluetooth/byteorder.h>
#include <zephyr/bluetooth/hci_types.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LC3 codec ID
*/
#define BT_AUDIO_CODEC_LC3_ID 0x06
/**
* @brief Codec capability type id's
*
@ -292,7 +288,7 @@ enum bt_audio_codec_config_type {
*/
#define BT_AUDIO_CODEC_CAP_LC3(_freq, _duration, _chan_count, _len_min, _len_max, \
_max_frames_per_sdu, _prefer_context) \
BT_AUDIO_CODEC_CAP(BT_AUDIO_CODEC_LC3_ID, 0x0000, 0x0000, \
BT_AUDIO_CODEC_CAP(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, \
BT_AUDIO_CODEC_CAP_LC3_DATA(_freq, _duration, _chan_count, _len_min, \
_len_max, _max_frames_per_sdu), \
BT_AUDIO_CODEC_CAP_LC3_META(_prefer_context))
@ -341,7 +337,7 @@ enum bt_audio_codec_config_type {
*/
#define BT_AUDIO_CODEC_LC3_CONFIG(_freq, _duration, _loc, _len, _frames_per_sdu, _stream_context) \
BT_AUDIO_CODEC_CFG( \
BT_AUDIO_CODEC_LC3_ID, 0x0000, 0x0000, \
BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, \
BT_AUDIO_CODEC_CFG_LC3_DATA(_freq, _duration, _loc, _len, _frames_per_sdu), \
BT_AUDIO_CODEC_CFG_LC3_META(_stream_context))

View file

@ -749,6 +749,8 @@ struct bt_hci_rp_read_bd_addr {
#define BT_HCI_CODING_FORMAT_TRANSPARENT 0x03
#define BT_HCI_CODING_FORMAT_LINEAR_PCM 0x04
#define BT_HCI_CODING_FORMAT_MSBC 0x05
#define BT_HCI_CODING_FORMAT_LC3 0x06
#define BT_HCI_CODING_FORMAT_G729A 0x07
#define BT_HCI_CODING_FORMAT_VS 0xFF

View file

@ -74,7 +74,7 @@ static void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg)
printk("codec_cfg 0x%02x cid 0x%04x vid 0x%04x count %u\n", codec_cfg->id, codec_cfg->cid,
codec_cfg->vid, codec_cfg->data_len);
if (codec_cfg->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cfg->id == BT_HCI_CODING_FORMAT_LC3) {
/* LC3 uses the generic LTV format - other codecs might do as well */
enum bt_audio_location chan_allocation;

View file

@ -196,7 +196,7 @@ static void print_remote_codec(const struct bt_audio_codec_cap *codec_cap, enum
printk("codec id 0x%02x cid 0x%04x vid 0x%04x count %u\n", codec_cap->id, codec_cap->cid,
codec_cap->vid, codec_cap->data_len);
if (codec_cap->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cap->id == BT_HCI_CODING_FORMAT_LC3) {
bt_audio_data_parse(codec_cap->data, codec_cap->data_len, print_cb, "data");
} else { /* If not LC3, we cannot assume it's LTV */
printk("data: ");

View file

@ -63,7 +63,7 @@ static void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg)
printk("codec_cfg 0x%02x cid 0x%04x vid 0x%04x count %u\n", codec_cfg->id, codec_cfg->cid,
codec_cfg->vid, codec_cfg->data_len);
if (codec_cfg->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cfg->id == BT_HCI_CODING_FORMAT_LC3) {
/* LC3 uses the generic LTV format - other codecs might do as well */
enum bt_audio_location chan_allocation;

View file

@ -369,7 +369,7 @@ static void print_codec_cap(const struct bt_audio_codec_cap *codec_cap)
printk("codec id 0x%02x cid 0x%04x vid 0x%04x count %u\n", codec_cap->id, codec_cap->cid,
codec_cap->vid, codec_cap->data_len);
if (codec_cap->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cap->id == BT_HCI_CODING_FORMAT_LC3) {
bt_audio_data_parse(codec_cap->data, codec_cap->data_len, print_cb, "data");
} else { /* If not LC3, we cannot assume it's LTV */
printk("data: ");

View file

@ -134,7 +134,7 @@ static void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg)
printk("codec_cfg 0x%02x cid 0x%04x vid 0x%04x count %u\n", codec_cfg->id, codec_cfg->cid,
codec_cfg->vid, codec_cfg->data_len);
if (codec_cfg->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cfg->id == BT_HCI_CODING_FORMAT_LC3) {
/* LC3 uses the generic LTV format - other codecs might do as well */
enum bt_audio_location chan_allocation;

View file

@ -195,7 +195,7 @@ bool bt_audio_valid_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg)
return false;
}
if (codec_cfg->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cfg->id == BT_HCI_CODING_FORMAT_LC3) {
if (codec_cfg->cid != 0U) {
LOG_DBG("codec_cfg->cid (%u) is invalid", codec_cfg->cid);
return false;

View file

@ -1212,7 +1212,7 @@ static int unicast_client_set_codec_cap(uint8_t id, uint16_t cid, uint16_t vid,
/* If codec is LC3, then it shall be LTV encoded - We verify this before storing the
* data For any non-LC3 codecs, we cannot verify anything
*/
if (id == BT_AUDIO_CODEC_LC3_ID) {
if (id == BT_HCI_CODING_FORMAT_LC3) {
bt_data_parse(&buf, valid_ltv_cb, NULL);
/* Check if all entries could be parsed */

View file

@ -185,7 +185,7 @@ static inline void print_codec_cap(const struct shell *sh,
codec_cap->cid, codec_cap->vid, codec_cap->data_len);
#if CONFIG_BT_AUDIO_CODEC_CAP_MAX_DATA_SIZE > 0
if (codec_cap->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cap->id == BT_HCI_CODING_FORMAT_LC3) {
print_ltv_array(sh, "data", codec_cap->data, codec_cap->data_len);
} else { /* If not LC3, we cannot assume it's LTV */
shell_hexdump(sh, codec_cap->data, codec_cap->data_len);
@ -204,7 +204,7 @@ static inline void print_codec_cfg(const struct shell *sh,
codec_cfg->cid, codec_cfg->vid, codec_cfg->data_len);
#if CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE > 0
if (codec_cfg->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cfg->id == BT_HCI_CODING_FORMAT_LC3) {
print_ltv_array(sh, "data", codec_cfg->data, codec_cfg->data_len);
} else { /* If not LC3, we cannot assume it's LTV */
shell_hexdump(sh, codec_cfg->data, codec_cfg->data_len);

View file

@ -1726,7 +1726,7 @@ static void base_recv(struct bt_bap_broadcast_sink *sink, const struct bt_bap_ba
shell_print(ctx_shell, "%4sBIS[%d] index 0x%02x", "", i, bis_data->index);
bis_indexes[index_count++] = bis_data->index;
if (subgroup->codec_cfg.id == BT_AUDIO_CODEC_LC3_ID) {
if (subgroup->codec_cfg.id == BT_HCI_CODING_FORMAT_LC3) {
const int err =
bt_audio_data_parse(bis_data->data, bis_data->data_len,
print_data_func_cb, NULL);

View file

@ -110,7 +110,7 @@ static void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg)
LOG_DBG("codec_cfg 0x%02x cid 0x%04x vid 0x%04x count %u", codec_cfg->id, codec_cfg->cid,
codec_cfg->vid, codec_cfg->data_len);
if (codec_cfg->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cfg->id == BT_HCI_CODING_FORMAT_LC3) {
/* LC3 uses the generic LTV format - other codecs might do as well */
enum bt_audio_location chan_allocation;
@ -140,7 +140,7 @@ static void print_codec_cap(const struct bt_audio_codec_cap *codec_cap)
LOG_DBG("codec_cap 0x%02x cid 0x%04x vid 0x%04x count %zu", codec_cap->id, codec_cap->cid,
codec_cap->vid, codec_cap->data_len);
if (codec_cap->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cap->id == BT_HCI_CODING_FORMAT_LC3) {
bt_audio_data_parse(codec_cap->data, codec_cap->data_len, print_cb, "data");
} else {
LOG_HEXDUMP_DBG(codec_cap->data, codec_cap->data_len, "data");

View file

@ -48,7 +48,7 @@ void print_codec_cap(const struct bt_audio_codec_cap *codec_cap)
printk("codec_cap ID 0x%02x cid 0x%04x vid 0x%04x count %u\n", codec_cap->id,
codec_cap->cid, codec_cap->vid, codec_cap->data_len);
if (codec_cap->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cap->id == BT_HCI_CODING_FORMAT_LC3) {
print_ltv_array("data", codec_cap->data, codec_cap->data_len);
} else { /* If not LC3, we cannot assume it's LTV */
printk("data: ");
@ -64,7 +64,7 @@ void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg)
printk("codec_cfg ID 0x%02x cid 0x%04x vid 0x%04x count %u\n", codec_cfg->id,
codec_cfg->cid, codec_cfg->vid, codec_cfg->data_len);
if (codec_cfg->id == BT_AUDIO_CODEC_LC3_ID) {
if (codec_cfg->id == BT_HCI_CODING_FORMAT_LC3) {
print_ltv_array("data", codec_cfg->data, codec_cfg->data_len);
} else { /* If not LC3, we cannot assume it's LTV */
printk("data: ");

View file

@ -21,7 +21,7 @@ extern enum bst_result_t bst_result;
static const struct bt_audio_codec_cap lc3_codec_cap = {
.path_id = BT_ISO_DATA_PATH_HCI,
.id = BT_AUDIO_CODEC_LC3_ID,
.id = BT_HCI_CODING_FORMAT_LC3,
.cid = 0x0000U,
.vid = 0x0000U,
.data_len = (3 + 1) + (2 + 1) + (2 + 1) + (5 + 1) + (2 + 1),