Home | History | Annotate | Download | only in include
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2009-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 #ifndef BTIF_AV_CO_H
     20 #define BTIF_AV_CO_H
     21 
     22 #include "btif/include/btif_a2dp_source.h"
     23 #include "stack/include/a2dp_codec_api.h"
     24 
     25 #ifdef __cplusplus
     26 extern "C" {
     27 #endif
     28 
     29 // Gets the A2DP peer parameters that are used to initialize the encoder.
     30 // The parameters are stored in |p_peer_params|.
     31 // |p_peer_params| cannot be null.
     32 void bta_av_co_get_peer_params(tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params);
     33 
     34 // Gets the current A2DP encoder interface that can be used to encode and
     35 // prepare A2DP packets for transmission - see |tA2DP_ENCODER_INTERFACE|.
     36 // Returns the A2DP encoder interface if the current codec is setup,
     37 // otherwise NULL.
     38 const tA2DP_ENCODER_INTERFACE* bta_av_co_get_encoder_interface(void);
     39 
     40 // Sets the user preferred codec configuration.
     41 // |codec_user_config| contains the preferred codec configuration.
     42 // Returns true on success, otherwise false.
     43 bool bta_av_co_set_codec_user_config(
     44     const btav_a2dp_codec_config_t& codec_user_config);
     45 
     46 // Sets the Audio HAL selected audio feeding parameters.
     47 // Those parameters are applied only to the currently selected codec.
     48 // |codec_audio_config| contains the selected audio feeding configuration.
     49 // Returns true on success, otherwise false.
     50 bool bta_av_co_set_codec_audio_config(
     51     const btav_a2dp_codec_config_t& codec_audio_config);
     52 
     53 // Initializes the control block.
     54 // |codec_priorities| contains the A2DP Source codec priorities to use.
     55 void bta_av_co_init(
     56     const std::vector<btav_a2dp_codec_config_t>& codec_priorities);
     57 
     58 // Gets the initialized A2DP codecs.
     59 // Returns a pointer to the |A2dpCodecs| object with the initialized A2DP
     60 // codecs, or nullptr if no codecs are initialized.
     61 A2dpCodecs* bta_av_get_a2dp_codecs(void);
     62 
     63 // Gets the current A2DP codec.
     64 // Returns a pointer to the current |A2dpCodec| if valid, otherwise nullptr.
     65 A2dpCodecConfig* bta_av_get_a2dp_current_codec(void);
     66 
     67 #ifdef __cplusplus
     68 }
     69 #endif
     70 
     71 #endif  // BTIF_AV_CO_H
     72