@@ -30,34 +30,33 @@ extern "C" {
3030/** MPEG2,4 IE length */
3131#define BT_A2DP_MPEG_2_4_IE_LENGTH (6u)
3232/** The max IE (Codec Info Element) length */
33- #define A2DP_MAX_IE_LENGTH (8U)
33+ #define A2DP_MAX_IE_LENGTH (8U)
3434
3535/** @brief define the audio endpoint
3636 * @param _role BT_AVDTP_SOURCE or BT_AVDTP_SINK.
3737 * @param _codec value of enum bt_a2dp_codec_id.
3838 * @param _capability the codec capability.
3939 */
40- #define BT_A2DP_EP_INIT (_role , _codec , _capability )\
41- {\
42- .codec_type = _codec,\
43- .sep = {.sep_info = {.media_type = BT_AVDTP_AUDIO, .tsep = _role}},\
44- .codec_cap = _capability,\
45- .stream = NULL,\
46- }
40+ #define BT_A2DP_EP_INIT (_role , _codec , _capability ) \
41+ { \
42+ .codec_type = _codec, \
43+ .sep = {.sep_info = {.media_type = BT_AVDTP_AUDIO, .tsep = _role}}, \
44+ .codec_cap = _capability, .stream = NULL, \
45+ }
4746
4847/** @brief define the audio sink endpoint
4948 * @param _codec value of enum bt_a2dp_codec_id.
5049 * @param _capability the codec capability.
5150 */
52- #define BT_A2DP_SINK_EP_INIT (_codec , _capability )\
53- BT_A2DP_EP_INIT(BT_AVDTP_SINK, _codec, _capability)
51+ #define BT_A2DP_SINK_EP_INIT (_codec , _capability ) \
52+ BT_A2DP_EP_INIT(BT_AVDTP_SINK, _codec, _capability)
5453
5554/** @brief define the audio source endpoint
5655 * @param _codec value of enum bt_a2dp_codec_id.
5756 * @param _capability the codec capability.
5857 */
59- #define BT_A2DP_SOURCE_EP_INIT (_codec , _capability )\
60- BT_A2DP_EP_INIT(BT_AVDTP_SOURCE, _codec, _capability)
58+ #define BT_A2DP_SOURCE_EP_INIT (_codec , _capability ) \
59+ BT_A2DP_EP_INIT(BT_AVDTP_SOURCE, _codec, _capability)
6160
6261/** @brief define the SBC sink endpoint that can be used as
6362 * bt_a2dp_register_endpoint's parameter.
@@ -80,13 +79,14 @@ BT_A2DP_EP_INIT(BT_AVDTP_SOURCE, _codec, _capability)
8079 * @param _max_bitpool sbc codec max bit pool. for example: 35
8180 * @
8281 */
83- #define BT_A2DP_SBC_SINK_EP (_name , _freq , _ch_mode , _blk_len , _subband ,\
84- _alloc_mthd , _min_bitpool , _max_bitpool )\
85- static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name =\
86- {.len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {_freq | _ch_mode,\
87- _blk_len | _subband | _alloc_mthd, _min_bitpool, _max_bitpool}};\
88- static struct bt_a2dp_ep _name = BT_A2DP_SINK_EP_INIT(BT_A2DP_SBC,\
89- (&bt_a2dp_ep_cap_ie##_name))
82+ #define BT_A2DP_SBC_SINK_EP (_name , _freq , _ch_mode , _blk_len , _subband , _alloc_mthd , _min_bitpool , \
83+ _max_bitpool ) \
84+ static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name = { \
85+ .len = BT_A2DP_SBC_IE_LENGTH, \
86+ .codec_ie = {_freq | _ch_mode, _blk_len | _subband | _alloc_mthd, _min_bitpool, \
87+ _max_bitpool}}; \
88+ static struct bt_a2dp_ep _name = \
89+ BT_A2DP_SINK_EP_INIT(BT_A2DP_SBC, (&bt_a2dp_ep_cap_ie##_name))
9090
9191/** @brief define the SBC source endpoint that can be used as bt_a2dp_register_endpoint's
9292 * parameter.
@@ -108,13 +108,14 @@ static struct bt_a2dp_ep _name = BT_A2DP_SINK_EP_INIT(BT_A2DP_SBC,\
108108 * @param _min_bitpool sbc codec min bit pool. for example: 18
109109 * @param _max_bitpool sbc codec max bit pool. for example: 35
110110 */
111- #define BT_A2DP_SBC_SOURCE_EP (_name , _freq , _ch_mode , _blk_len , _subband ,\
112- _alloc_mthd , _min_bitpool , _max_bitpool )\
113- static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name =\
114- {.len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {_freq | _ch_mode,\
115- _blk_len | _subband | _alloc_mthd, _min_bitpool, _max_bitpool}};\
116- static struct bt_a2dp_ep _name = BT_A2DP_SOURCE_EP_INIT(BT_A2DP_SBC,\
117- &bt_a2dp_ep_cap_ie##_name)
111+ #define BT_A2DP_SBC_SOURCE_EP (_name , _freq , _ch_mode , _blk_len , _subband , _alloc_mthd , \
112+ _min_bitpool , _max_bitpool ) \
113+ static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name = { \
114+ .len = BT_A2DP_SBC_IE_LENGTH, \
115+ .codec_ie = {_freq | _ch_mode, _blk_len | _subband | _alloc_mthd, _min_bitpool, \
116+ _max_bitpool}}; \
117+ static struct bt_a2dp_ep _name = \
118+ BT_A2DP_SOURCE_EP_INIT(BT_A2DP_SBC, &bt_a2dp_ep_cap_ie##_name)
118119
119120/** @brief define the default SBC sink endpoint that can be used as
120121 * bt_a2dp_register_endpoint's parameter.
@@ -124,14 +125,17 @@ static struct bt_a2dp_ep _name = BT_A2DP_SOURCE_EP_INIT(BT_A2DP_SBC,\
124125 *
125126 * @param _name the endpoint variable name.
126127 */
127- #define BT_A2DP_SBC_SINK_EP_DEFAULT (_name )\
128- static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name =\
129- {.len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {A2DP_SBC_SAMP_FREQ_44100 |\
130- A2DP_SBC_SAMP_FREQ_48000 | A2DP_SBC_CH_MODE_MONO | A2DP_SBC_CH_MODE_STREO |\
131- A2DP_SBC_CH_MODE_JOINT, A2DP_SBC_BLK_LEN_16 |\
132- A2DP_SBC_SUBBAND_8 | A2DP_SBC_ALLOC_MTHD_LOUDNESS, 18U, 35U}};\
133- static struct bt_a2dp_ep _name = BT_A2DP_SINK_EP_INIT(BT_A2DP_SBC,\
134- &bt_a2dp_ep_cap_ie##_name)
128+ #define BT_A2DP_SBC_SINK_EP_DEFAULT (_name ) \
129+ static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name = { \
130+ .len = BT_A2DP_SBC_IE_LENGTH, \
131+ .codec_ie = {A2DP_SBC_SAMP_FREQ_44100 | A2DP_SBC_SAMP_FREQ_48000 | \
132+ A2DP_SBC_CH_MODE_MONO | A2DP_SBC_CH_MODE_STREO | \
133+ A2DP_SBC_CH_MODE_JOINT, \
134+ A2DP_SBC_BLK_LEN_16 | A2DP_SBC_SUBBAND_8 | \
135+ A2DP_SBC_ALLOC_MTHD_LOUDNESS, \
136+ 18U, 35U}}; \
137+ static struct bt_a2dp_ep _name = \
138+ BT_A2DP_SINK_EP_INIT(BT_A2DP_SBC, &bt_a2dp_ep_cap_ie##_name)
135139
136140/** @brief define the default SBC source endpoint that can be used as bt_a2dp_register_endpoint's
137141 * parameter.
@@ -141,14 +145,18 @@ static struct bt_a2dp_ep _name = BT_A2DP_SINK_EP_INIT(BT_A2DP_SBC,\
141145 *
142146 * @param _name the endpoint variable name.
143147 */
144- #define BT_A2DP_SBC_SOURCE_EP_DEFAULT (_name )\
145- static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name =\
146- {.len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {A2DP_SBC_SAMP_FREQ_44100 | \
147- A2DP_SBC_SAMP_FREQ_48000 | A2DP_SBC_CH_MODE_MONO | A2DP_SBC_CH_MODE_STREO | \
148- A2DP_SBC_CH_MODE_JOINT, A2DP_SBC_BLK_LEN_16 | A2DP_SBC_SUBBAND_8 | A2DP_SBC_ALLOC_MTHD_LOUDNESS,\
149- 18U, 35U},};\
150- static struct bt_a2dp_ep _name = BT_A2DP_SOURCE_EP_INIT(BT_A2DP_SBC,\
151- &bt_a2dp_ep_cap_ie##_name)
148+ #define BT_A2DP_SBC_SOURCE_EP_DEFAULT (_name ) \
149+ static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name = { \
150+ .len = BT_A2DP_SBC_IE_LENGTH, \
151+ .codec_ie = {A2DP_SBC_SAMP_FREQ_44100 | A2DP_SBC_SAMP_FREQ_48000 | \
152+ A2DP_SBC_CH_MODE_MONO | A2DP_SBC_CH_MODE_STREO | \
153+ A2DP_SBC_CH_MODE_JOINT, \
154+ A2DP_SBC_BLK_LEN_16 | A2DP_SBC_SUBBAND_8 | \
155+ A2DP_SBC_ALLOC_MTHD_LOUDNESS, \
156+ 18U, 35U}, \
157+ }; \
158+ static struct bt_a2dp_ep _name = \
159+ BT_A2DP_SOURCE_EP_INIT(BT_A2DP_SBC, &bt_a2dp_ep_cap_ie##_name)
152160
153161/** @brief define the SBC default configuration.
154162 *
@@ -166,23 +174,34 @@ static struct bt_a2dp_ep _name = BT_A2DP_SOURCE_EP_INIT(BT_A2DP_SBC,\
166174 * @param _min_bitpool_cfg sbc codec min bit pool. for example: 18
167175 * @param _max_bitpool_cfg sbc codec max bit pool. for example: 35
168176 */
169- #define BT_A2DP_SBC_EP_CFG (_name , _freq_cfg , _ch_mode_cfg , _blk_len_cfg , _subband_cfg ,\
170- _alloc_mthd_cfg , _min_bitpool_cfg , _max_bitpool_cfg )\
171- static struct bt_a2dp_codec_ie bt_a2dp_codec_ie##_name = {\
172- .len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {_freq_cfg | _ch_mode_cfg,\
173- _blk_len_cfg | _subband_cfg | _alloc_mthd_cfg, _min_bitpool_cfg, _max_bitpool_cfg},};\
174- struct bt_a2dp_codec_cfg _name = {.codec_config = &bt_a2dp_codec_ie##_name,}
177+ #define BT_A2DP_SBC_EP_CFG (_name , _freq_cfg , _ch_mode_cfg , _blk_len_cfg , _subband_cfg , \
178+ _alloc_mthd_cfg , _min_bitpool_cfg , _max_bitpool_cfg ) \
179+ static struct bt_a2dp_codec_ie bt_a2dp_codec_ie##_name = { \
180+ .len = BT_A2DP_SBC_IE_LENGTH, \
181+ .codec_ie = {_freq_cfg | _ch_mode_cfg, \
182+ _blk_len_cfg | _subband_cfg | _alloc_mthd_cfg, _min_bitpool_cfg, \
183+ _max_bitpool_cfg}, \
184+ }; \
185+ struct bt_a2dp_codec_cfg _name = { \
186+ .codec_config = &bt_a2dp_codec_ie##_name, \
187+ }
175188
176189/** @brief define the SBC default configuration.
177190 *
178191 * @param _name unique structure name postfix.
179192 * @param _freq_cfg the frequency to configure the remote same codec type endpoint.
180193 */
181- #define BT_A2DP_SBC_EP_CFG_DEFAULT (_name , _freq_cfg )\
182- static struct bt_a2dp_codec_ie bt_a2dp_codec_ie##_name = {\
183- .len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {_freq_cfg | A2DP_SBC_CH_MODE_JOINT,\
184- A2DP_SBC_BLK_LEN_16 | A2DP_SBC_SUBBAND_8 | A2DP_SBC_ALLOC_MTHD_LOUDNESS, 18U, 35U},};\
185- struct bt_a2dp_codec_cfg _name = {.codec_config = &bt_a2dp_codec_ie##_name,}
194+ #define BT_A2DP_SBC_EP_CFG_DEFAULT (_name , _freq_cfg ) \
195+ static struct bt_a2dp_codec_ie bt_a2dp_codec_ie##_name = { \
196+ .len = BT_A2DP_SBC_IE_LENGTH, \
197+ .codec_ie = {_freq_cfg | A2DP_SBC_CH_MODE_JOINT, \
198+ A2DP_SBC_BLK_LEN_16 | A2DP_SBC_SUBBAND_8 | \
199+ A2DP_SBC_ALLOC_MTHD_LOUDNESS, \
200+ 18U, 35U}, \
201+ }; \
202+ struct bt_a2dp_codec_cfg _name = { \
203+ .codec_config = &bt_a2dp_codec_ie##_name, \
204+ }
186205
187206/**
188207 * @brief A2DP error code
@@ -358,8 +377,8 @@ enum {
358377 * for next endpoint. By returning BT_A2DP_DISCOVER_EP_STOP user allows this
359378 * discovery continuation.
360379 */
361- typedef uint8_t (* bt_a2dp_discover_ep_cb )(struct bt_a2dp * a2dp ,
362- struct bt_a2dp_ep_info * info , struct bt_a2dp_ep * * ep );
380+ typedef uint8_t (* bt_a2dp_discover_ep_cb )(struct bt_a2dp * a2dp , struct bt_a2dp_ep_info * info ,
381+ struct bt_a2dp_ep * * ep );
363382
364383struct bt_a2dp_discover_param {
365384 /** discover callback */
@@ -411,8 +430,8 @@ struct bt_a2dp_cb {
411430 * @return 0 in case of success or negative value in case of error.
412431 */
413432 int (* config_req )(struct bt_a2dp * a2dp , struct bt_a2dp_ep * ep ,
414- struct bt_a2dp_codec_cfg * codec_cfg , struct bt_a2dp_stream * * stream ,
415- uint8_t * rsp_err_code );
433+ struct bt_a2dp_codec_cfg * codec_cfg , struct bt_a2dp_stream * * stream ,
434+ uint8_t * rsp_err_code );
416435 /** @brief Callback function for bt_a2dp_stream_config()
417436 *
418437 * Called when the codec configure operation is completed.
@@ -665,8 +684,8 @@ struct bt_a2dp_stream_ops {
665684 * @param seq_num the sequence number
666685 * @param ts the time stamp
667686 */
668- void (* recv )(struct bt_a2dp_stream * stream ,
669- struct net_buf * buf , uint16_t seq_num , uint32_t ts );
687+ void (* recv )(struct bt_a2dp_stream * stream , struct net_buf * buf , uint16_t seq_num ,
688+ uint32_t ts );
670689#endif
671690#if defined(CONFIG_BT_A2DP_SOURCE )
672691 /**
@@ -711,8 +730,8 @@ void bt_a2dp_stream_cb_register(struct bt_a2dp_stream *stream, struct bt_a2dp_st
711730 * @return 0 in case of success and error code in case of error.
712731 */
713732int bt_a2dp_stream_config (struct bt_a2dp * a2dp , struct bt_a2dp_stream * stream ,
714- struct bt_a2dp_ep * local_ep , struct bt_a2dp_ep * remote_ep ,
715- struct bt_a2dp_codec_cfg * config );
733+ struct bt_a2dp_ep * local_ep , struct bt_a2dp_ep * remote_ep ,
734+ struct bt_a2dp_codec_cfg * config );
716735
717736/** @brief establish a2dp streamer.
718737 *
@@ -785,8 +804,8 @@ uint32_t bt_a2dp_get_mtu(struct bt_a2dp_stream *stream);
785804 *
786805 * @return 0 in case of success and error code in case of error.
787806 */
788- int bt_a2dp_stream_send (struct bt_a2dp_stream * stream , struct net_buf * buf ,
789- uint16_t seq_num , uint32_t ts );
807+ int bt_a2dp_stream_send (struct bt_a2dp_stream * stream , struct net_buf * buf , uint16_t seq_num ,
808+ uint32_t ts );
790809#endif
791810
792811#ifdef __cplusplus
0 commit comments