bta_av_co.h 9.5 KB

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