1 /* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef AUDIO_INTERNAL_H 17 #define AUDIO_INTERNAL_H 18 19 #include <errno.h> 20 #include <inttypes.h> 21 #include <math.h> 22 #include <pthread.h> 23 #include <sys/mman.h> 24 #include <sys/types.h> 25 #include <unistd.h> 26 27 #include "audio_common.h" 28 #include "audio_manager.h" 29 #include "hdf_base.h" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 #define LOG_ENABLE 0 36 #define LOGV_ENABLE 0 37 #define NAME_LEN 64 38 #define BIT_NUM_32 32 39 #define BIT_NUM_24 24 40 #define BIT_NUM_16 16 41 #define BIT_NUM_8 8 42 #define PERIOD_COUNT 2 43 #define FRAME_DATA (8192 * 2) 44 #define PATHPLAN_LEN 64 45 #define PATHPLAN_COUNT 32 46 #define PATH_NAME_LEN 128 47 #define VOLUME_CHANGE 100 48 #define SEC_TO_NSEC 1000000000 49 #define MAP_MAX 100 50 #define FORMAT_ONE "%-5d %-10d %-20" PRIu64 " %-15s %s\n" 51 #define FORMAT_TWO "%-5d %-10d %s\n" 52 #define ERROR_LOG_MAX_NUM 8 53 #define ERROR_REASON_DESC_LEN 64 54 #define RANGE_MAX 5 55 #define RANGE_MIN 4 56 #define EXTPARAM_LEN 32 57 #define KEY_VALUE_LIST_LEN 128 58 59 #define HDF_AUDIO_CODEC_PRIMARY_DEV "hdf_audio_codec_primary_dev" 60 #define HDF_AUDIO_CODEC_HDMI_DEV "hdf_audio_codec_hdmi_dev" 61 #define HDF_AUDIO_CODEC_USB_DEV "hdf_audio_codec_usb_dev" 62 #define HDF_AUDIO_CODEC_A2DP_DEV "hdf_audio_codec_a2dp_dev" 63 #define PRIMARY "primary" 64 #define USB "usb" 65 #define A2DP "a2dp" 66 #define HDMI "hdmi" 67 68 /** 69 * @brief Enumerates HAL return value types. 70 */ 71 typedef enum { 72 AUDIO_HAL_SUCCESS = 0, 73 AUDIO_HAL_ERR_INTERNAL = -1, /* audio system internal errors */ 74 AUDIO_HAL_ERR_NOT_SUPPORT = -2, /* operation is not supported */ 75 AUDIO_HAL_ERR_INVALID_PARAM = -3, /* parameter is invalid */ 76 AUDIO_HAL_ERR_INVALID_OBJECT = -4, /* Invalid object */ 77 AUDIO_HAL_ERR_MALLOC_FAIL = -6, /* Memory allocation fails */ 78 79 #define HDF_AUDIO_HAL_ERR_START (-7000) /* Defines the start of the device module error codes. */ 80 #define HDF_AUDIO_HAL_ERR_NUM(v) (HDF_AUDIO_HAL_ERR_START + (v)) /* Defines the device module error codes. */ 81 AUDIO_HAL_ERR_NOTREADY = HDF_AUDIO_HAL_ERR_NUM(-1), /* audio adapter is not ready */ 82 AUDIO_HAL_ERR_AI_BUSY = HDF_AUDIO_HAL_ERR_NUM(-2), /* audio capture is busy now */ 83 AUDIO_HAL_ERR_AO_BUSY = HDF_AUDIO_HAL_ERR_NUM(-3), /* audio render is busy now */ 84 } AUDIO_HAL_ERR_CODE; 85 86 #ifndef UNUSED 87 #define UNUSED(x) ((void)(x)) 88 #endif 89 90 #ifndef UT_TEST 91 #define STATIC_T static 92 #else 93 #define STATIC_T 94 #endif 95 96 #define USECASE_AUDIO_RENDER_DEEP_BUFFER "deep-buffer-render" 97 #define USECASE_AUDIO_RENDER_LOW_LATENCY "low-latency-render" 98 99 #define AUDIO_ATTR_PARAM_ROUTE "attr-route" 100 #define ROUTE_SAMPLE "attr-route=x;" 101 #define AUDIO_ATTR_PARAM_FORMAT "attr-format" 102 #define FORMAT_SAMPLE "attr-format=xx;" 103 #define AUDIO_ATTR_PARAM_CHANNELS "attr-channels" 104 #define CHANNELS_SAMPLE "attr-channels=x;" 105 #define AUDIO_ATTR_PARAM_FRAME_COUNT "attr-frame-count" 106 #define FRAME_COUNT_SAMPLE "attr-frame-count=xxxxxxxxxxxxxxxxxxxx;" 107 #define AUDIO_ATTR_PARAM_SAMPLING_RATE "attr-sampling-rate" 108 #define SAMPLING_RATE_SAMPLE "attr-sampling-rate=xxxxx" 109 #define AUDIO_ATTR_PARAM_CONNECT "usb-connect" 110 #define AUDIO_ATTR_PARAM_DISCONNECT "usb-disconnect" 111 #define TELHPONE_RATE 8000 112 #define BROADCAST_AM_RATE 11025 113 #define BROADCAST_FM_RATE 22050 114 #define MINI_CAM_DV_RATE 32000 115 #define MUSIC_RATE 44100 116 #define HIGHT_MUSIC_RATE 48000 117 #define AUDIO_SAMPLE_RATE_12000 12000 118 #define AUDIO_SAMPLE_RATE_16000 16000 119 #define AUDIO_SAMPLE_RATE_24000 24000 120 #define AUDIO_SAMPLE_RATE_64000 64000 121 #define AUDIO_SAMPLE_RATE_96000 96000 122 #define SUPPORT_ADAPTER_NUM_MAX 8 123 typedef int32_t (*CallbackProcessFunc)(AudioHandle handle, enum AudioCallbackType callBackType); 124 125 enum AudioTurnStandbyMode { 126 AUDIO_TURN_STANDBY_LATER = 0, 127 AUDIO_TURN_STANDBY_NOW, 128 AUDIO_TURN_STANDBY_BUTT, 129 }; 130 131 struct DevHandle { 132 void *object; 133 }; 134 135 struct AudioPortAndCapability { 136 struct AudioPort port; 137 struct AudioPortCapability capability; 138 enum AudioPortPassthroughMode mode; 139 }; 140 141 struct AudioHwAdapter { 142 struct AudioAdapter common; 143 struct AudioAdapterDescriptor adapterDescriptor; 144 struct AudioPortAndCapability *portCapabilitys; 145 struct HdfRemoteService *proxyRemoteHandle; // proxyRemoteHandle 146 int32_t adapterMgrRenderFlag; 147 int32_t adapterMgrCaptureFlag; 148 }; 149 150 struct AudioFrameRenderMode { 151 uint64_t frames; 152 struct AudioTimeStamp time; 153 struct AudioSampleAttributes attrs; 154 enum AudioChannelMode mode; 155 uint32_t byteRate; 156 uint32_t periodSize; 157 uint32_t periodCount; 158 uint32_t startThreshold; 159 uint32_t stopThreshold; 160 uint32_t silenceThreshold; 161 uint32_t silenceSize; 162 char *buffer; 163 uint64_t bufferFrameSize; 164 uint64_t bufferSize; 165 RenderCallback callback; 166 void* cookie; 167 CallbackProcessFunc callbackProcess; 168 AudioHandle renderhandle; 169 struct AudioMmapBufferDescriptor mmapBufDesc; 170 }; 171 172 struct AudioGain { 173 float gain; 174 float gainMin; 175 float gainMax; 176 }; 177 178 struct AudioVol { 179 int volMin; 180 int volMax; 181 }; 182 183 struct AudioCtlParam { 184 bool mute; 185 float volume; 186 float speed; 187 bool pause; 188 bool stop; 189 pthread_mutex_t mutex; 190 bool mutexFlag; 191 pthread_cond_t functionCond; 192 struct AudioVol volThreshold; 193 struct AudioGain audioGain; 194 enum AudioTurnStandbyMode turnStandbyStatus; 195 }; 196 197 enum PathRoute { 198 DEEP_BUFF = 0, 199 RECORD, 200 RECORD_LOW_LATRNCY, 201 LOW_LATRNCY, 202 }; 203 204 struct PathPlan { 205 char pathPlanName[PATHPLAN_LEN]; 206 int value; 207 }; 208 209 struct PathDeviceSwitch { 210 char deviceSwitch[PATHPLAN_LEN]; 211 int32_t value; 212 }; 213 214 struct PathDeviceInfo { 215 char deviceType[NAME_LEN]; 216 int32_t deviceNum; 217 struct PathDeviceSwitch deviceSwitchs[PATHPLAN_COUNT]; 218 }; 219 220 struct PathSelect { 221 char useCase[NAME_LEN]; 222 struct PathDeviceInfo deviceInfo; 223 int useCaseDeviceNum; 224 struct PathPlan pathPlan[PATHPLAN_COUNT]; 225 }; 226 227 struct HwInfo { 228 uint32_t card; 229 uint32_t device; 230 char cardServiceName[NAME_LEN]; 231 int flags; 232 bool callBackEnable; 233 char adapterName[NAME_LEN]; 234 struct AudioPort portDescript; 235 struct AudioDeviceDescriptor deviceDescript; 236 enum PathRoute pathroute; 237 struct PathSelect pathSelect; 238 }; 239 240 struct AudioHwRenderMode { 241 struct AudioCtlParam ctlParam; 242 struct HwInfo hwInfo; 243 }; 244 245 struct AudioHwRenderParam { 246 struct AudioHwRenderMode renderMode; 247 struct AudioFrameRenderMode frameRenderMode; 248 }; 249 250 struct ErrorDump { 251 int32_t errorCode; 252 int32_t count; 253 uint64_t frames; 254 char *reason; // Specific reasons for failure 255 char *currentTime; 256 }; 257 258 struct ErrorLog { 259 uint32_t totalErrors; 260 uint32_t iter; 261 struct ErrorDump errorDump[ERROR_LOG_MAX_NUM]; 262 }; 263 264 struct AudioHwRender { 265 struct AudioRender common; 266 struct AudioHwRenderParam renderParam; 267 struct DevHandle *devDataHandle; // Bind Data handle 268 struct DevHandle *devCtlHandle; // Bind Ctl handle 269 struct HdfRemoteService *proxyRemoteHandle; // proxyRemoteHandle 270 struct ErrorLog errorLog; 271 }; 272 273 struct AudioHwCaptureMode { 274 struct AudioCtlParam ctlParam; 275 struct HwInfo hwInfo; 276 }; 277 278 struct AudioFrameCaptureMode { 279 uint64_t frames; 280 struct AudioTimeStamp time; 281 struct AudioSampleAttributes attrs; 282 enum AudioChannelMode mode; 283 uint32_t byteRate; 284 uint32_t periodSize; 285 uint32_t periodCount; 286 uint32_t startThreshold; 287 uint32_t stopThreshold; 288 uint32_t silenceThreshold; 289 uint32_t silenceSize; 290 char *buffer; 291 uint64_t bufferFrameSize; 292 uint64_t bufferSize; 293 struct AudioMmapBufferDescriptor mmapBufDesc; 294 }; 295 296 struct AudioHwCaptureParam { 297 struct AudioHwCaptureMode captureMode; 298 struct AudioFrameCaptureMode frameCaptureMode; 299 }; 300 301 struct AudioHwCapture { 302 struct AudioCapture common; 303 struct AudioHwCaptureParam captureParam; 304 struct DevHandle *devDataHandle; // Bind Data handle 305 struct DevHandle *devCtlHandle; // Bind Ctl handle 306 struct HdfRemoteService *proxyRemoteHandle; // proxyRemoteHandle 307 struct ErrorLog errorLog; 308 }; 309 310 struct ParamValMap { 311 char key[EXTPARAM_LEN]; 312 char value[EXTPARAM_LEN]; 313 }; 314 315 struct ExtraParams { 316 int32_t route; 317 int32_t format; 318 uint32_t channels; 319 uint64_t frames; 320 uint32_t sampleRate; 321 bool flag; 322 }; 323 324 enum AudioAddrType { 325 AUDIO_ADAPTER_ADDR = 0, /** Record the address of the adapter for FUZZ. */ 326 AUDIO_RENDER_ADDR, /** Record the address of the render for FUZZ. */ 327 AUDIO_CAPTURE_ADDR, /** Record the address of the capturef or FUZZ. */ 328 AUDIO_INVALID_ADDR, /** Invalid value. */ 329 }; 330 331 struct AudioAddrDB { // Record the address of the adapter Mgr for FUZZ. 332 void *addrValue; 333 const char *adapterName; 334 enum AudioAddrType addrType; 335 }; 336 337 enum ErrorDumpCode { 338 WRITE_FRAME_ERROR_CODE = -5, 339 }; 340 341 enum AudioAdaptType { 342 INVAILD_PATH_SELECT = -1, 343 RENDER_PATH_SELECT, 344 CAPTURE_PATH_SELECT, 345 CHECKSCENE_PATH_SELECT, 346 CHECKSCENE_PATH_SELECT_CAPTURE, 347 }; 348 349 enum AudioServiceNameType { 350 AUDIO_SERVICE_IN = 0, 351 AUDIO_SERVICE_OUT, 352 AUDIO_SERVICE_MAX, 353 }; 354 355 /* dispatch cmdId */ 356 enum AudioInterfaceLibParaCmdList { 357 AUDIO_DRV_PCM_IOCTL_HW_PARAMS = 0, 358 AUDIO_DRV_PCM_IOCTL_PREPARE, 359 AUDIO_DRV_PCM_IOCTL_PREPARE_CAPTURE, 360 AUDIO_DRV_PCM_IOCTL_WRITE, 361 AUDIO_DRV_PCM_IOCTL_READ, 362 AUDIO_DRV_PCM_IOCTRL_START, 363 AUDIO_DRV_PCM_IOCTRL_STOP, 364 AUDIO_DRV_PCM_IOCTRL_START_CAPTURE, 365 AUDIO_DRV_PCM_IOCTRL_STOP_CAPTURE, 366 AUDIO_DRV_PCM_IOCTRL_PAUSE, 367 AUDIO_DRV_PCM_IOCTRL_PAUSE_CAPTURE, 368 AUDIO_DRV_PCM_IOCTRL_RESUME, 369 AUDIO_DRV_PCM_IOCTRL_RESUME_CAPTURE, 370 AUDIO_DRV_PCM_IOCTL_MMAP_BUFFER, 371 AUDIO_DRV_PCM_IOCTL_MMAP_BUFFER_CAPTURE, 372 AUDIO_DRV_PCM_IOCTL_MMAP_POSITION, 373 AUDIO_DRV_PCM_IOCTL_MMAP_POSITION_CAPTURE, 374 AUDIO_DRV_PCM_IOCTRL_RENDER_OPEN, 375 AUDIO_DRV_PCM_IOCTRL_RENDER_CLOSE, 376 AUDIO_DRV_PCM_IOCTRL_CAPTURE_OPEN, 377 AUDIO_DRV_PCM_IOCTRL_CAPTURE_CLOSE, 378 AUDIO_DRV_PCM_IOCTL_BUTT, 379 }; 380 381 enum AudioStreamType { 382 AUDIO_CAPTURE_STREAM = 0, 383 AUDIO_RENDER_STREAM, 384 }; 385 386 typedef struct DevHandle *(*BindServiceRenderSo)(const char *); 387 typedef int32_t (*InterfaceLibModeRenderSo)(struct DevHandle *, struct AudioHwRenderParam *, int); 388 typedef void(*CloseServiceRenderSo)(struct DevHandle *); 389 390 typedef struct DevHandle *(*BindServiceCaptureSo)(const char *); 391 typedef int32_t (*InterfaceLibModeCaptureSo)(struct DevHandle *, struct AudioHwCaptureParam *, int); 392 typedef void(*CloseServiceCaptureSo)(struct DevHandle *); 393 394 typedef int32_t (*InterfaceLibGetCardInfoSo)(struct AudioAdapterDescriptor **, int *); 395 396 typedef int32_t (*PathSelGetConfToJsonObj)(void); 397 typedef int32_t (*PathSelAnalysisJson)(void *adapterParam, enum AudioAdaptType adaptType); 398 399 BindServiceRenderSo *AudioSoGetBindServiceRender(void); 400 InterfaceLibModeRenderSo *AudioSoGetInterfaceLibModeRender(void); 401 CloseServiceRenderSo *AudioSoGetCloseServiceRender(void); 402 403 BindServiceCaptureSo *AudioSoGetBindServiceCapture(void); 404 InterfaceLibModeCaptureSo *AudioSoGetInterfaceLibModeCapture(void); 405 CloseServiceCaptureSo *AudioSoGetCloseServiceCapture(void); 406 407 #ifndef AUDIO_HAL_NOTSUPPORT_PATHSELECT 408 PathSelGetConfToJsonObj *AudioSoGetPathSelGetConfToJsonObj(void); 409 PathSelAnalysisJson *AudioSoGetPathSelAnalysisJson(void); 410 #endif 411 412 int32_t GetAudioRenderFunc(struct AudioHwRender *hwRender); 413 int32_t CheckParaDesc(const struct AudioDeviceDescriptor *desc, const char *type); 414 int32_t CheckParaAttr(const struct AudioSampleAttributes *attrs); 415 int32_t AttrFormatToBit(const struct AudioSampleAttributes *attrs, int32_t *format); 416 int32_t InitHwRenderParam(struct AudioHwRender *hwRender, const struct AudioDeviceDescriptor *desc, 417 const struct AudioSampleAttributes *attrs); 418 int32_t InitForGetPortCapability(struct AudioPort portIndex, struct AudioPortCapability *capabilityIndex); 419 void AudioAdapterReleaseCapSubPorts(const struct AudioPortAndCapability *portCapabilitys, int32_t num); 420 int32_t AudioAdapterInitAllPorts(struct AudioAdapter *adapter); 421 void AudioReleaseRenderHandle(struct AudioHwRender *hwRender); 422 int32_t AudioAdapterCreateRenderPre(struct AudioHwRender *hwRender, const struct AudioDeviceDescriptor *desc, 423 const struct AudioSampleAttributes *attrs, const struct AudioHwAdapter *hwAdapter); 424 int32_t AudioAdapterBindServiceRender(struct AudioHwRender *hwRender); 425 int32_t AudioAdapterCreateRender(struct AudioAdapter *adapter, const struct AudioDeviceDescriptor *desc, 426 const struct AudioSampleAttributes *attrs, struct AudioRender **render); 427 int32_t AudioAdapterDestroyRender(struct AudioAdapter *adapter, struct AudioRender *render); 428 int32_t GetAudioCaptureFunc(struct AudioHwCapture *hwCapture); 429 int32_t InitHwCaptureParam(struct AudioHwCapture *hwCapture, const struct AudioDeviceDescriptor *desc, 430 const struct AudioSampleAttributes *attrs); 431 void AudioReleaseCaptureHandle(struct AudioHwCapture *hwCapture); 432 int32_t AudioAdapterCreateCapturePre(struct AudioHwCapture *hwCapture, const struct AudioDeviceDescriptor *desc, 433 const struct AudioSampleAttributes *attrs, struct AudioHwAdapter *hwAdapter); 434 int32_t AudioAdapterInterfaceLibModeCapture(struct AudioHwCapture *hwCapture); 435 int32_t AudioAdapterCreateCapture(struct AudioAdapter *adapter, const struct AudioDeviceDescriptor *desc, 436 const struct AudioSampleAttributes *attrs, struct AudioCapture **capture); 437 int32_t AudioAdapterDestroyCapture(struct AudioAdapter *adapter, struct AudioCapture *capture); 438 int32_t AudioAdapterGetPortCapability(struct AudioAdapter *adapter, const struct AudioPort *port, 439 struct AudioPortCapability *capability); 440 int32_t AudioAdapterSetPassthroughMode(struct AudioAdapter *adapter, const struct AudioPort *port, 441 enum AudioPortPassthroughMode mode); 442 int32_t AudioAdapterGetPassthroughMode(struct AudioAdapter *adapter, const struct AudioPort *port, 443 enum AudioPortPassthroughMode *mode); 444 int32_t AudioAdapterUpdateAudioRoute(struct AudioAdapter *adapter, const struct AudioRoute *route, 445 int32_t *routeHandle); 446 int32_t AudioAdapterReleaseAudioRoute(struct AudioAdapter *adapter, int32_t routeHandle); 447 int32_t AudioAdapterSetExtraParams(struct AudioAdapter *adapter, enum AudioExtParamKey key, 448 const char *condition, const char *value); 449 int32_t AudioAdapterGetExtraParams(struct AudioAdapter *adapter, enum AudioExtParamKey key, 450 const char *condition, char *value, int32_t length); 451 int32_t PcmBytesToFrames(const struct AudioFrameRenderMode *frameRenderMode, uint64_t bytes, uint32_t *frameCount); 452 int32_t AudioAdapterSetMicMute(struct AudioAdapter *adapter, bool mute); 453 int32_t AudioAdapterGetMicMute(struct AudioAdapter *adapter, bool *mute); 454 int32_t AudioAdapterSetVoiceVolume(struct AudioAdapter *adapter, float volume); 455 int32_t AudioRenderStart(AudioHandle handle); 456 int32_t AudioRenderStop(AudioHandle handle); 457 int32_t AudioRenderPause(AudioHandle handle); 458 int32_t AudioRenderResume(AudioHandle handle); 459 int32_t AudioRenderFlush(AudioHandle handle); 460 int32_t AudioRenderGetFrameSize(AudioHandle handle, uint64_t *size); 461 int32_t AudioRenderGetFrameCount(AudioHandle handle, uint64_t *count); 462 int32_t AudioRenderSetSampleAttributes(AudioHandle handle, const struct AudioSampleAttributes *attrs); 463 int32_t AudioRenderGetSampleAttributes(AudioHandle handle, struct AudioSampleAttributes *attrs); 464 int32_t AudioRenderGetCurrentChannelId(AudioHandle handle, uint32_t *channelId); 465 int32_t AudioRenderCheckSceneCapability(AudioHandle handle, const struct AudioSceneDescriptor *scene, 466 bool *supported); 467 int32_t AudioRenderSelectScene(AudioHandle handle, const struct AudioSceneDescriptor *scene); 468 int32_t AudioRenderSetMute(AudioHandle handle, bool mute); 469 int32_t AudioRenderGetMute(AudioHandle handle, bool *mute); 470 int32_t AudioRenderSetVolume(AudioHandle handle, float volume); 471 int32_t AudioRenderGetVolume(AudioHandle handle, float *volume); 472 int32_t AudioRenderGetGainThreshold(AudioHandle handle, float *min, float *max); 473 int32_t AudioRenderGetGain(AudioHandle handle, float *gain); 474 int32_t AudioRenderSetGain(AudioHandle handle, float gain); 475 int32_t AudioRenderGetLatency(struct AudioRender *render, uint32_t *ms); 476 int32_t AudioRenderRenderFrame(struct AudioRender *render, const void *frame, 477 uint64_t requestBytes, uint64_t *replyBytes); 478 int32_t AudioRenderGetRenderPosition(struct AudioRender *render, uint64_t *frames, struct AudioTimeStamp *time); 479 int32_t AudioRenderSetRenderSpeed(struct AudioRender *render, float speed); 480 int32_t AudioRenderGetRenderSpeed(struct AudioRender *render, float *speed); 481 int32_t AudioRenderSetChannelMode(struct AudioRender *render, enum AudioChannelMode mode); 482 int32_t AudioRenderGetChannelMode(struct AudioRender *render, enum AudioChannelMode *mode); 483 int32_t AudioRenderSetExtraParams(AudioHandle handle, const char *keyValueList); 484 int32_t AudioRenderGetExtraParams(AudioHandle handle, char *keyValueList, int32_t listLenth); 485 int32_t AudioRenderReqMmapBuffer(AudioHandle handle, int32_t reqSize, struct AudioMmapBufferDescriptor *desc); 486 int32_t AudioRenderGetMmapPosition(AudioHandle handle, uint64_t *frames, struct AudioTimeStamp *time); 487 int32_t AudioRenderAddEffect(AudioHandle handle, uint64_t effectid); 488 int32_t AudioRenderRemoveEffect(AudioHandle handle, uint64_t effectid); 489 int32_t AudioRenderTurnStandbyMode(AudioHandle handle); 490 int32_t AudioRenderAudioDevDump(AudioHandle handle, int32_t range, int32_t fd); 491 int32_t AudioRenderRegCallback(struct AudioRender *render, RenderCallback callback, void* cookie); 492 int32_t AudioRenderDrainBuffer(struct AudioRender *render, enum AudioDrainNotifyType *type); 493 int32_t AudioCaptureStart(AudioHandle handle); 494 int32_t AudioCaptureStop(AudioHandle handle); 495 int32_t AudioCapturePause(AudioHandle handle); 496 int32_t AudioCaptureResume(AudioHandle handle); 497 int32_t AudioCaptureFlush(AudioHandle handle); 498 int32_t AudioCaptureGetFrameSize(AudioHandle handle, uint64_t *size); 499 int32_t AudioCaptureGetFrameCount(AudioHandle handle, uint64_t *count); 500 int32_t AudioCaptureSetSampleAttributes(AudioHandle handle, const struct AudioSampleAttributes *attrs); 501 int32_t AudioCaptureGetSampleAttributes(AudioHandle handle, struct AudioSampleAttributes *attrs); 502 int32_t AudioCaptureGetCurrentChannelId(AudioHandle handle, uint32_t *channelId); 503 int32_t AudioCaptureCheckSceneCapability(AudioHandle handle, const struct AudioSceneDescriptor *scene, 504 bool *supported); 505 int32_t AudioCaptureSelectScene(AudioHandle handle, const struct AudioSceneDescriptor *scene); 506 int32_t AudioCaptureSetMute(AudioHandle handle, bool mute); 507 int32_t AudioCaptureGetMute(AudioHandle handle, bool *mute); 508 int32_t AudioCaptureSetVolume(AudioHandle handle, float volume); 509 int32_t AudioCaptureGetVolume(AudioHandle handle, float *volume); 510 int32_t AudioCaptureGetGainThreshold(AudioHandle handle, float *min, float *max); 511 int32_t AudioCaptureGetGain(AudioHandle handle, float *gain); 512 int32_t AudioCaptureSetGain(AudioHandle handle, float gain); 513 int32_t AudioCaptureCaptureFrame(struct AudioCapture *capture, void *frame, 514 uint64_t requestBytes, uint64_t *replyBytes); 515 int32_t AudioCaptureGetCapturePosition(struct AudioCapture *capture, uint64_t *frames, struct AudioTimeStamp *time); 516 int32_t AudioCaptureSetExtraParams(AudioHandle handle, const char *keyValueList); 517 int32_t AudioCaptureGetExtraParams(const AudioHandle handle, char *keyValueList, int32_t listLenth); 518 int32_t AudioCaptureReqMmapBuffer(AudioHandle handle, int32_t reqSize, struct AudioMmapBufferDescriptor *desc); 519 int32_t AudioCaptureGetMmapPosition(AudioHandle handle, uint64_t *frames, struct AudioTimeStamp *time); 520 int32_t AudioCaptureAddEffect(AudioHandle handle, uint64_t effectid); 521 int32_t AudioCaptureRemoveEffect(AudioHandle handle, uint64_t effectid); 522 int32_t AudioCaptureTurnStandbyMode(AudioHandle handle); 523 int32_t AudioCaptureAudioDevDump(AudioHandle handle, int32_t range, int32_t fd); 524 int32_t CallbackProcessing(AudioHandle handle, enum AudioCallbackType callBackType); 525 526 struct AudioAdapterDescriptor *AudioAdapterGetConfigDescs(void); 527 int32_t AudioAdapterGetAdapterNum(void); 528 529 #ifdef __cplusplus 530 } 531 #endif 532 #endif 533