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