• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright 2003-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  This is the interface file for advanced audio call-out functions.
22  *
23  ******************************************************************************/
24 #ifndef BTA_AV_CO_H
25 #define BTA_AV_CO_H
26 
27 #include <cstdint>
28 
29 #include "bta/include/bta_av_api.h"
30 #include "include/hardware/bt_av.h"
31 #include "stack/include/a2dp_error_codes.h"
32 #include "stack/include/avdt_api.h"
33 #include "types/raw_address.h"
34 
35 /*****************************************************************************
36  *  Constants and data types
37  ****************************************************************************/
38 
39 /*******************************************************************************
40  *
41  * Function         bta_av_co_audio_init
42  *
43  * Description      This callout function is executed by AV when it is
44  *                  started by calling BTA_AvEnable().  This function can be
45  *                  used by the phone to initialize audio paths or for other
46  *                  initialization purposes.
47  *
48  *
49  * Returns          Stream codec and content protection capabilities info.
50  *
51  ******************************************************************************/
52 bool bta_av_co_audio_init(btav_a2dp_codec_index_t codec_index,
53                           AvdtpSepConfig* p_cfg);
54 
55 /*******************************************************************************
56  *
57  * Function         bta_av_co_audio_disc_res
58  *
59  * Description      This callout function is executed by AV to report the
60  *                  number of stream end points (SEP) were found during the
61  *                  AVDT stream discovery process.
62  *
63  *
64  * Returns          void.
65  *
66  ******************************************************************************/
67 void bta_av_co_audio_disc_res(tBTA_AV_HNDL bta_av_handle,
68                               const RawAddress& peer_address, uint8_t num_seps,
69                               uint8_t num_sinks, uint8_t num_sources,
70                               uint16_t uuid_local);
71 
72 /*******************************************************************************
73  *
74  * Function         bta_av_co_audio_getconfig
75  *
76  * Description      This callout function is executed by AV to retrieve the
77  *                  desired codec and content protection configuration for the
78  *                  audio stream.
79  *
80  *
81  * Returns          Stream codec and content protection configuration info.
82  *
83  ******************************************************************************/
84 tA2DP_STATUS bta_av_co_audio_getconfig(tBTA_AV_HNDL bta_av_handle,
85                                        const RawAddress& peer_address,
86                                        uint8_t* p_codec_info,
87                                        uint8_t* p_sep_info_idx, uint8_t seid,
88                                        uint8_t* p_num_protect,
89                                        uint8_t* p_protect_info);
90 
91 /*******************************************************************************
92  *
93  * Function         bta_av_co_audio_setconfig
94  *
95  * Description      This callout function is executed by AV to set the
96  *                  codec and content protection configuration of the audio
97  *                  stream.
98  *
99  *
100  * Returns          void
101  *
102  ******************************************************************************/
103 void bta_av_co_audio_setconfig(tBTA_AV_HNDL bta_av_handle,
104                                const RawAddress& peer_address,
105                                const uint8_t* p_codec_info, uint8_t seid,
106                                uint8_t num_protect,
107                                const uint8_t* p_protect_info,
108                                uint8_t t_local_sep, uint8_t avdt_handle);
109 
110 /*******************************************************************************
111  *
112  * Function         bta_av_co_audio_open
113  *
114  * Description      This function is called by AV when the audio stream
115  *                  connection is opened.
116  *                  BTA-AV maintains the MTU of A2DP streams.
117  *                  If this is the 2nd audio stream, mtu is the smaller of the 2
118  *                  streams.
119  *
120  * Returns          void
121  *
122  ******************************************************************************/
123 void bta_av_co_audio_open(tBTA_AV_HNDL bta_av_handle,
124                           const RawAddress& peer_address, uint16_t mtu);
125 
126 /*******************************************************************************
127  *
128  * Function         bta_av_co_audio_close
129  *
130  * Description      This function is called by AV when the audio stream
131  *                  connection is closed.
132  *                  BTA-AV maintains the MTU of A2DP streams.
133  *                  When one stream is closed and no other audio stream is open,
134  *                  mtu is reported as 0.
135  *                  Otherwise, the MTU remains open is reported.
136  *
137  * Returns          void
138  *
139  ******************************************************************************/
140 void bta_av_co_audio_close(tBTA_AV_HNDL bta_av_handle,
141                            const RawAddress& peer_address);
142 
143 /*******************************************************************************
144  *
145  * Function         bta_av_co_audio_start
146  *
147  * Description      This function is called by AV when the audio streaming data
148  *                  transfer is started.
149  *
150  *
151  * Returns          void
152  *
153  ******************************************************************************/
154 void bta_av_co_audio_start(tBTA_AV_HNDL bta_av_handle,
155                            const RawAddress& peer_address,
156                            const uint8_t* p_codec_info, bool* p_no_rtp_header);
157 
158 /*******************************************************************************
159  *
160  * Function         bta_av_co_audio_stop
161  *
162  * Description      This function is called by AV when the audio streaming data
163  *                  transfer is stopped.
164  *
165  *
166  * Returns          void
167  *
168  ******************************************************************************/
169 void bta_av_co_audio_stop(tBTA_AV_HNDL bta_av_handle,
170                           const RawAddress& peer_address);
171 
172 /*******************************************************************************
173  *
174  * Function         bta_av_co_audio_source_data_path
175  *
176  * Description      This function is called to get the next data buffer from
177  *                  the audio codec
178  *
179  * Returns          NULL if data is not ready.
180  *                  Otherwise, a buffer (BT_HDR*) containing the audio data.
181  *
182  ******************************************************************************/
183 BT_HDR* bta_av_co_audio_source_data_path(const uint8_t* p_codec_info,
184                                          uint32_t* p_timestamp);
185 
186 /*******************************************************************************
187  *
188  * Function         bta_av_co_audio_drop
189  *
190  * Description      An Audio packet is dropped.
191  *                  It's very likely that the connected headset with this handle
192  *                  is moved far away. The implementation may want to reduce
193  *                  the encoder bit rate setting to reduce the packet size.
194  *
195  * Returns          void
196  *
197  ******************************************************************************/
198 void bta_av_co_audio_drop(tBTA_AV_HNDL bta_av_handle,
199                           const RawAddress& peer_address);
200 
201 /*******************************************************************************
202  *
203  * Function         bta_av_co_audio_delay
204  *
205  * Description      This function is called by AV when the audio stream
206  *                  connection needs to send the initial delay report to the
207  *                  connected SRC.
208  *
209  *
210  * Returns          void
211  *
212  ******************************************************************************/
213 void bta_av_co_audio_delay(tBTA_AV_HNDL bta_av_handle,
214                            const RawAddress& peer_address, uint16_t delay);
215 
216 /*******************************************************************************
217  *
218  * Function         bta_av_co_audio_update_mtu
219  *
220  * Description      This function is called by AV when the audio stream
221  *                  connection MTU needs to be updated.
222  *                  BTA-AV maintains the MTU of A2DP streams.
223  *                  If this is the 2nd audio stream, mtu is the smaller of the 2
224  *                  streams.
225  *
226  * Returns          void
227  *
228  ******************************************************************************/
229 void bta_av_co_audio_update_mtu(tBTA_AV_HNDL bta_av_handle,
230                                 const RawAddress& peer_address, uint16_t mtu);
231 
232 /*******************************************************************************
233  **
234  ** Function        bta_av_co_get_scmst_info
235  **
236  ** Description     Get the SCMS-T information for the specific peer
237  **
238  ** Returns         btav_a2dp_scmst_info_t.
239  **                 It contains the information of SCMS-T which are the SCMS-T
240  **                 enable status for the specific peer and the SCMS-T header
241  **                 if SCMS-T is enabled.
242  **
243  ******************************************************************************/
244 btav_a2dp_scmst_info_t bta_av_co_get_scmst_info(const RawAddress& peer_address);
245 
246 #endif /* BTA_AV_CO_H */
247