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