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