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