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 "stack/include/bt_hdr.h" 34 #include "types/raw_address.h" 35 36 /***************************************************************************** 37 * Constants and data types 38 ****************************************************************************/ 39 40 /******************************************************************************* 41 * 42 * Function bta_av_co_audio_init 43 * 44 * Description This callout function is executed by AV when it is 45 * started by calling BTA_AvEnable(). This function can be 46 * used by the phone to initialize audio paths or for other 47 * initialization purposes. 48 * 49 * 50 * Returns Stream codec and content protection capabilities info. 51 * 52 ******************************************************************************/ 53 bool bta_av_co_audio_init(btav_a2dp_codec_index_t codec_index, 54 AvdtpSepConfig* p_cfg); 55 56 /******************************************************************************* 57 * 58 * Function bta_av_co_audio_disc_res 59 * 60 * Description This callout function is executed by AV to report the 61 * number of stream end points (SEP) were found during the 62 * AVDT stream discovery process. 63 * 64 * 65 * Returns void. 66 * 67 ******************************************************************************/ 68 void bta_av_co_audio_disc_res(tBTA_AV_HNDL bta_av_handle, 69 const RawAddress& peer_address, uint8_t num_seps, 70 uint8_t num_sinks, uint8_t num_sources, 71 uint16_t uuid_local); 72 73 /******************************************************************************* 74 * 75 * Function bta_av_co_audio_getconfig 76 * 77 * Description This callout function is executed by AV to retrieve the 78 * desired codec and content protection configuration for the 79 * audio stream. 80 * 81 * 82 * Returns Stream codec and content protection configuration info. 83 * 84 ******************************************************************************/ 85 tA2DP_STATUS bta_av_co_audio_getconfig(tBTA_AV_HNDL bta_av_handle, 86 const RawAddress& peer_address, 87 uint8_t* p_codec_info, 88 uint8_t* p_sep_info_idx, uint8_t seid, 89 uint8_t* p_num_protect, 90 uint8_t* p_protect_info); 91 92 /******************************************************************************* 93 * 94 * Function bta_av_co_audio_setconfig 95 * 96 * Description This callout function is executed by AV to set the 97 * codec and content protection configuration of the audio 98 * stream. 99 * 100 * 101 * Returns void 102 * 103 ******************************************************************************/ 104 void bta_av_co_audio_setconfig(tBTA_AV_HNDL bta_av_handle, 105 const RawAddress& peer_address, 106 const uint8_t* p_codec_info, uint8_t seid, 107 uint8_t num_protect, 108 const uint8_t* p_protect_info, 109 uint8_t t_local_sep, uint8_t avdt_handle); 110 111 /******************************************************************************* 112 * 113 * Function bta_av_co_audio_open 114 * 115 * Description This function is called by AV when the audio stream 116 * connection is opened. 117 * BTA-AV maintains the MTU of A2DP streams. 118 * If this is the 2nd audio stream, mtu is the smaller of the 2 119 * streams. 120 * 121 * Returns void 122 * 123 ******************************************************************************/ 124 void bta_av_co_audio_open(tBTA_AV_HNDL bta_av_handle, 125 const RawAddress& peer_address, uint16_t mtu); 126 127 /******************************************************************************* 128 * 129 * Function bta_av_co_audio_close 130 * 131 * Description This function is called by AV when the audio stream 132 * connection is closed. 133 * BTA-AV maintains the MTU of A2DP streams. 134 * When one stream is closed and no other audio stream is open, 135 * mtu is reported as 0. 136 * Otherwise, the MTU remains open is reported. 137 * 138 * Returns void 139 * 140 ******************************************************************************/ 141 void bta_av_co_audio_close(tBTA_AV_HNDL bta_av_handle, 142 const RawAddress& peer_address); 143 144 /******************************************************************************* 145 * 146 * Function bta_av_co_audio_start 147 * 148 * Description This function is called by AV when the audio streaming data 149 * transfer is started. 150 * 151 * 152 * Returns void 153 * 154 ******************************************************************************/ 155 void bta_av_co_audio_start(tBTA_AV_HNDL bta_av_handle, 156 const RawAddress& peer_address, 157 const uint8_t* p_codec_info, bool* p_no_rtp_header); 158 159 /******************************************************************************* 160 * 161 * Function bta_av_co_audio_stop 162 * 163 * Description This function is called by AV when the audio streaming data 164 * transfer is stopped. 165 * 166 * 167 * Returns void 168 * 169 ******************************************************************************/ 170 void bta_av_co_audio_stop(tBTA_AV_HNDL bta_av_handle, 171 const RawAddress& peer_address); 172 173 /******************************************************************************* 174 * 175 * Function bta_av_co_audio_source_data_path 176 * 177 * Description This function is called to get the next data buffer from 178 * the audio codec 179 * 180 * Returns NULL if data is not ready. 181 * Otherwise, a buffer (BT_HDR*) containing the audio data. 182 * 183 ******************************************************************************/ 184 BT_HDR* bta_av_co_audio_source_data_path(const uint8_t* p_codec_info, 185 uint32_t* p_timestamp); 186 187 /******************************************************************************* 188 * 189 * Function bta_av_co_audio_drop 190 * 191 * Description An Audio packet is dropped. 192 * It's very likely that the connected headset with this handle 193 * is moved far away. The implementation may want to reduce 194 * the encoder bit rate setting to reduce the packet size. 195 * 196 * Returns void 197 * 198 ******************************************************************************/ 199 void bta_av_co_audio_drop(tBTA_AV_HNDL bta_av_handle, 200 const RawAddress& peer_address); 201 202 /******************************************************************************* 203 * 204 * Function bta_av_co_audio_delay 205 * 206 * Description This function is called by AV when the audio stream 207 * connection needs to send the initial delay report to the 208 * connected SRC. 209 * 210 * 211 * Returns void 212 * 213 ******************************************************************************/ 214 void bta_av_co_audio_delay(tBTA_AV_HNDL bta_av_handle, 215 const RawAddress& peer_address, uint16_t delay); 216 217 /******************************************************************************* 218 * 219 * Function bta_av_co_audio_update_mtu 220 * 221 * Description This function is called by AV when the audio stream 222 * connection MTU needs to be updated. 223 * BTA-AV maintains the MTU of A2DP streams. 224 * If this is the 2nd audio stream, mtu is the smaller of the 2 225 * streams. 226 * 227 * Returns void 228 * 229 ******************************************************************************/ 230 void bta_av_co_audio_update_mtu(tBTA_AV_HNDL bta_av_handle, 231 const RawAddress& peer_address, uint16_t mtu); 232 233 /******************************************************************************* 234 ** 235 ** Function bta_av_co_get_scmst_info 236 ** 237 ** Description Get the SCMS-T information for the specific peer 238 ** 239 ** Returns btav_a2dp_scmst_info_t. 240 ** It contains the information of SCMS-T which are the SCMS-T 241 ** enable status for the specific peer and the SCMS-T header 242 ** if SCMS-T is enabled. 243 ** 244 ******************************************************************************/ 245 btav_a2dp_scmst_info_t bta_av_co_get_scmst_info(const RawAddress& peer_address); 246 247 #endif /* BTA_AV_CO_H */ 248