• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 AacParameters : public CodecParameters {
24   enum class ObjectType { MPEG2_AAC_LC, MPEG4_AAC_LC };
25 
26   ObjectType object_type;
27 };
28 
29 class A2dpOffloadCodecAac : public A2dpOffloadCodec {
30   CodecInfo info_;
31 
32   A2dpStatus ParseConfiguration(const std::vector<uint8_t>& configuration,
33                                 CodecParameters* codec_parameters,
34                                 AacParameters* aac_parameters) const;
35 
36  public:
37   A2dpOffloadCodecAac();
38 
ParseConfiguration(const std::vector<uint8_t> & configuration,CodecParameters * codec_parameters)39   A2dpStatus ParseConfiguration(
40       const std::vector<uint8_t>& configuration,
41       CodecParameters* codec_parameters) const override {
42     return ParseConfiguration(configuration, codec_parameters, nullptr);
43   }
44 
ParseConfiguration(const std::vector<uint8_t> & configuration,AacParameters * aac_parameters)45   A2dpStatus ParseConfiguration(const std::vector<uint8_t>& configuration,
46                                 AacParameters* aac_parameters) const {
47     return ParseConfiguration(configuration, aac_parameters, aac_parameters);
48   }
49 
50   bool BuildConfiguration(const std::vector<uint8_t>& remote_capabilities,
51                           const std::optional<CodecParameters>& hint,
52                           std::vector<uint8_t>* configuration) const override;
53 };
54 
55 }  // namespace aidl::android::hardware::bluetooth::audio
56