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