Skip to content

Commit 69f7fd9

Browse files
Thalleyaescolar
authored andcommitted
Bluetooth: Audio: Rename bt_codec to bt_audio_codec_{cap, conf, data}
Rename the bt_codec struct to bt_audio_codec_conf or to the new struct bt_audio_codec_cap. Rename the bt_codec_data to bt_audio_codec_data. The purpose of this is to split the codec specific configuration and codec capabilities into seperate structs, as they do not reflect the same values, or used for the same purpose. This commit depends on the preset macros workings on either type of struct (for now), but will be modified in future updates. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 33b1164 commit 69f7fd9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1864
-1671
lines changed

include/zephyr/bluetooth/audio/audio.h

Lines changed: 110 additions & 84 deletions
Large diffs are not rendered by default.

include/zephyr/bluetooth/audio/bap.h

Lines changed: 59 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,10 @@ struct bt_bap_stream {
455455
struct bt_bap_ep *ep;
456456

457457
/** Codec Configuration */
458-
struct bt_codec *codec;
458+
struct bt_audio_codec_cfg *codec_cfg;
459459

460460
/** QoS Configuration */
461-
struct bt_codec_qos *qos;
461+
struct bt_audio_codec_qos *qos;
462462

463463
/** Audio stream operations */
464464
struct bt_bap_stream_ops *ops;
@@ -493,7 +493,8 @@ struct bt_bap_stream_ops {
493493
* @param stream Stream object that has been configured.
494494
* @param pref Remote QoS preferences.
495495
*/
496-
void (*configured)(struct bt_bap_stream *stream, const struct bt_codec_qos_pref *pref);
496+
void (*configured)(struct bt_bap_stream *stream,
497+
const struct bt_audio_codec_qos_pref *pref);
497498

498499
/**
499500
* @brief Stream QoS set callback
@@ -614,12 +615,12 @@ void bt_bap_stream_cb_register(struct bt_bap_stream *stream, struct bt_bap_strea
614615
* @param conn Connection object
615616
* @param stream Stream object being configured
616617
* @param ep Remote Audio Endpoint being configured
617-
* @param codec Codec configuration
618+
* @param codec_cfg Codec configuration
618619
*
619620
* @return Allocated Audio Stream object or NULL in case of error.
620621
*/
621622
int bt_bap_stream_config(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_bap_ep *ep,
622-
struct bt_codec *codec);
623+
struct bt_audio_codec_cfg *codec_cfg);
623624

624625
/**
625626
* @brief Reconfigure Audio Stream
@@ -630,11 +631,11 @@ int bt_bap_stream_config(struct bt_conn *conn, struct bt_bap_stream *stream, str
630631
* This can only be done for unicast streams.
631632
*
632633
* @param stream Stream object being reconfigured
633-
* @param codec Codec configuration
634+
* @param codec_cfg Codec configuration
634635
*
635636
* @return 0 in case of success or negative value in case of error.
636637
*/
637-
int bt_bap_stream_reconfig(struct bt_bap_stream *stream, struct bt_codec *codec);
638+
int bt_bap_stream_reconfig(struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg);
638639

639640
/**
640641
* @brief Configure Audio Stream QoS
@@ -664,7 +665,7 @@ int bt_bap_stream_qos(struct bt_conn *conn, struct bt_bap_unicast_group *group);
664665
*
665666
* @return 0 in case of success or negative value in case of error.
666667
*/
667-
int bt_bap_stream_enable(struct bt_bap_stream *stream, struct bt_codec_data *meta,
668+
int bt_bap_stream_enable(struct bt_bap_stream *stream, struct bt_audio_codec_data *meta,
668669
size_t meta_count);
669670

670671
/**
@@ -678,7 +679,7 @@ int bt_bap_stream_enable(struct bt_bap_stream *stream, struct bt_codec_data *met
678679
*
679680
* @return 0 in case of success or negative value in case of error.
680681
*/
681-
int bt_bap_stream_metadata(struct bt_bap_stream *stream, struct bt_codec_data *meta,
682+
int bt_bap_stream_metadata(struct bt_bap_stream *stream, struct bt_audio_codec_data *meta,
682683
size_t meta_count);
683684

684685
/**
@@ -787,41 +788,41 @@ struct bt_bap_unicast_server_cb {
787788
* Config callback is called whenever an endpoint is requested to be
788789
* configured
789790
*
790-
* @param[in] conn Connection object.
791-
* @param[in] ep Local Audio Endpoint being configured.
792-
* @param[in] dir Direction of the endpoint.
793-
* @param[in] codec Codec configuration.
794-
* @param[out] stream Pointer to stream that will be configured for the endpoint.
795-
* @param[out] pref Pointer to a QoS preference object that shall be populated with
796-
* values. Invalid values will reject the codec configuration request.
797-
* @param[out] rsp Object for the ASE operation response. Only used if the return
798-
* value is non-zero.
791+
* @param[in] conn Connection object.
792+
* @param[in] ep Local Audio Endpoint being configured.
793+
* @param[in] dir Direction of the endpoint.
794+
* @param[in] codec_cfg Codec configuration.
795+
* @param[out] stream Pointer to stream that will be configured for the endpoint.
796+
* @param[out] pref Pointer to a QoS preference object that shall be populated with
797+
* values. Invalid values will reject the codec configuration request.
798+
* @param[out] rsp Object for the ASE operation response. Only used if the return
799+
* value is non-zero.
799800
*
800801
* @return 0 in case of success or negative value in case of error.
801802
*/
802803
int (*config)(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir,
803-
const struct bt_codec *codec, struct bt_bap_stream **stream,
804-
struct bt_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp);
804+
const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream,
805+
struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp);
805806

806807
/**
807808
* @brief Stream reconfig request callback
808809
*
809810
* Reconfig callback is called whenever an Audio Stream needs to be
810811
* reconfigured with different codec configuration.
811812
*
812-
* @param[in] stream Stream object being reconfigured.
813-
* @param[in] dir Direction of the endpoint.
814-
* @param[in] codec Codec configuration.
815-
* @param[out] pref Pointer to a QoS preference object that shall be populated with
816-
* values. Invalid values will reject the codec configuration request.
817-
* @param[out] rsp Object for the ASE operation response. Only used if the return
818-
* value is non-zero.
813+
* @param[in] stream Stream object being reconfigured.
814+
* @param[in] dir Direction of the endpoint.
815+
* @param[in] codec_cfg Codec configuration.
816+
* @param[out] pref Pointer to a QoS preference object that shall be populated with
817+
* values. Invalid values will reject the codec configuration request.
818+
* @param[out] rsp Object for the ASE operation response. Only used if the return
819+
* value is non-zero.
819820
*
820821
* @return 0 in case of success or negative value in case of error.
821822
*/
822823
int (*reconfig)(struct bt_bap_stream *stream, enum bt_audio_dir dir,
823-
const struct bt_codec *codec, struct bt_codec_qos_pref *const pref,
824-
struct bt_bap_ascs_rsp *rsp);
824+
const struct bt_audio_codec_cfg *codec_cfg,
825+
struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp);
825826

826827
/**
827828
* @brief Stream QoS request callback
@@ -836,7 +837,7 @@ struct bt_bap_unicast_server_cb {
836837
*
837838
* @return 0 in case of success or negative value in case of error.
838839
*/
839-
int (*qos)(struct bt_bap_stream *stream, const struct bt_codec_qos *qos,
840+
int (*qos)(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos,
840841
struct bt_bap_ascs_rsp *rsp);
841842

842843
/**
@@ -852,7 +853,7 @@ struct bt_bap_unicast_server_cb {
852853
*
853854
* @return 0 in case of success or negative value in case of error.
854855
*/
855-
int (*enable)(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
856+
int (*enable)(struct bt_bap_stream *stream, const struct bt_audio_codec_data *meta,
856857
size_t meta_count, struct bt_bap_ascs_rsp *rsp);
857858

858859
/**
@@ -881,7 +882,7 @@ struct bt_bap_unicast_server_cb {
881882
*
882883
* @return 0 in case of success or negative value in case of error.
883884
*/
884-
int (*metadata)(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
885+
int (*metadata)(struct bt_bap_stream *stream, const struct bt_audio_codec_data *meta,
885886
size_t meta_count, struct bt_bap_ascs_rsp *rsp);
886887

887888
/**
@@ -972,14 +973,14 @@ void bt_bap_unicast_server_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t fun
972973
*
973974
* @param conn Connection object
974975
* @param stream Configured stream object to be attached to the ASE
975-
* @param codec Codec configuration
976+
* @param codec_cfg Codec configuration
976977
* @param qos_pref Audio Stream Quality of Service Preference
977978
*
978979
* @return 0 in case of success or negative value in case of error.
979980
*/
980981
int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream,
981-
struct bt_codec *codec,
982-
const struct bt_codec_qos_pref *qos_pref);
982+
struct bt_audio_codec_cfg *codec_cfg,
983+
const struct bt_audio_codec_qos_pref *qos_pref);
983984

984985
/** @} */ /* End of group bt_bap_unicast_server */
985986

@@ -995,7 +996,7 @@ struct bt_bap_unicast_group_stream_param {
995996
struct bt_bap_stream *stream;
996997

997998
/** The QoS settings for the stream object. */
998-
struct bt_codec_qos *qos;
999+
struct bt_audio_codec_qos *qos;
9991000
};
10001001

10011002
/** @brief Parameter struct for the unicast group functions
@@ -1031,7 +1032,7 @@ struct bt_bap_unicast_group_param {
10311032
* @brief Create audio unicast group.
10321033
*
10331034
* Create a new audio unicast group with one or more audio streams as a unicast client. Streams in
1034-
* a unicast group shall share the same interval, framing and latency (see @ref bt_codec_qos).
1035+
* a unicast group shall share the same interval, framing and latency (see @ref bt_audio_codec_qos).
10351036
*
10361037
* @param[in] param The unicast group create parameters.
10371038
* @param[out] unicast_group Pointer to the unicast group created.
@@ -1224,14 +1225,14 @@ struct bt_bap_unicast_client_cb {
12241225
* The @p codec is only valid while in the callback, so the values must be stored by the
12251226
* receiver if future use is wanted.
12261227
*
1227-
* @param conn Connection to the remote unicast server.
1228-
* @param dir The type of remote endpoints and capabilities discovered.
1229-
* @param codec Remote capabilities.
1228+
* @param conn Connection to the remote unicast server.
1229+
* @param dir The type of remote endpoints and capabilities discovered.
1230+
* @param codec_cap Remote capabilities.
12301231
*
12311232
* If discovery procedure has complete both @p codec and @p ep are set to NULL.
12321233
*/
12331234
void (*pac_record)(struct bt_conn *conn, enum bt_audio_dir dir,
1234-
const struct bt_codec *codec);
1235+
const struct bt_audio_codec_cap *codec_cap);
12351236

12361237
/**
12371238
* @brief Remote Audio Stream Endoint (ASE) discovered
@@ -1295,18 +1296,18 @@ int bt_bap_unicast_client_discover(struct bt_conn *conn, enum bt_audio_dir dir);
12951296
struct bt_bap_base_bis_data {
12961297
/* Unique index of the BIS */
12971298
uint8_t index;
1298-
#if defined(CONFIG_BT_CODEC_MAX_DATA_COUNT)
1299+
#if defined(CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_COUNT)
12991300
/** Codec Specific Data count.
13001301
*
1301-
* Only valid if the data_count of struct bt_codec in the subgroup is 0
1302+
* Only valid if the data_count of struct bt_audio_codec_cfg in the subgroup is 0
13021303
*/
13031304
size_t data_count;
13041305
/** Codec Specific Data
13051306
*
1306-
* Only valid if the data_count of struct bt_codec in the subgroup is 0
1307+
* Only valid if the data_count of struct bt_audio_codec_cfg in the subgroup is 0
13071308
*/
1308-
struct bt_codec_data data[CONFIG_BT_CODEC_MAX_DATA_COUNT];
1309-
#endif /* CONFIG_BT_CODEC_MAX_DATA_COUNT */
1309+
struct bt_audio_codec_data data[CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_COUNT];
1310+
#endif /* CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_COUNT */
13101311
};
13111312

