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 <vector> 20 21 #include <android/hardware/bluetooth/audio/2.0/types.h> 22 23 #include "a2dp_codec_api.h" 24 25 namespace bluetooth { 26 namespace audio { 27 namespace codec { 28 29 using ::android::hardware::bluetooth::audio::V2_0::BitsPerSample; 30 using ::android::hardware::bluetooth::audio::V2_0::ChannelMode; 31 using ::android::hardware::bluetooth::audio::V2_0::CodecConfiguration; 32 using ::android::hardware::bluetooth::audio::V2_0::SampleRate; 33 34 extern const CodecConfiguration kInvalidCodecConfiguration; 35 36 SampleRate A2dpCodecToHalSampleRate( 37 const btav_a2dp_codec_config_t& a2dp_codec_config); 38 BitsPerSample A2dpCodecToHalBitsPerSample( 39 const btav_a2dp_codec_config_t& a2dp_codec_config); 40 ChannelMode A2dpCodecToHalChannelMode( 41 const btav_a2dp_codec_config_t& a2dp_codec_config); 42 43 bool A2dpSbcToHalConfig(CodecConfiguration* codec_config, 44 A2dpCodecConfig* a2dp_config); 45 bool A2dpAacToHalConfig(CodecConfiguration* codec_config, 46 A2dpCodecConfig* a2dp_config); 47 bool A2dpAptxToHalConfig(CodecConfiguration* codec_config, 48 A2dpCodecConfig* a2dp_config); 49 bool A2dpLdacToHalConfig(CodecConfiguration* codec_config, 50 A2dpCodecConfig* a2dp_config); 51 52 bool UpdateOffloadingCapabilities( 53 const std::vector<btav_a2dp_codec_config_t>& framework_preference); 54 // Check whether this codec is supported by the audio HAL and is allowed to use 55 // by prefernece of framework / Bluetooth SoC / runtime property. 56 bool IsCodecOffloadingEnabled(const CodecConfiguration& codec_config); 57 58 } // namespace codec 59 } // namespace audio 60 } // namespace bluetooth 61