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 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #ifdef _DLLEXPORT
32 #define APTXHDBTENCEXPORT __declspec(dllexport)
33 #else
34 #define APTXHDBTENCEXPORT
35 #endif
36 
37 /* SizeofAptxhdbtenc returns the size (in byte) of the memory
38  * allocation required to store the state of the encoder */
39 APTXHDBTENCEXPORT int SizeofAptxhdbtenc(void);
40 
41 /* aptxhdbtenc_version can be used to extract the version number
42  * of the aptX HD encoder */
43 APTXHDBTENCEXPORT const char* aptxhdbtenc_version(void);
44 
45 /* aptxhdbtenc_init is used to initialise the encoder structure.
46  * _state should be a pointer to the encoder structure (stereo).
47  * endian represent the endianness of the output data
48  * (0=little endian. Big endian otherwise)
49  * The function returns 1 if an error occurred during the initialisation.
50  * The function returns 0 if no error occurred during the initialisation. */
51 APTXHDBTENCEXPORT int aptxhdbtenc_init(void* _state, short endian);
52 
53 /* StereoEncode will take 8 audio samples (24-bit per sample)
54  * and generate two 24-bit codeword with autosync inserted.
55  * The bitstream is compatible with be BC05 implementation. */
56 APTXHDBTENCEXPORT int aptxhdbtenc_encodestereo(void* _state, void* _pcmL,
57                                                void* _pcmR, void* _buffer);
58 
59 #ifdef __cplusplus
60 }  //  /extern "C"
61 #endif
62 
63 #endif  // APTXHDBTENC_H
64