1 /* 2 * Copyright 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <android/hardware/bluetooth/audio/2.1/types.h> 20 21 #include <vector> 22 23 #include "a2dp_codec_api.h" 24 25 namespace bluetooth { 26 namespace audio { 27 namespace hidl { 28 namespace codec { 29 30 using ::android::hardware::bluetooth::audio::V2_0::BitsPerSample; 31 using ::android::hardware::bluetooth::audio::V2_0::ChannelMode; 32 using ::android::hardware::bluetooth::audio::V2_0::CodecConfiguration; 33 using ::android::hardware::bluetooth::audio::V2_0::SampleRate; 34 35 extern const CodecConfiguration kInvalidCodecConfiguration; 36 37 SampleRate A2dpCodecToHalSampleRate( 38 const btav_a2dp_codec_config_t& a2dp_codec_config); 39 BitsPerSample A2dpCodecToHalBitsPerSample( 40 const btav_a2dp_codec_config_t& a2dp_codec_config); 41 ChannelMode A2dpCodecToHalChannelMode( 42 const btav_a2dp_codec_config_t& a2dp_codec_config); 43 44 bool A2dpSbcToHalConfig(CodecConfiguration* codec_config, 45 A2dpCodecConfig* a2dp_config); 46 bool A2dpAacToHalConfig(CodecConfiguration* codec_config, 47 A2dpCodecConfig* a2dp_config); 48 bool A2dpAptxToHalConfig(CodecConfiguration* codec_config, 49 A2dpCodecConfig* a2dp_config); 50 bool A2dpLdacToHalConfig(CodecConfiguration* codec_config, 51 A2dpCodecConfig* a2dp_config); 52 53 bool UpdateOffloadingCapabilities( 54 const std::vector<btav_a2dp_codec_config_t>& framework_preference); 55 // Check whether this codec is supported by the audio HAL and is allowed to use 56 // by prefernece of framework / Bluetooth SoC / runtime property. 57 bool IsCodecOffloadingEnabled(const CodecConfiguration& codec_config); 58 59 } // namespace codec 60 } // namespace hidl 61 } // namespace audio 62 } // namespace bluetooth 63