Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 1 | /* |
Josh Kirsch | c03f31d | 2019-01-15 11:50:53 -0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 3 | * Not a Contribution. |
| 4 | * |
| 5 | * Copyright (C) 2011 The Android Open Source Project * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | |
| 19 | #ifndef QTI_AUDIO_QAHW_H |
| 20 | #define QTI_AUDIO_QAHW_H |
| 21 | |
| 22 | #include <stdint.h> |
| 23 | #include <strings.h> |
| 24 | #include <sys/cdefs.h> |
| 25 | #include <sys/types.h> |
| 26 | #include <sys/time.h> |
| 27 | #include <cutils/bitops.h> |
| 28 | #include <system/audio.h> |
| 29 | #include "qahw_defs.h" |
Trinath Thammishetty | 85b1929 | 2017-12-18 14:56:50 +0530 | [diff] [blame] | 30 | #include "qahw_effect_api.h" |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 31 | |
| 32 | __BEGIN_DECLS |
Trinath Thammishetty | 85b1929 | 2017-12-18 14:56:50 +0530 | [diff] [blame] | 33 | |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 34 | /* |
| 35 | * Helper macros for module implementors. |
| 36 | * |
| 37 | * The derived modules should provide convenience macros for supported |
| 38 | * versions so that implementations can explicitly specify module |
| 39 | * versions at definition time. |
| 40 | */ |
| 41 | |
| 42 | #define QAHW_MAKE_API_VERSION(maj,min) \ |
| 43 | ((((maj) & 0xff) << 8) | ((min) & 0xff)) |
| 44 | |
| 45 | /* First generation of audio devices had version hardcoded to 0. all devices with |
| 46 | * versions < 1.0 will be considered of first generation API. |
| 47 | */ |
Josh Kirsch | c03f31d | 2019-01-15 11:50:53 -0800 | [diff] [blame] | 48 | #if QAHW_V1 |
| 49 | #define QAHW_MODULE_API_VERSION_1_0 QAHW_MAKE_API_VERSION(1, 0) |
| 50 | #endif |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 51 | #define QAHW_MODULE_API_VERSION_0_0 QAHW_MAKE_API_VERSION(0, 0) |
| 52 | |
| 53 | /* Minimal QTI audio HAL version supported by the audio framework */ |
| 54 | #define QAHW_MODULE_API_VERSION_MIN QAHW_MODULE_API_VERSION_0_0 |
| 55 | |
| 56 | /** |
| 57 | * List of known audio HAL modules. This is the base name of the audio HAL |
| 58 | * library composed of the "audio." prefix, one of the base names below and |
| 59 | * a suffix specific to the device. |
| 60 | * e.g: audio.primary.goldfish.so or audio.a2dp.default.so |
| 61 | */ |
| 62 | |
| 63 | #define QAHW_MODULE_ID_PRIMARY "audio.primary" |
| 64 | #define QAHW_MODULE_ID_A2DP "audio.a2dp" |
| 65 | #define QAHW_MODULE_ID_USB "audio.usb" |
| 66 | |
| 67 | typedef void qahw_module_handle_t; |
| 68 | typedef void qahw_stream_handle_t; |
| 69 | |
| 70 | #ifdef __cplusplus |
| 71 | extern "C" |
| 72 | { |
| 73 | #endif |
| 74 | /**************************************/ |
| 75 | /* Output stream specific APIs **/ |
| 76 | |
| 77 | /* |
| 78 | * This method creates and opens the audio hardware output stream. |
| 79 | * The "address" parameter qualifies the "devices" audio device type if needed. |
| 80 | * The format format depends on the device type: |
| 81 | * - Bluetooth devices use the MAC address of the device in the form "00:11:22:AA:BB:CC" |
| 82 | * - USB devices use the ALSA card and device numbers in the form "card=X;device=Y" |
| 83 | * - Other devices may use a number or any other string. |
| 84 | */ |
| 85 | |
| 86 | int qahw_open_output_stream_l(qahw_module_handle_t *hw_module, |
| 87 | audio_io_handle_t handle, |
| 88 | audio_devices_t devices, |
| 89 | audio_output_flags_t flags, |
| 90 | struct audio_config *config, |
| 91 | qahw_stream_handle_t **out_handle, |
| 92 | const char *address); |
| 93 | |
| 94 | int qahw_close_output_stream_l(qahw_stream_handle_t *out_handle); |
| 95 | |
| 96 | /* |
| 97 | * Return the sampling rate in Hz - eg. 44100. |
| 98 | */ |
| 99 | uint32_t qahw_out_get_sample_rate_l(const qahw_stream_handle_t *stream); |
| 100 | |
| 101 | /* |
| 102 | * use set_parameters with key QAHW_PARAMETER_STREAM_SAMPLING_RATE |
| 103 | */ |
| 104 | int qahw_out_set_sample_rate_l(qahw_stream_handle_t *stream, uint32_t rate); |
| 105 | |
| 106 | /* |
| 107 | * Return size of input/output buffer in bytes for this stream - eg. 4800. |
| 108 | * It should be a multiple of the frame size. See also get_input_buffer_size. |
| 109 | */ |
| 110 | size_t qahw_out_get_buffer_size_l(const qahw_stream_handle_t *stream); |
| 111 | |
| 112 | /* |
| 113 | * Return the channel mask - |
| 114 | * e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO |
| 115 | */ |
| 116 | audio_channel_mask_t qahw_out_get_channels_l(const qahw_stream_handle_t *stream); |
| 117 | |
| 118 | /* |
| 119 | * Return the audio format - e.g. AUDIO_FORMAT_PCM_16_BIT |
| 120 | */ |
| 121 | audio_format_t qahw_out_get_format_l(const qahw_stream_handle_t *stream); |
| 122 | |
| 123 | /* |
| 124 | * Put the audio hardware input/output into standby mode. |
| 125 | * Driver should exit from standby mode at the next I/O operation. |
| 126 | * Returns 0 on success and <0 on failure. |
| 127 | */ |
| 128 | int qahw_out_standby_l(qahw_stream_handle_t *stream); |
| 129 | |
| 130 | /* |
| 131 | * set/get audio stream parameters. The function accepts a list of |
| 132 | * parameter key value pairs in the form: key1=value1;key2=value2;... |
| 133 | * |
| 134 | * Some keys are reserved for standard parameters (See AudioParameter class) |
| 135 | * |
| 136 | * If the implementation does not accept a parameter change while |
| 137 | * the output is active but the parameter is acceptable otherwise, it must |
| 138 | * return -ENOSYS. |
| 139 | * |
| 140 | * The audio flinger will put the stream in standby and then change the |
| 141 | * parameter value. |
| 142 | */ |
| 143 | int qahw_out_set_parameters_l(qahw_stream_handle_t *stream, const char*kv_pairs); |
| 144 | |
| 145 | /* |
| 146 | * Returns a pointer to a heap allocated string. The caller is responsible |
| 147 | * for freeing the memory for it using free(). |
| 148 | */ |
| 149 | char* qahw_out_get_parameters_l(const qahw_stream_handle_t *stream, |
| 150 | const char *keys); |
| 151 | |
| 152 | /* API to set playback stream specific config parameters */ |
| 153 | int qahw_out_set_param_data_l(qahw_stream_handle_t *out_handle, |
| 154 | qahw_param_id param_id, |
| 155 | qahw_param_payload *payload); |
| 156 | |
| 157 | /* API to get playback stream specific config parameters */ |
| 158 | int qahw_out_get_param_data_l(qahw_stream_handle_t *out_handle, |
| 159 | qahw_param_id param_id, |
| 160 | qahw_param_payload *payload); |
| 161 | |
| 162 | /* |
| 163 | * Return the audio hardware driver estimated latency in milliseconds. |
| 164 | */ |
| 165 | uint32_t qahw_out_get_latency_l(const qahw_stream_handle_t *stream); |
| 166 | |
| 167 | /* |
| 168 | * Use this method in situations where audio mixing is done in the |
| 169 | * hardware. This method serves as a direct interface with hardware, |
| 170 | * allowing you to directly set the volume as apposed to via the framework. |
| 171 | * This method might produce multiple PCM outputs or hardware accelerated |
| 172 | * codecs, such as MP3 or AAC. |
| 173 | */ |
| 174 | int qahw_out_set_volume_l(qahw_stream_handle_t *stream, float left, float right); |
| 175 | |
| 176 | /* |
| 177 | * Write audio buffer present in meta_data starting from offset |
| 178 | * along with timestamp to driver. Returns number of bytes |
| 179 | * written or a negative status_t. If at least one frame was written successfully |
| 180 | * prior to the error, it is suggested that the driver return that successful |
| 181 | * (short) byte count and then return an error in the subsequent call. |
| 182 | * timestamp is only sent driver is session has been opened with timestamp flag |
| 183 | * otherwise its ignored. |
| 184 | * |
| 185 | * If set_callback() has previously been called to enable non-blocking mode |
| 186 | * the write() is not allowed to block. It must write only the number of |
| 187 | * bytes that currently fit in the driver/hardware buffer and then return |
| 188 | * this byte count. If this is less than the requested write size the |
| 189 | * callback function must be called when more space is available in the |
| 190 | * driver/hardware buffer. |
| 191 | */ |
| 192 | ssize_t qahw_out_write_l(qahw_stream_handle_t *stream, |
| 193 | qahw_out_buffer_t *out_buf); |
| 194 | |
| 195 | /* |
| 196 | * return the number of audio frames written by the audio dsp to DAC since |
| 197 | * the output has exited standby |
| 198 | */ |
| 199 | int qahw_out_get_render_position_l(const qahw_stream_handle_t *stream, |
| 200 | uint32_t *dsp_frames); |
| 201 | |
| 202 | /* |
| 203 | * set the callback function for notifying completion of non-blocking |
| 204 | * write and drain. |
| 205 | * Calling this function implies that all future rite() and drain() |
| 206 | * must be non-blocking and use the callback to signal completion. |
| 207 | */ |
| 208 | int qahw_out_set_callback_l(qahw_stream_handle_t *stream, |
| 209 | qahw_stream_callback_t callback, |
| 210 | void *cookie); |
| 211 | |
| 212 | /* |
| 213 | * Notifies to the audio driver to stop playback however the queued buffers are |
| 214 | * retained by the hardware. Useful for implementing pause/resume. Empty implementation |
| 215 | * if not supported however should be implemented for hardware with non-trivial |
| 216 | * latency. In the pause state audio hardware could still be using power. User may |
| 217 | * consider calling suspend after a timeout. |
| 218 | * |
| 219 | * Implementation of this function is mandatory for offloaded playback. |
| 220 | */ |
| 221 | int qahw_out_pause_l(qahw_stream_handle_t *out_handle); |
| 222 | |
| 223 | /* |
| 224 | * Notifies to the audio driver to resume playback following a pause. |
| 225 | * Returns error if called without matching pause. |
| 226 | * |
| 227 | * Implementation of this function is mandatory for offloaded playback. |
| 228 | */ |
| 229 | int qahw_out_resume_l(qahw_stream_handle_t *out_handle); |
| 230 | |
| 231 | /* |
| 232 | * Requests notification when data buffered by the driver/hardware has |
| 233 | * been played. If set_callback() has previously been called to enable |
| 234 | * non-blocking mode, the drain() must not block, instead it should return |
| 235 | * quickly and completion of the drain is notified through the callback. |
| 236 | * If set_callback() has not been called, the drain() must block until |
| 237 | * completion. |
| 238 | * If type==AUDIO_DRAIN_ALL, the drain completes when all previously written |
| 239 | * data has been played. |
| 240 | * If type==AUDIO_DRAIN_EARLY_NOTIFY, the drain completes shortly before all |
| 241 | * data for the current track has played to allow time for the framework |
| 242 | * to perform a gapless track switch. |
| 243 | * |
| 244 | * Drain must return immediately on stop() and flush() call |
| 245 | * |
| 246 | * Implementation of this function is mandatory for offloaded playback. |
| 247 | */ |
| 248 | int qahw_out_drain_l(qahw_stream_handle_t *out_handle, qahw_drain_type_t type); |
| 249 | |
| 250 | /* |
| 251 | * Notifies to the audio driver to flush the queued data. Stream must already |
| 252 | * be paused before calling flush(). |
| 253 | * |
| 254 | * Implementation of this function is mandatory for offloaded playback. |
| 255 | */ |
| 256 | int qahw_out_flush_l(qahw_stream_handle_t *out_handle); |
| 257 | |
| 258 | /* |
| 259 | * Return a recent count of the number of audio frames presented to an external observer. |
| 260 | * This excludes frames which have been written but are still in the pipeline. |
| 261 | * The count is not reset to zero when output enters standby. |
| 262 | * Also returns the value of CLOCK_MONOTONIC as of this presentation count. |
| 263 | * The returned count is expected to be 'recent', |
| 264 | * but does not need to be the most recent possible value. |
| 265 | * However, the associated time should correspond to whatever count is returned. |
| 266 | * Example: assume that N+M frames have been presented, where M is a 'small' number. |
| 267 | * Then it is permissible to return N instead of N+M, |
| 268 | * and the timestamp should correspond to N rather than N+M. |
| 269 | * The terms 'recent' and 'small' are not defined. |
| 270 | * They reflect the quality of the implementation. |
| 271 | * |
| 272 | * 3.0 and higher only. |
| 273 | */ |
| 274 | int qahw_out_get_presentation_position_l(const qahw_stream_handle_t *out_handle, |
| 275 | uint64_t *frames, struct timespec *timestamp); |
| 276 | |
| 277 | /* Input stream specific APIs */ |
| 278 | |
| 279 | /* This method creates and opens the audio hardware input stream */ |
| 280 | int qahw_open_input_stream_l(qahw_module_handle_t *hw_module, |
| 281 | audio_io_handle_t handle, |
| 282 | audio_devices_t devices, |
| 283 | struct audio_config *config, |
| 284 | qahw_stream_handle_t **stream_in, |
| 285 | audio_input_flags_t flags, |
| 286 | const char *address, |
| 287 | audio_source_t source); |
| 288 | |
| 289 | int qahw_close_input_stream_l(qahw_stream_handle_t *in_handle); |
| 290 | |
| 291 | /* |
| 292 | * Return the sampling rate in Hz - eg. 44100. |
| 293 | */ |
| 294 | uint32_t qahw_in_get_sample_rate_l(const qahw_stream_handle_t *in_handle); |
| 295 | |
| 296 | /* |
| 297 | * currently unused - use set_parameters with key |
| 298 | * QAHW_PARAMETER_STREAM_SAMPLING_RATE |
| 299 | */ |
| 300 | int qahw_in_set_sample_rate_l(qahw_stream_handle_t *in_handle, uint32_t rate); |
| 301 | |
| 302 | /* |
| 303 | * Return size of input/output buffer in bytes for this stream - eg. 4800. |
| 304 | * It should be a multiple of the frame size. See also get_input_buffer_size. |
| 305 | */ |
| 306 | size_t qahw_in_get_buffer_size_l(const qahw_stream_handle_t *in_handle); |
| 307 | |
| 308 | /* |
| 309 | * Return the channel mask - |
| 310 | * e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO |
| 311 | */ |
| 312 | audio_channel_mask_t qahw_in_get_channels_l(const qahw_stream_handle_t *in_handle); |
| 313 | |
| 314 | /* |
| 315 | * Return the audio format - e.g. AUDIO_FORMAT_PCM_16_BIT |
| 316 | */ |
| 317 | audio_format_t qahw_in_get_format_l(const qahw_stream_handle_t *in_handle); |
| 318 | |
| 319 | /* |
| 320 | * currently unused - use set_parameters with key |
| 321 | * QAHW_PARAMETER_STREAM_FORMAT |
| 322 | */ |
| 323 | int qahw_in_set_format_l(qahw_stream_handle_t *in_handle, audio_format_t format); |
| 324 | |
| 325 | /* |
| 326 | * Put the audio hardware input/output into standby mode. |
| 327 | * Driver should exit from standby mode at the next I/O operation. |
| 328 | * Returns 0 on success and <0 on failure. |
| 329 | */ |
| 330 | int qahw_in_standby_l(qahw_stream_handle_t *in_handle); |
| 331 | |
| 332 | /* |
| 333 | * set/get audio stream parameters. The function accepts a list of |
| 334 | * parameter key value pairs in the form: key1=value1;key2=value2;... |
| 335 | * |
| 336 | * Some keys are reserved for standard parameters (See AudioParameter class) |
| 337 | * |
| 338 | * If the implementation does not accept a parameter change while |
| 339 | * the output is active but the parameter is acceptable otherwise, it must |
| 340 | * return -ENOSYS. |
| 341 | * |
| 342 | * The audio flinger will put the stream in standby and then change the |
| 343 | * parameter value. |
| 344 | */ |
| 345 | int qahw_in_set_parameters_l(qahw_stream_handle_t *in_handle, const char *kv_pairs); |
| 346 | |
| 347 | /* |
| 348 | * Returns a pointer to a heap allocated string. The caller is responsible |
| 349 | * for freeing the memory for it using free(). |
| 350 | */ |
| 351 | char* qahw_in_get_parameters_l(const qahw_stream_handle_t *in_handle, |
| 352 | const char *keys); |
| 353 | /* |
| 354 | * Read audio buffer in from audio driver. Returns number of bytes read, or a |
| 355 | * negative status_t. meta_data structure is filled buffer pointer, start |
| 356 | * offset and valid catpure timestamp (if session is opened with timetamp flag) |
| 357 | * and buffer. if at least one frame was read prior to the error, |
| 358 | * read should return that byte count and then return an error in the |
| 359 | * subsequent call. |
| 360 | */ |
| 361 | ssize_t qahw_in_read_l(qahw_stream_handle_t *in_handle, |
| 362 | qahw_in_buffer_t *in_buf); |
| 363 | /* |
Manish Dewangan | 46e0798 | 2018-12-13 18:18:59 +0530 | [diff] [blame] | 364 | * Stop input stream. Returns zero on success. |
| 365 | */ |
| 366 | int qahw_in_stop_l(qahw_stream_handle_t *in_handle); |
| 367 | /* |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 368 | * Return the amount of input frames lost in the audio driver since the |
| 369 | * last call of this function. |
| 370 | * Audio driver is expected to reset the value to 0 and restart counting |
| 371 | * upon returning the current value by this function call. |
| 372 | * Such loss typically occurs when the user space process is blocked |
| 373 | * longer than the capacity of audio driver buffers. |
| 374 | * |
| 375 | * Unit: the number of input audio frames |
| 376 | */ |
| 377 | uint32_t qahw_in_get_input_frames_lost_l(qahw_stream_handle_t *in_handle); |
| 378 | |
| 379 | /* |
| 380 | * Return a recent count of the number of audio frames received and |
| 381 | * the clock time associated with that frame count. |
| 382 | * |
| 383 | * frames is the total frame count received. This should be as early in |
| 384 | * the capture pipeline as possible. In general, |
| 385 | * frames should be non-negative and should not go "backwards". |
| 386 | * |
| 387 | * time is the clock MONOTONIC time when frames was measured. In general, |
| 388 | * time should be a positive quantity and should not go "backwards". |
| 389 | * |
| 390 | * The status returned is 0 on success, -ENOSYS if the device is not |
| 391 | * ready/available, or -EINVAL if the arguments are null or otherwise invalid. |
| 392 | */ |
| 393 | int qahw_in_get_capture_position_l(const qahw_stream_handle_t *in_handle, |
| 394 | int64_t *frames, int64_t *time); |
| 395 | |
| 396 | /* Module specific APIs */ |
| 397 | |
| 398 | /* convenience API for opening and closing an audio HAL module */ |
| 399 | qahw_module_handle_t *qahw_load_module_l(const char *hw_module_id); |
| 400 | |
| 401 | int qahw_unload_module_l(qahw_module_handle_t *hw_module); |
| 402 | |
| 403 | /* |
| 404 | * check to see if the audio hardware interface has been initialized. |
| 405 | * returns 0 on success, -ENODEV on failure. |
| 406 | */ |
| 407 | int qahw_init_check_l(const qahw_module_handle_t *hw_module); |
| 408 | |
| 409 | /* set the audio volume of a voice call. Range is between 0.0 and 1.0 */ |
| 410 | int qahw_set_voice_volume_l(qahw_module_handle_t *hw_module, float volume); |
| 411 | |
| 412 | /* |
| 413 | * set_mode is called when the audio mode changes. AUDIO_MODE_NORMAL mode |
| 414 | * is for standard audio playback, AUDIO_MODE_RINGTONE when a ringtone is |
| 415 | * playing, and AUDIO_MODE_IN_CALL when a call is in progress. |
| 416 | */ |
| 417 | int qahw_set_mode_l(qahw_module_handle_t *hw_module, audio_mode_t mode); |
| 418 | |
| 419 | /* Mute/unmute mic during voice/voip/HFP call */ |
| 420 | int qahw_set_mic_mute_l(qahw_module_handle_t *hw_module, bool state); |
| 421 | |
| 422 | /* Get mute/unmute status of mic during voice call */ |
| 423 | int qahw_get_mic_mute_l(qahw_module_handle_t *hw_module, bool *state); |
| 424 | |
| 425 | /* set/get global audio parameters */ |
| 426 | int qahw_set_parameters_l(qahw_module_handle_t *hw_module, const char *kv_pairs); |
| 427 | |
| 428 | /* |
| 429 | * Returns a pointer to a heap allocated string. The caller is responsible |
| 430 | * for freeing the memory for it using free(). |
| 431 | */ |
| 432 | char* qahw_get_parameters_l(const qahw_module_handle_t *hw_module, |
| 433 | const char *keys); |
| 434 | |
| 435 | /* Returns audio input buffer size according to parameters passed or |
| 436 | * 0 if one of the parameters is not supported. |
| 437 | * See also get_buffer_size which is for a particular stream. |
| 438 | */ |
| 439 | size_t qahw_get_input_buffer_size_l(const qahw_module_handle_t *hw_module, |
| 440 | const struct audio_config *config); |
| 441 | |
| 442 | /*returns current QTI HAL version */ |
| 443 | int qahw_get_version_l(); |
| 444 | |
| 445 | /* Api to implement get parameters based on keyword param_id |
| 446 | * and store data in payload. |
| 447 | */ |
| 448 | int qahw_get_param_data_l(const qahw_module_handle_t *hw_module, |
| 449 | qahw_param_id param_id, |
| 450 | qahw_param_payload *payload); |
| 451 | |
| 452 | /* Api to implement set parameters based on keyword param_id |
| 453 | * and data present in payload. |
| 454 | */ |
| 455 | int qahw_set_param_data_l(const qahw_module_handle_t *hw_module, |
| 456 | qahw_param_id param_id, |
| 457 | qahw_param_payload *payload); |
| 458 | |
| 459 | /* Creates an audio patch between several source and sink ports. |
| 460 | * The handle is allocated by the HAL and should be unique for this |
| 461 | * audio HAL module. |
| 462 | */ |
| 463 | int qahw_create_audio_patch_l(qahw_module_handle_t *hw_module, |
| 464 | unsigned int num_sources, |
| 465 | const struct audio_port_config *sources, |
| 466 | unsigned int num_sinks, |
| 467 | const struct audio_port_config *sinks, |
| 468 | audio_patch_handle_t *handle); |
| 469 | |
| 470 | /* Release an audio patch */ |
| 471 | int qahw_release_audio_patch_l(qahw_module_handle_t *hw_module, |
| 472 | audio_patch_handle_t handle); |
Trinath Thammishetty | 580f1de | 2018-09-28 12:43:24 +0530 | [diff] [blame] | 473 | |
| 474 | /* API to set loopback stream specific config parameters. */ |
| 475 | int qahw_loopback_set_param_data_l(qahw_module_handle_t *hw_module, |
| 476 | audio_patch_handle_t handle, |
| 477 | qahw_loopback_param_id param_id, |
| 478 | qahw_loopback_param_payload *payload); |
| 479 | |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 480 | /* Fills the list of supported attributes for a given audio port. |
| 481 | * As input, "port" contains the information (type, role, address etc...) |
| 482 | * needed by the HAL to identify the port. |
| 483 | * As output, "port" contains possible attributes (sampling rates, formats, |
| 484 | * channel masks, gain controllers...) for this port. |
| 485 | */ |
| 486 | int qahw_get_audio_port_l(qahw_module_handle_t *hw_module, |
| 487 | struct audio_port *port); |
| 488 | |
| 489 | /* Set audio port configuration */ |
| 490 | int qahw_set_audio_port_config_l(qahw_module_handle_t *hw_module, |
| 491 | const struct audio_port_config *config); |
Trinath Thammishetty | 85b1929 | 2017-12-18 14:56:50 +0530 | [diff] [blame] | 492 | |
| 493 | /* Audio effects API */ |
| 494 | qahw_effect_lib_handle_t qahw_effect_load_library_l(const char *lib_path); |
| 495 | |
| 496 | int32_t qahw_effect_unload_library_l(qahw_effect_lib_handle_t handle); |
| 497 | |
| 498 | int32_t qahw_effect_create_l(qahw_effect_lib_handle_t handle, |
| 499 | const qahw_effect_uuid_t *uuid, |
| 500 | int32_t io_handle, |
| 501 | qahw_effect_handle_t *effect_handle); |
| 502 | |
| 503 | int32_t qahw_effect_release_l(qahw_effect_lib_handle_t handle, |
| 504 | qahw_effect_handle_t effect_handle); |
| 505 | |
| 506 | int32_t qahw_effect_get_descriptor_l(qahw_effect_lib_handle_t handle, |
| 507 | const qahw_effect_uuid_t *uuid, |
| 508 | qahw_effect_descriptor_t *effect_desc); |
| 509 | |
| 510 | int32_t qahw_effect_get_version_l(); |
| 511 | |
| 512 | int32_t qahw_effect_process_l(qahw_effect_handle_t self, |
| 513 | qahw_audio_buffer_t *in_buffer, |
| 514 | qahw_audio_buffer_t *out_buffer); |
| 515 | |
| 516 | int32_t qahw_effect_command_l(qahw_effect_handle_t self, |
| 517 | uint32_t cmd_code, |
| 518 | uint32_t cmd_size, |
| 519 | void *cmd_data, |
| 520 | uint32_t *reply_size, |
| 521 | void *reply_data); |
| 522 | |
| 523 | int32_t qahw_effect_process_reverse_l(qahw_effect_handle_t self, |
| 524 | qahw_audio_buffer_t *in_buffer, |
| 525 | qahw_audio_buffer_t *out_buffer); |
| 526 | |
Sidipotu Ashok | 404f26d | 2017-10-10 22:27:51 +0530 | [diff] [blame] | 527 | #ifdef __cplusplus |
| 528 | } |
| 529 | #endif |
| 530 | |
| 531 | __END_DECLS |
| 532 | |
| 533 | #endif // QTI_AUDIO_QAHW_H |