blob: a39d7793bf3460fb9b961dbf882f4e97bb213dbb [file] [log] [blame]
Antoine SOULIER4e34d052023-09-29 19:10:07 +00001/*
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
21namespace aidl::android::hardware::bluetooth::audio {
22
23struct 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
33class A2dpOffloadCodecSbc : public A2dpOffloadCodec {
34 CodecInfo info_;
35
Antoine SOULIER4e34d052023-09-29 19:10:07 +000036 A2dpStatus ParseConfiguration(const std::vector<uint8_t>& configuration,
37 CodecParameters* codec_parameters,
38 SbcParameters* sbc_parameters) const;
39
40 public:
Antoine SOULIERbabe71d2024-01-12 23:20:58 +000041 A2dpOffloadCodecSbc();
Antoine SOULIER4e34d052023-09-29 19:10:07 +000042
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
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