1 /*
2  * Copyright 2017 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 // Interface to the A2DP LDAC ABR
19 //
20 
21 #ifndef A2DP_VENDOR_LDAC_ABR_H
22 #define A2DP_VENDOR_LDAC_ABR_H
23 
24 #include <stdio.h>
25 
26 #include <ldacBT_abr.h>
27 
28 // Initial EQMID for ABR mode.
29 #define LDAC_ABR_MODE_EQMID LDACBT_EQMID_SQ
30 
31 // Loads the LDAC ABR library.
32 // Return true on success, otherwise false.
33 bool A2DP_VendorLoadLdacAbr(void);
34 
35 // Unloads the LDAC ABR library.
36 void A2DP_VendorUnloadLdacAbr(void);
37 
38 // Gets the LDAC ABR handle.
39 // Return the LDAC ABR handle.
40 HANDLE_LDAC_ABR a2dp_ldac_abr_get_handle(void);
41 
42 // Free the LDAC ABR handle.
43 void a2dp_ldac_abr_free_handle(HANDLE_LDAC_ABR hLdacAbr);
44 
45 // Initializes the LDAC ABR handle.
46 // Return 0 on success, or -1 on failure.
47 int a2dp_ldac_abr_init(HANDLE_LDAC_ABR hLdacAbr, unsigned int interval_ms);
48 
49 // Sets thresholds for the LDAC ABR handle.
50 // Return 0 on success, or -1 on failure.
51 int a2dp_ldac_abr_set_thresholds(HANDLE_LDAC_ABR hLdacAbr,
52                                  unsigned int th_critical,
53                                  unsigned int th_dangerous_trend,
54                                  unsigned int th_4hqsq);
55 
56 // LDAC ABR main process.
57 // It controls LDAC encoder bit rate based on A2DP transmit queue length.
58 // return current EQMID of LDAC encoder.
59 int a2dp_ldac_abr_proc(HANDLE_LDAC_BT hLdacParam, HANDLE_LDAC_ABR hLdacAbr,
60                        size_t transmit_queue_length, unsigned int flag_enable);
61 
62 #endif  // A2DP_VENDOR_LDAC_ENCODER_H
63