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 #include "hdf_base.h" 27 #include "audio_common.h" 28 #include "audio_manager.h" 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #define LOG_ENABLE 0 35 #define LOGV_ENABLE 0 36 #define NAME_LEN 64 37 #define BIT_NUM_32 32 38 #define BIT_NUM_24 24 39 #define BIT_NUM_16 16 40 #define BIT_NUM_8 8 41 #define PERIOD_COUNT 2 42 #define FRAME_DATA (8192 * 2) 43 #define PATHPLAN_LEN 64 44 #define PATHPLAN_COUNT 32 45 #define PATH_NAME_LEN 128 46 #define VOLUME_CHANGE 100 47 #define SEC_TO_NSEC 1000000000 48 #define MAP_MAX 100 49 #define FORMAT_ONE "%-5d %-10d %-20" PRIu64 " %-15s %s\n" 50 #define FORMAT_TWO "%-5d %-10d %s\n" 51 #define ERROR_LOG_MAX_NUM 8 52 #define ERROR_REASON_DESC_LEN 64 53 #define RANGE_MAX 5 54 #define RANGE_MIN 4 55 #define EXTPARAM_LEN 32 56 #define KEY_VALUE_LIST_LEN 128 57 58 #define HDF_AUDIO_CODEC_PRIMARY_DEV "hdf_audio_codec_primary_dev" 59 #define HDF_AUDIO_CODEC_USB_DEV "hdf_audio_codec_usb_dev" 60 #define HDF_AUDIO_CODEC_A2DP_DEV "hdf_audio_codec_a2dp_dev" 61 #define PRIMARY "primary" 62 #define USB "usb" 63 #define A2DP "a2dp" 64 65 66 /** 67 * @brief Enumerates HAL return value types. 68 */ 69 typedef enum { 70 AUDIO_HAL_SUCCESS = 0, 71 AUDIO_HAL_ERR_INTERNAL = -1, /* audio system internal errors */ 72 AUDIO_HAL_ERR_NOT_SUPPORT = -2, /* operation is not supported */ 73 AUDIO_HAL_ERR_INVALID_PARAM = -3, /* parameter is invalid */ 74 AUDIO_HAL_ERR_INVALID_OBJECT = -4, /* Invalid object */ 75 AUDIO_HAL_ERR_MALLOC_FAIL = -6, /* Memory allocation fails */ 76 77 #define HDF_AUDIO_HAL_ERR_START (-7000) /* Defines the start of the device module error codes. */ 78 #define HDF_AUDIO_HAL_ERR_NUM(v) (HDF_AUDIO_HAL_ERR_START + (v)) /* Defines the device module error codes. */ 79 AUDIO_HAL_ERR_NOTREADY = HDF_AUDIO_HAL_ERR_NUM(-1), /* audio adapter is not ready */ 80 AUDIO_HAL_ERR_AI_BUSY = HDF_AUDIO_HAL_ERR_NUM(-2), /* audio capture is busy now */ 81 AUDIO_HAL_ERR_AO_BUSY = HDF_AUDIO_HAL_ERR_NUM(-3), /* audio render is busy now */ 82 } AUDIO_HAL_ERR_CODE; 83 84 #ifndef UNUSED 85 #define UNUSED(x) ((void)(x)) 86 #endif 87 88 #ifndef UT_TEST 89 #define STATIC_T static 90 #else 91 #define STATIC_T 92 #endif 93 94 #define USECASE_AUDIO_RENDER_DEEP_BUFFER "deep-buffer-render" 95 #define USECASE_AUDIO_RENDER_LOW_LATENCY "low-latency-render" 96 97 #define AUDIO_ATTR_PARAM_ROUTE "attr-route" 98 #define ROUTE_SAMPLE "attr-route=x;" 99 #define AUDIO_ATTR_PARAM_FORMAT "attr-format" 100 #define FORMAT_SAMPLE "attr-format=xx;" 101 #define AUDIO_ATTR_PARAM_CHANNELS "attr-channels" 102 #define CHANNELS_SAMPLE "attr-channels=x;" 103 #define AUDIO_ATTR_PARAM_FRAME_COUNT "attr-frame-count" 104 #define FRAME_COUNT_SAMPLE "attr-frame-count=xxxxxxxxxxxxxxxxxxxx;" 105 #define AUDIO_ATTR_PARAM_SAMPLING_RATE "attr-sampling-rate" 106 #define SAMPLING_RATE_SAMPLE "attr-sampling-rate=xxxxx" 107 #define AUDIO_ATTR_PARAM_CONNECT "usb-connect" 108 #define AUDIO_ATTR_PARAM_DISCONNECT "usb-disconnect" 109 #define TELHPONE_RATE 8000 110 #define BROADCAST_AM_RATE 11025 111 #define BROADCAST_FM_RATE 22050 112 #define MINI_CAM_DV_RATE 32000 113 #define MUSIC_RATE 44100 114 #define HIGHT_MUSIC_RATE 48000 115 #define AUDIO_SAMPLE_RATE_12000 12000 116 #define AUDIO_SAMPLE_RATE_16000 16000 117 #define AUDIO_SAMPLE_RATE_24000 24000 118 #define AUDIO_SAMPLE_RATE_64000 64000 119 #define AUDIO_SAMPLE_RATE_96000 96000 120 #define SUPPORT_ADAPTER_NUM_MAX 8 121 typedef int32_t (*CallbackProcessFunc)(AudioHandle handle, enum AudioCallbackType callBackType); 122 123 enum AudioTurnStandbyMode { 124 AUDIO_TURN_STANDBY_LATER = 0, 125 AUDIO_TURN_STANDBY_NOW, 126 AUDIO_TURN_STANDBY_BUTT, 127 }; 128 129 struct DevHandleCapture { 130 void *object; 131 }; 132 133 struct DevHandle { 134 void *object; 135 }; 136 137 struct AudioPortAndCapability { 138 struct AudioPort port; 139 struct AudioPortCapability capability; 140 enum AudioPortPassthroughMode mode; 141 }; 142 143 struct AudioHwAdapter { 144 struct AudioAdapter common; 145 struct AudioAdapterDescriptor adapterDescriptor; 146 struct AudioPortAndCapability *portCapabilitys; 147 struct HdfRemoteService *proxyRemoteHandle; // proxyRemoteHandle 148 int32_t adapterMgrRenderFlag; 149 int32_t adapterMgrCaptureFlag; 150 }; 151 152 struct AudioFrameRenderMode { 153 uint64_t frames; 154 struct AudioTimeStamp time; 155 struct AudioSampleAttributes attrs; 156 enum AudioChannelMode mode; 157 uint32_t byteRate; 158 uint32_t periodSize; 159 uint32_t periodCount; 160 uint32_t startThreshold; 161 uint32_t stopThreshold; 162 uint32_t silenceThreshold; 163 uint32_t silenceSize; 164 char *buffer; 165 uint64_t bufferFrameSize; 166 uint64_t bufferSize; 167 RenderCallback callback; 168 void* cookie; 169 CallbackProcessFunc callbackProcess; 170 AudioHandle renderhandle; 171 struct AudioMmapBufferDescripter mmapBufDesc; 172 }; 173 174 struct AudioGain { 175 float gain; 176 float gainMin; 177 float gainMax; 178 }; 179 180 struct AudioVol { 181 int volMin; 182 int volMax; 183 }; 184 185 struct AudioCtlParam { 186 bool mute; 187 float volume; 188 float speed; 189 bool pause; 190 bool stop; 191 pthread_mutex_t mutex; 192 bool mutexFlag; 193 pthread_cond_t functionCond; 194 struct AudioVol volThreshold; 195 struct AudioGain audioGain; 196 enum AudioTurnStandbyMode turnStandbyStatus; 197 }; 198 199 enum PathRoute { 200 DEEP_BUFF = 0, 201 RECORD, 202 RECORD_LOW_LATRNCY, 203 LOW_LATRNCY, 204 }; 205 206 struct PathPlan { 207 char pathPlanName[PATHPLAN_LEN]; 208 int value; 209 }; 210 211 struct PathDeviceSwitch { 212 char deviceSwitch[PATHPLAN_LEN]; 213 int32_t value; 214 }; 215 216 struct PathDeviceInfo { 217 char deviceType[NAME_LEN]; 218 int32_t deviceNum; 219 struct PathDeviceSwitch deviceSwitchs[PATHPLAN_COUNT]; 220 }; 221 222 struct PathSelect { 223 char useCase[NAME_LEN]; 224 struct PathDeviceInfo deviceInfo; 225 int useCaseDeviceNum; 226 struct PathPlan pathPlan[PATHPLAN_COUNT]; 227 }; 228 229 struct HwInfo { 230 uint32_t card; 231 uint32_t device; 232 char cardServiceName[NAME_LEN]; 233 int flags; 234 bool callBackEnable; 235 char adapterName[NAME_LEN]; 236 struct AudioPort portDescript; 237 struct AudioDeviceDescriptor deviceDescript; 238 enum PathRoute pathroute; 239 struct PathSelect pathSelect; 240 }; 241 242 struct AudioHwRenderMode { 243 struct AudioCtlParam ctlParam; 244 struct HwInfo hwInfo; 245 }; 246 247 struct AudioHwRenderParam { 248 struct AudioHwRenderMode renderMode; 249 struct AudioFrameRenderMode frameRenderMode; 250 }; 251 252 struct ErrorDump { 253 int32_t errorCode; 254 int32_t count; 255 uint64_t frames; 256 char *reason; // Specific reasons for failure 257 char *currentTime; 258 }; 259 260 struct ErrorLog { 261 uint32_t totalErrors; 262 uint32_t iter; 263 struct ErrorDump errorDump[ERROR_LOG_MAX_NUM]; 264 }; 265 266 struct AudioHwRender { 267 struct AudioRender common; 268 struct AudioHwRenderParam renderParam; 269 struct DevHandle *devDataHandle; // Bind Data handle 270 struct DevHandle *devCtlHandle; // Bind Ctl handle 271 struct HdfRemoteService *proxyRemoteHandle; // proxyRemoteHandle 272 struct ErrorLog errorLog; 273 }; 274 275 struct AudioHwCaptureMode { 276 struct AudioCtlParam ctlParam; 277 struct HwInfo hwInfo; 278 }; 279 280 struct AudioFrameCaptureMode { 281 uint64_t frames; 282 struct AudioTimeStamp time; 283 struct AudioSampleAttributes attrs; 284 enum AudioChannelMode mode; 285 uint32_t byteRate; 286 uint32_t periodSize; 287 uint32_t periodCount; 288 uint32_t startThreshold; 289 uint32_t stopThreshold; 290 uint32_t silenceThreshold; 291 uint32_t silenceSize; 292 char *buffer; 293 uint64_t bufferFrameSize; 294 uint64_t bufferSize; 295 struct AudioMmapBufferDescripter mmapBufDesc; 296 }; 297 298 struct AudioHwCaptureParam { 299 struct AudioHwCaptureMode captureMode; 300 struct AudioFrameCaptureMode frameCaptureMode; 301 }; 302 303 struct AudioHwCapture { 304 struct AudioCapture common; 305 struct AudioHwCaptureParam captureParam; 306 struct DevHandleCapture *devDataHandle; // Bind Data handle 307 struct DevHandleCapture *devCtlHandle; // Bind Ctl handle 308 struct HdfRemoteService *proxyRemoteHandle; // proxyRemoteHandle 309 struct ErrorLog errorLog; 310 }; 311 312 struct ParamValMap { 313 char key[EXTPARAM_LEN]; 314 char value[EXTPARAM_LEN]; 315 }; 316 317 struct ExtraParams { 318 int32_t route; 319 int32_t format; 320 uint32_t channels; 321 uint64_t frames; 322 uint32_t sampleRate; 323 bool flag; 324 }; 325 326 enum AudioAddrType { 327 AUDIO_ADAPTER_ADDR = 0, /** Record the address of the adapter for FUZZ. */ 328 AUDIO_RENDER_ADDR, /** Record the address of the render for FUZZ. */ 329 AUDIO_CAPTURE_ADDR, /** Record the address of the capturef or FUZZ. */ 330 AUDIO_INVALID_ADDR, /** Invalid value. */ 331 }; 332 333 struct AudioAddrDB { // Record the address of the adapter Mgr for FUZZ. 334 void *addrValue; 335 const char *adapterName; 336 enum AudioAddrType addrType; 337 }; 338 339 enum ErrorDumpCode { 340 WRITE_FRAME_ERROR_CODE = -5, 341 }; 342 343 enum AudioAdaptType { 344 INVAILD_PATH_SELECT = -1, 345 RENDER_PATH_SELECT, 346 CAPTURE_PATH_SELECT, 347 CHECKSCENE_PATH_SELECT, 348 CHECKSCENE_PATH_SELECT_CAPTURE, 349 }; 350 351 enum AudioServiceNameType { 352 AUDIO_SERVICE_IN = 0, 353 AUDIO_SERVICE_OUT, 354 AUDIO_SERVICE_MAX, 355 }; 356 357 /* dispatch cmdId */ 358 enum AudioInterfaceLibParaCmdList { 359 AUDIO_DRV_PCM_IOCTL_HW_PARAMS = 0, 360 AUDIO_DRV_PCM_IOCTL_PREPARE, 361 AUDIO_DRV_PCM_IOCTL_PREPARE_CAPTURE, 362 AUDIO_DRV_PCM_IOCTL_WRITE, 363 AUDIO_DRV_PCM_IOCTL_READ, 364 AUDIO_DRV_PCM_IOCTRL_START, 365 AUDIO_DRV_PCM_IOCTRL_STOP, 366 AUDIO_DRV_PCM_IOCTRL_START_CAPTURE, 367 AUDIO_DRV_PCM_IOCTRL_STOP_CAPTURE, 368 AUDIO_DRV_PCM_IOCTRL_PAUSE, 369 AUDIO_DRV_PCM_IOCTRL_PAUSE_CAPTURE, 370 AUDIO_DRV_PCM_IOCTRL_RESUME, 371 AUDIO_DRV_PCM_IOCTRL_RESUME_CAPTURE, 372 AUDIO_DRV_PCM_IOCTL_MMAP_BUFFER, 373 AUDIO_DRV_PCM_IOCTL_MMAP_BUFFER_CAPTURE, 374 AUDIO_DRV_PCM_IOCTL_MMAP_POSITION, 375 AUDIO_DRV_PCM_IOCTL_MMAP_POSITION_CAPTURE, 376 AUDIO_DRV_PCM_IOCTRL_RENDER_OPEN, 377 AUDIO_DRV_PCM_IOCTRL_RENDER_CLOSE, 378 AUDIO_DRV_PCM_IOCTRL_CAPTURE_OPEN, 379 AUDIO_DRV_PCM_IOCTRL_CAPTURE_CLOSE, 380 AUDIO_DRV_PCM_IOCTL_BUTT, 381 }; 382 383 enum AudioStreamType { 384 AUDIO_CAPTURE_STREAM = 0, 385 AUDIO_RENDER_STREAM, 386 }; 387 388 typedef struct DevHandle *(*BindServiceRenderSo)(const char *); 389 typedef int32_t (*InterfaceLibModeRenderSo)(struct DevHandle *, struct AudioHwRenderParam *, int); 390 typedef void(*CloseServiceRenderSo)(struct DevHandle *); 391 392 typedef struct DevHandleCapture *(*BindServiceCaptureSo)(const char *); 393 typedef int32_t (*InterfaceLibModeCaptureSo)(struct DevHandleCapture *, struct AudioHwCaptureParam *, int); 394 typedef void(*CloseServiceCaptureSo)(struct DevHandleCapture *); 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 lenth); 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 AudioMmapBufferDescripter *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 AudioMmapBufferDescripter *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 #ifdef __cplusplus 527 } 528 #endif 529 #endif 530