1 /****************************************************************************** 2 * 3 * Copyright 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 // Sets the active peer to |peer_addr|. 26 // Returns true on success, otherwise false. 27 bool bta_av_co_set_active_peer(const RawAddress& peer_addr); 28 29 // Gets the A2DP peer parameters that are used to initialize the encoder. 30 // The peer address is |peer_addr|. 31 // The parameters are stored in |p_peer_params|. 32 // |p_peer_params| cannot be null. 33 void bta_av_co_get_peer_params(const RawAddress& peer_addr, 34 tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params); 35 36 // Gets the current A2DP encoder interface that can be used to encode and 37 // prepare A2DP packets for transmission - see |tA2DP_ENCODER_INTERFACE|. 38 // Returns the A2DP encoder interface if the current codec is setup, 39 // otherwise NULL. 40 const tA2DP_ENCODER_INTERFACE* bta_av_co_get_encoder_interface(void); 41 42 // Gets the current A2DP decoder interface that can be used to decode received 43 // A2DP packets - see |tA2DP_DECODER_INTERFACE|. 44 // Returns the A2DP decoder interface if the current codec is setup, otherwise 45 // NULL. 46 const tA2DP_DECODER_INTERFACE* bta_av_co_get_decoder_interface(void); 47 48 // Sets the user preferred codec configuration. 49 // The peer address is |peer_addr|. 50 // |codec_user_config| contains the preferred codec configuration. 51 // Returns true on success, otherwise false. 52 bool bta_av_co_set_codec_user_config( 53 const RawAddress& peer_addr, 54 const btav_a2dp_codec_config_t& codec_user_config); 55 56 // Sets the Audio HAL selected audio feeding parameters. 57 // Those parameters are applied only to the currently selected codec. 58 // |codec_audio_config| contains the selected audio feeding configuration. 59 // Returns true on success, otherwise false. 60 bool bta_av_co_set_codec_audio_config( 61 const btav_a2dp_codec_config_t& codec_audio_config); 62 63 // Initializes the control block. 64 // |codec_priorities| contains the A2DP Source codec priorities to use. 65 void bta_av_co_init( 66 const std::vector<btav_a2dp_codec_config_t>& codec_priorities); 67 68 // Checks whether the codec for |codec_index| is supported. 69 // Returns true if the codec is supported, otherwise false. 70 bool bta_av_co_is_supported_codec(btav_a2dp_codec_index_t codec_index); 71 72 // Gets the current A2DP codec for the active peer. 73 // Returns a pointer to the current |A2dpCodecConfig| if valid, otherwise 74 // nullptr. 75 A2dpCodecConfig* bta_av_get_a2dp_current_codec(void); 76 77 // Gets the current A2DP codec for a peer identified by |peer_address|. 78 // Returns a pointer to the current |A2dpCodecConfig| if valid, otherwise 79 // nullptr. 80 A2dpCodecConfig* bta_av_get_a2dp_peer_current_codec( 81 const RawAddress& peer_address); 82 83 // Dump A2DP codec debug-related information for the A2DP module. 84 // |fd| is the file descriptor to use for writing the ASCII formatted 85 // information. 86 void btif_a2dp_codec_debug_dump(int fd); 87 88 #endif // BTIF_AV_CO_H 89