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