1 /*
2  * Copyright 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 // Stubbed non-standard codec
18 
19 #include <cstdint>
20 
21 #include "a2dp_vendor_aptx.h"
22 
A2DP_IsVendorSourceCodecValidAptx(const uint8_t * p_codec_info)23 bool A2DP_IsVendorSourceCodecValidAptx(const uint8_t* p_codec_info) {
24   return false;
25 }
26 
A2DP_IsVendorPeerSinkCodecValidAptx(const uint8_t * p_codec_info)27 bool A2DP_IsVendorPeerSinkCodecValidAptx(const uint8_t* p_codec_info) {
28   return false;
29 }
30 
A2DP_VendorUsesRtpHeaderAptx(bool content_protection_enabled,const uint8_t * p_codec_info)31 bool A2DP_VendorUsesRtpHeaderAptx(bool content_protection_enabled,
32                                   const uint8_t* p_codec_info) {
33   return false;
34 }
35 
A2DP_VendorCodecNameAptx(const uint8_t * p_codec_info)36 const char* A2DP_VendorCodecNameAptx(const uint8_t* p_codec_info) {
37   return "Aptx";
38 }
39 
A2DP_VendorCodecTypeEqualsAptx(const uint8_t * p_codec_info_a,const uint8_t * p_codec_info_b)40 bool A2DP_VendorCodecTypeEqualsAptx(const uint8_t* p_codec_info_a,
41                                     const uint8_t* p_codec_info_b) {
42   return false;
43 }
44 
A2DP_VendorCodecEqualsAptx(const uint8_t * p_codec_info_a,const uint8_t * p_codec_info_b)45 bool A2DP_VendorCodecEqualsAptx(const uint8_t* p_codec_info_a,
46                                 const uint8_t* p_codec_info_b) {
47   return false;
48 }
49 
A2DP_VendorGetBitRateAptx(const uint8_t * p_codec_info)50 int A2DP_VendorGetBitRateAptx(const uint8_t* p_codec_info) { return -1; }
51 
A2DP_VendorGetTrackSampleRateAptx(const uint8_t * p_codec_info)52 int A2DP_VendorGetTrackSampleRateAptx(const uint8_t* p_codec_info) {
53   return -1;
54 }
55 
A2DP_VendorGetTrackBitsPerSampleAptx(const uint8_t * p_codec_info)56 int A2DP_VendorGetTrackBitsPerSampleAptx(const uint8_t* p_codec_info) {
57   return -1;
58 }
59 
A2DP_VendorGetTrackChannelCountAptx(const uint8_t * p_codec_info)60 int A2DP_VendorGetTrackChannelCountAptx(const uint8_t* p_codec_info) {
61   return -1;
62 }
63 
A2DP_VendorGetSinkTrackChannelTypeAptx(const uint8_t * p_codec_info)64 int A2DP_VendorGetSinkTrackChannelTypeAptx(const uint8_t* p_codec_info) {
65   return -1;
66 }
67 
A2DP_VendorGetChannelModeCodeAptx(const uint8_t * p_codec_info)68 int A2DP_VendorGetChannelModeCodeAptx(const uint8_t* p_codec_info) {
69   return -1;
70 }
71 
A2DP_VendorGetFrameSizeAptx(const uint8_t * p_codec_info)72 int A2DP_VendorGetFrameSizeAptx(const uint8_t* p_codec_info) { return -1; }
73 
A2DP_VendorGetPacketTimestampAptx(const uint8_t * p_codec_info,const uint8_t * p_data,uint32_t * p_timestamp)74 bool A2DP_VendorGetPacketTimestampAptx(const uint8_t* p_codec_info,
75                                        const uint8_t* p_data,
76                                        uint32_t* p_timestamp) {
77   return false;
78 }
79 
A2DP_VendorBuildCodecHeaderAptx(const uint8_t * p_codec_info,BT_HDR * p_buf,uint16_t frames_per_packet)80 bool A2DP_VendorBuildCodecHeaderAptx(const uint8_t* p_codec_info, BT_HDR* p_buf,
81                                      uint16_t frames_per_packet) {
82   return false;
83 }
84 
A2DP_VendorCodecInfoStringAptx(const uint8_t * p_codec_info)85 std::string A2DP_VendorCodecInfoStringAptx(const uint8_t* p_codec_info) {
86   return "Unsupported codec: Aptx";
87 }
88 
A2DP_VendorGetEncoderInterfaceAptx(const uint8_t * p_codec_info)89 const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterfaceAptx(
90     const uint8_t* p_codec_info) {
91   return nullptr;
92 }
93 
A2DP_VendorGetDecoderInterfaceAptx(const uint8_t * p_codec_info)94 const tA2DP_DECODER_INTERFACE* A2DP_VendorGetDecoderInterfaceAptx(
95     const uint8_t* p_codec_info) {
96   return nullptr;
97 }
98 
A2DP_VendorAdjustCodecAptx(uint8_t * p_codec_info)99 bool A2DP_VendorAdjustCodecAptx(uint8_t* p_codec_info) { return false; }
100 
A2DP_VendorSourceCodecIndexAptx(const uint8_t * p_codec_info)101 btav_a2dp_codec_index_t A2DP_VendorSourceCodecIndexAptx(
102     const uint8_t* p_codec_info) {
103   return BTAV_A2DP_CODEC_INDEX_MAX;
104 }
105 
A2DP_VendorSinkCodecIndexAptx(const uint8_t * p_codec_info)106 btav_a2dp_codec_index_t A2DP_VendorSinkCodecIndexAptx(
107     const uint8_t* p_codec_info) {
108   return BTAV_A2DP_CODEC_INDEX_MAX;
109 }
110 
A2DP_VendorCodecIndexStrAptx(void)111 const char* A2DP_VendorCodecIndexStrAptx(void) { return "Aptx"; }
112 
A2DP_VendorInitCodecConfigAptx(AvdtpSepConfig * p_cfg)113 bool A2DP_VendorInitCodecConfigAptx(AvdtpSepConfig* p_cfg) { return false; }
114 
A2dpCodecConfigAptx(btav_a2dp_codec_priority_t codec_priority)115 A2dpCodecConfigAptx::A2dpCodecConfigAptx(
116     btav_a2dp_codec_priority_t codec_priority)
117     : A2dpCodecConfig(BTAV_A2DP_CODEC_INDEX_SOURCE_APTX, A2DP_CODEC_ID_APTX,
118                       A2DP_VendorCodecIndexStrAptx(), codec_priority) {}
119 
~A2dpCodecConfigAptx()120 A2dpCodecConfigAptx::~A2dpCodecConfigAptx() {}
121 
init()122 bool A2dpCodecConfigAptx::init() { return false; }
123 
useRtpHeaderMarkerBit() const124 bool A2dpCodecConfigAptx::useRtpHeaderMarkerBit() const { return false; }
125 
debug_codec_dump(int fd)126 void A2dpCodecConfigAptx::debug_codec_dump(int fd) {}
127 
setCodecConfig(const uint8_t * p_peer_codec_info,bool is_capability,uint8_t * p_result_codec_config)128 bool A2dpCodecConfigAptx::setCodecConfig(const uint8_t* p_peer_codec_info,
129                                          bool is_capability,
130                                          uint8_t* p_result_codec_config) {
131   return false;
132 }
133 
setPeerCodecCapabilities(const uint8_t * p_peer_codec_capabilities)134 bool A2dpCodecConfigAptx::setPeerCodecCapabilities(
135     const uint8_t* p_peer_codec_capabilities) {
136   return false;
137 }
138