13121313
struct bt_bap_base_subgroup {
@@ -1317,7 +1318,7 @@ struct bt_bap_base_subgroup {
13171318
* If the data_count of the codec is 0, then codec specific data may be
13181319
* found for each BIS in the bis_data.
13191320
*/
1320-
struct bt_codec codec;
1321+
struct bt_audio_codec_cfg codec_cfg;
13211322
/* Array of BIS specific data for each BIS in the subgroup */
13221323
struct bt_bap_base_bis_data bis_data[BROADCAST_SNK_STREAM_CNT];
13231324
};
@@ -1362,7 +1363,7 @@ struct bt_bap_broadcast_source_stream_param {
13621363
/** Audio stream */
13631364
struct bt_bap_stream *stream;
13641365

1365-
#if CONFIG_BT_CODEC_MAX_DATA_COUNT > 0
1366+
#if CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_COUNT > 0
13661367
/**
13671368
* @brief The number of elements in the @p data array.
13681369
*
@@ -1371,8 +1372,8 @@ struct bt_bap_broadcast_source_stream_param {
13711372
size_t data_count;
13721373

13731374
/** BIS Codec Specific Configuration */
1374-
struct bt_codec_data *data;
1375-
#endif /* CONFIG_BT_CODEC_MAX_DATA_COUNT > 0 */
1375+
struct bt_audio_codec_data *data;
1376+
#endif /* CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_COUNT > 0 */
13761377
};
13771378

13781379
/** Broadcast Source subgroup parameters*/
@@ -1384,7 +1385,7 @@ struct bt_bap_broadcast_source_subgroup_param {
13841385
struct bt_bap_broadcast_source_stream_param *params;
13851386

13861387
/** Subgroup Codec configuration. */
1387-
struct bt_codec *codec;
1388+
struct bt_audio_codec_cfg *codec_cfg;
13881389
};
13891390

13901391
/** Broadcast Source create parameters */
@@ -1396,7 +1397,7 @@ struct bt_bap_broadcast_source_create_param {
13961397
struct bt_bap_broadcast_source_subgroup_param *params;
13971398

13981399
/** Quality of Service configuration. */
1399-
struct bt_codec_qos *qos;
1400+
struct bt_audio_codec_qos *qos;
14001401

14011402
/**
14021403
* @brief Broadcast Source packing mode.
@@ -1449,13 +1450,14 @@ int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_create_param *
14491450
* service parameters. This can only be done when the source is stopped.
14501451
*
14511452
* @param source Pointer to the broadcast source
1452-
* @param codec Codec configuration.
1453+
* @param codec_cfg Codec configuration.
14531454
* @param qos Quality of Service configuration
14541455
*
14551456
* @return Zero on success or (negative) error code otherwise.
14561457
*/
1457-
int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, struct bt_codec *codec,
1458-
struct bt_codec_qos *qos);
1458+
int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source,
1459+
struct bt_audio_codec_cfg *codec_cfg,
1460+
struct bt_audio_codec_qos *qos);
14591461

14601462
/**
14611463
* @brief Modify the metadata of an audio broadcast source.
@@ -1470,7 +1472,8 @@ int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, str
14701472
* @return Zero on success or (negative) error code otherwise.
14711473
*/
14721474
int bt_bap_broadcast_source_update_metadata(struct bt_bap_broadcast_source *source,
1473-
const struct bt_codec_data meta[], size_t meta_count);
1475+
const struct bt_audio_codec_data meta[],
1476+
size_t meta_count);
14741477

14751478
/**
14761479
* @brief Start audio broadcast source.

0 commit comments

Comments
 (0)