1 /* 2 * Copyright 2016 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 #ifndef LDACBT_BCO_FOR_FLUORIDE_H__ 17 #define LDACBT_BCO_FOR_FLUORIDE_H__ 18 19 #include <stdint.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif /* __cplusplus */ 24 25 #ifndef LDAC_BCO_API 26 #define LDAC_BCO_API 27 #endif /* LDAC_BCO_API */ 28 29 /* This file contains the definitions, declarations and macros for an 30 * implimentation of LDAC buffer control operation. 31 */ 32 33 #define LDAC_BCO_ERR_NONE 0 34 #define LDAC_BCO_ERR_FATAL (-1) 35 36 /* LDAC BCO handle type */ 37 typedef struct _ldacbt_bco_handle* HANDLE_LDAC_BCO; 38 39 typedef void (*decoded_data_callback_t)(uint8_t* buf, uint32_t len); 40 41 /* Prepare to use LDAC BCO. 42 * - Register a callback function for passing decoded data. 43 * - Allocation of LDAC BCO handle. 44 * Format 45 * HANDLE_LDAC_BCO ldac_BCO_init(decoded_data_callback_t decode_callback); 46 * Arguments 47 * decoded_data_callback_t decode_callback 48 * Callback function that outputs PCM data after decoding. 49 * (See also a2dp_codec_api.h) 50 * Return value 51 * HANDLE_LDAC_BCO for success, NULL for failure. 52 */ 53 LDAC_BCO_API HANDLE_LDAC_BCO 54 ldac_BCO_init(decoded_data_callback_t decode_callback); 55 56 /* End LDAC BCO. 57 * - Release of LDAC BCO handle. 58 * Format 59 * int32_t ldac_BCO_cleanup(HANDLE_LDAC_BCO hLdacBco); 60 * Arguments 61 * HANDLE_LDAC_BCO hLdacBco LDAC BCO handle. 62 * Return value 63 * int32_t : Processing result. 64 * LDAC_BCO_ERR_NONE:Successful completion 65 * LDAC_BCO_ERR_FATAL:Error 66 * Note 67 * The function ldac_BCO_init() shall be called before calling this 68 * function. 69 */ 70 LDAC_BCO_API int32_t ldac_BCO_cleanup(HANDLE_LDAC_BCO hLdacBco); 71 72 /* Decode LDAC packets. 73 * - Perform buffer control and decode processing. 74 * Format 75 * int32_t ldac_BCO_decode_packet(HANDLE_LDAC_BCO hLdacBco, void *data, 76 * int32_t length); 77 * Arguments 78 * HANDLE_LDAC_BCO hLdacBco LDAC BCO handle. 79 * void *data LDAC packet. 80 * int32_t length LDAC packet size. 81 * Return value 82 * int32_t : Processing result. 83 * LDAC_BCO_ERR_NONE:Successful completion 84 * LDAC_BCO_ERR_FATAL:Error 85 * Note 86 * The function ldac_BCO_init() shall be called before calling this 87 * function. 88 */ 89 LDAC_BCO_API int32_t ldac_BCO_decode_packet(HANDLE_LDAC_BCO hLdacBco, 90 void* data, int32_t length); 91 92 /* Start decoding process. 93 * - Start or resume decoder thread. 94 * Format 95 * int32_t ldac_BCO_start(HANDLE_LDAC_BCO hLdacBco); 96 * Arguments 97 * HANDLE_LDAC_BCO hLdacBco LDAC BCO handle. 98 * Return value 99 * int32_t : Processing result. 100 * LDAC_BCO_ERR_NONE:Successful completion 101 * LDAC_BCO_ERR_FATAL:Error 102 * Note 103 * The function ldac_BCO_init() shall be called before calling this 104 * function. 105 */ 106 LDAC_BCO_API int32_t ldac_BCO_start(HANDLE_LDAC_BCO hLdacBco); 107 108 /* Suspend decoding process. 109 * - Suspend the decoder thread. 110 * Format 111 * int32_t ldac_BCO_suspend(HANDLE_LDAC_BCO hLdacBco); 112 * Arguments 113 * HANDLE_LDAC_BCO hLdacBco LDAC BCO handle. 114 * Return value 115 * int32_t : Processing result. 116 * LDAC_BCO_ERR_NONE:Successful completion 117 * LDAC_BCO_ERR_FATAL:Error 118 * Note 119 * The function ldac_BCO_init() shall be called before calling this 120 * function. 121 */ 122 LDAC_BCO_API int32_t ldac_BCO_suspend(HANDLE_LDAC_BCO hLdacBco); 123 124 /* Configure codec information. 125 * - Set sample rate, bits/sample and channel mode. 126 * Format 127 * int32_t ldac_BCO_configure(HANDLE_LDAC_BCO hLdacBco, 128 * int32_t sample_rate, int32_t bits_per_sample, 129 * int32_t channel_mode); 130 * Arguments 131 * HANDLE_LDAC_BCO hLdacBco LDAC BCO handle. 132 * int32_t sample_rate sample rate. 133 * int32_t bits_per_sample bits/sample. 134 * int32_t channel_mode channel mode. 135 * Return value 136 * int32_t : Processing result. 137 * LDAC_BCO_ERR_NONE:Successful completion 138 * LDAC_BCO_ERR_FATAL:Error 139 * Note 140 * The function ldac_BCO_init() shall be called before calling this 141 * function. 142 */ 143 LDAC_BCO_API int32_t ldac_BCO_configure(HANDLE_LDAC_BCO hLdacBco, 144 int32_t sample_rate, 145 int32_t bits_per_sample, 146 int32_t channel_mode); 147 148 #ifdef __cplusplus 149 } 150 #endif /* __cplusplus */ 151 152 #endif /* LDACBT_BCO_FOR_FLUORIDE_H__ */ 153