1 /**
2  * Copyright (C) 2022 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  *
18  *  This file exposes a public interface to allow clients to invoke aptX HD
19  *  encoding on 4 new PCM samples, generating 2 new codeword (one for the
20  *  left channel and one for the right channel).
21  *
22  *----------------------------------------------------------------------------*/
23 
24 #ifndef APTXHDBTENC_H
25 #define APTXHDBTENC_H
26 
27 #include <stdint.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifdef _DLLEXPORT
34 #define APTXHDBTENCEXPORT __declspec(dllexport)
35 #else
36 #define APTXHDBTENCEXPORT
37 #endif
38 
39 /* SizeofAptxhdbtenc returns the size (in byte) of the memory
40  * allocation required to store the state of the encoder */
41 APTXHDBTENCEXPORT int SizeofAptxhdbtenc(void);
42 
43 /* aptxhdbtenc_version can be used to extract the version number
44  * of the aptX HD encoder */
45 APTXHDBTENCEXPORT const char* aptxhdbtenc_version(void);
46 
47 /* aptxhdbtenc_init is used to initialise the encoder structure.
48  * _state should be a pointer to the encoder structure (stereo).
49  * endian represent the endianness of the output data
50  * (0=little endian. Big endian otherwise)
51  * The function returns 1 if an error occurred during the initialisation.
52  * The function returns 0 if no error occurred during the initialisation. */
53 APTXHDBTENCEXPORT int aptxhdbtenc_init(void* _state, int16_t endian);
54 
55 /* StereoEncode will take 8 audio samples (24-bit per sample)
56  * and generate two 24-bit codeword with autosync inserted.
57  * The bitstream is compatible with be BC05 implementation. */
58 APTXHDBTENCEXPORT int aptxhdbtenc_encodestereo(void* _state, void* _pcmL, void* _pcmR,
59                                                void* _buffer);
60 
61 #ifdef __cplusplus
62 }  //  /extern "C"
63 #endif
64 
65 #endif  // APTXHDBTENC_H
66