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 // |restart_output| is used to know whether AV is reconfiguring with remote. 52 // Returns true on success, otherwise false. 53 bool bta_av_co_set_codec_user_config( 54 const RawAddress& peer_addr, 55 const btav_a2dp_codec_config_t& codec_user_config, bool* p_restart_output); 56 57 // Sets the Audio HAL selected audio feeding parameters. 58 // Those parameters are applied only to the currently selected codec. 59 // |codec_audio_config| contains the selected audio feeding configuration. 60 // Returns true on success, otherwise false. 61 bool bta_av_co_set_codec_audio_config( 62 const btav_a2dp_codec_config_t& codec_audio_config); 63 64 // Initializes the control block. 65 // |codec_priorities| contains the A2DP Source codec priorities to use. 66 void bta_av_co_init( 67 const std::vector<btav_a2dp_codec_config_t>& codec_priorities); 68 69 // Checks whether the codec for |codec_index| is supported. 70 // Returns true if the codec is supported, otherwise false. 71 bool bta_av_co_is_supported_codec(btav_a2dp_codec_index_t codec_index); 72 73 // Gets the current A2DP codec for the active peer. 74 // Returns a pointer to the current |A2dpCodecConfig| if valid, otherwise 75 // nullptr. 76 A2dpCodecConfig* bta_av_get_a2dp_current_codec(void); 77 78 // Gets the current A2DP codec for a peer identified by |peer_address|. 79 // Returns a pointer to the current |A2dpCodecConfig| if valid, otherwise 80 // nullptr. 81 A2dpCodecConfig* bta_av_get_a2dp_peer_current_codec( 82 const RawAddress& peer_address); 83 84 // Dump A2DP codec debug-related information for the A2DP module. 85 // |fd| is the file descriptor to use for writing the ASCII formatted 86 // information. 87 void btif_a2dp_codec_debug_dump(int fd); 88 89 #endif // BTIF_AV_CO_H 90