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