bta_av_co.h revision cd02ce9c60da962a7981320b26aada8744718941
1/******************************************************************************
2 *
3 *  Copyright (C) 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#ifdef __cplusplus
31extern "C" {
32#endif
33
34/*****************************************************************************
35 *  Constants and data types
36 ****************************************************************************/
37
38/*******************************************************************************
39 *
40 * Function         bta_av_co_audio_init
41 *
42 * Description      This callout function is executed by AV when it is
43 *                  started by calling BTA_AvEnable().  This function can be
44 *                  used by the phone to initialize audio paths or for other
45 *                  initialization purposes.
46 *
47 *
48 * Returns          Stream codec and content protection capabilities info.
49 *
50 ******************************************************************************/
51bool bta_av_co_audio_init(tA2DP_CODEC_SEP_INDEX codec_sep_index,
52                          tAVDT_CFG* p_cfg);
53
54/*******************************************************************************
55 *
56 * Function         bta_av_co_audio_disc_res
57 *
58 * Description      This callout function is executed by AV to report the
59 *                  number of stream end points (SEP) were found during the
60 *                  AVDT stream discovery process.
61 *
62 *
63 * Returns          void.
64 *
65 ******************************************************************************/
66void bta_av_co_audio_disc_res(tBTA_AV_HNDL hndl, uint8_t num_seps,
67                              uint8_t num_snk, uint8_t num_src, BD_ADDR addr,
68                              uint16_t uuid_local);
69
70/*******************************************************************************
71 *
72 * Function         bta_av_co_audio_getconfig
73 *
74 * Description      This callout function is executed by AV to retrieve the
75 *                  desired codec and content protection configuration for the
76 *                  audio stream.
77 *
78 *
79 * Returns          Stream codec and content protection configuration info.
80 *
81 ******************************************************************************/
82tA2DP_STATUS bta_av_co_audio_getconfig(tBTA_AV_HNDL hndl, uint8_t* p_codec_info,
83                                       uint8_t* p_sep_info_idx, uint8_t seid,
84                                       uint8_t* p_num_protect,
85                                       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 ******************************************************************************/
99void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, const uint8_t* p_codec_info,
100                               uint8_t seid, BD_ADDR addr, uint8_t num_protect,
101                               const uint8_t* p_protect_info,
102                               uint8_t t_local_sep, 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 ******************************************************************************/
117void bta_av_co_audio_open(tBTA_AV_HNDL hndl, 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 ******************************************************************************/
133void bta_av_co_audio_close(tBTA_AV_HNDL hndl);
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 ******************************************************************************/
146void bta_av_co_audio_start(tBTA_AV_HNDL hndl, uint8_t* p_codec_info,
147                           bool* p_no_rtp_hdr);
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 ******************************************************************************/
160void bta_av_co_audio_stop(tBTA_AV_HNDL hndl);
161
162/*******************************************************************************
163 *
164 * Function         bta_av_co_audio_src_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 ******************************************************************************/
173void* bta_av_co_audio_src_data_path(const uint8_t* p_codec_info,
174                                    uint32_t* p_timestamp);
175
176/*******************************************************************************
177 *
178 * Function         bta_av_co_audio_drop
179 *
180 * Description      An Audio packet is dropped. .
181 *                  It's very likely that the connected headset with this handle
182 *                  is moved far away. The implementation may want to reduce
183 *                  the encoder bit rate setting to reduce the packet size.
184 *
185 * Returns          void
186 *
187 ******************************************************************************/
188void bta_av_co_audio_drop(tBTA_AV_HNDL hndl);
189
190/*******************************************************************************
191 *
192 * Function         bta_av_co_audio_delay
193 *
194 * Description      This function is called by AV when the audio stream
195 *                  connection needs to send the initial delay report to the
196 *                  connected SRC.
197 *
198 *
199 * Returns          void
200 *
201 ******************************************************************************/
202void bta_av_co_audio_delay(tBTA_AV_HNDL hndl, uint16_t delay);
203
204#ifdef __cplusplus
205}
206#endif
207
208#endif /* BTA_AV_CO_H */
209