1 /* 2 * Copyright (C) 2023 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 "A2dpOffloadCodec.h" 20 21 namespace aidl::android::hardware::bluetooth::audio { 22 23 struct SbcParameters : public CodecParameters { 24 enum class AllocationMethod { SNR, LOUDNESS }; 25 26 AllocationMethod allocation_method; 27 int block_length; 28 int subbands; 29 int min_bitpool; 30 int max_bitpool; 31 }; 32 33 class A2dpOffloadCodecSbc : public A2dpOffloadCodec { 34 CodecInfo info_; 35 36 A2dpStatus ParseConfiguration(const std::vector<uint8_t>& configuration, 37 CodecParameters* codec_parameters, 38 SbcParameters* sbc_parameters) const; 39 40 public: 41 A2dpOffloadCodecSbc(); 42 ParseConfiguration(const std::vector<uint8_t> & configuration,CodecParameters * codec_parameters)43 A2dpStatus ParseConfiguration( 44 const std::vector<uint8_t>& configuration, 45 CodecParameters* codec_parameters) const override { 46 return ParseConfiguration(configuration, codec_parameters, nullptr); 47 } 48 ParseConfiguration(const std::vector<uint8_t> & configuration,SbcParameters * sbc_parameters)49 A2dpStatus ParseConfiguration(const std::vector<uint8_t>& configuration, 50 SbcParameters* sbc_parameters) const { 51 return ParseConfiguration(configuration, sbc_parameters, sbc_parameters); 52 } 53 54 bool BuildConfiguration(const std::vector<uint8_t>& remote_capabilities, 55 const std::optional<CodecParameters>& hint, 56 std::vector<uint8_t>* configuration) const override; 57 }; 58 59 } // namespace aidl::android::hardware::bluetooth::audio 60