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