• 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     pthread_mutex_t mutex;
159     struct IAudioCallback callback;
160     void *cookie;
161     CallbackProcessFunc callbackProcess;
162     AudioHandle renderhandle;
163     struct AudioMmapBufferDescriptor 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 AudioMmapBufferDescriptor 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 DevHandle *devDataHandle; // Bind Data handle
303     struct DevHandle *devCtlHandle;  // Bind Ctl handle
304     struct ErrorLog errorLog;
305 };
306 
307 struct AudioRenderAndCaptureInfo {
308     struct AudioHwRender *renderServicePtr[MAX_AUDIO_STREAM_NUM];
309     uint32_t renderCnt;
310     struct AudioHwCapture *captureServicePtr[MAX_AUDIO_STREAM_NUM];
311     uint32_t captureCnt;
312 };
313 
314 struct AudioHwAdapter {
315     struct IAudioAdapter common;
316     struct HdfRemoteService *proxyRemoteHandle;
317     struct HdfRemoteDispatcher dispatcher;
318     struct AudioAdapterDescriptor adapterDescriptor;
319     struct AudioPortAndCapability *portCapabilitys;
320     struct AudioRenderAndCaptureInfo infos;
321 };
322 
323 struct AudioAdapterInfo {
324     char adapterName[ADAPTER_NAME_LEN];
325     struct AudioHwAdapter *adapterServicePtr;
326     uint32_t refCnt;
327 };
328 
329 struct AudioHwManager {
330     struct IAudioManager interface;
331     int32_t (*OnRemoteRequest)(
332         struct IAudioManager *serviceImpl, int code, struct HdfSBuf *data, struct HdfSBuf *reply);
333     struct AudioAdapterInfo adapterInfos[SUPPORT_ADAPTER_NUM_MAX];
334 };
335 
336 struct ParamValMap {
337     char key[EXTPARAM_LEN];
338     char value[EXTPARAM_LEN];
339 };
340 
341 struct ExtraParams {
342     int32_t route;
343     int32_t format;
344     uint32_t channels;
345     uint64_t frames;
346     uint32_t sampleRate;
347     bool flag;
348 };
349 
350 enum AudioAddrType {
351     AUDIO_ADAPTER_ADDR = 0, /** Record the address of the adapter for FUZZ. */
352     AUDIO_RENDER_ADDR,      /** Record the address of the render for FUZZ. */
353     AUDIO_CAPTURE_ADDR,     /** Record the address of the capturef or FUZZ. */
354     AUDIO_INVALID_ADDR,     /** Invalid value. */
355 };
356 
357 struct AudioAddrDB { // Record the address of the adapter Mgr for FUZZ.
358     void *addrValue;
359     const char *adapterName;
360     enum AudioAddrType addrType;
361 };
362 
363 enum ErrorDumpCode {
364     WRITE_FRAME_ERROR_CODE = -5,
365 };
366 
367 enum AudioAdaptType {
368     INVAILD_PATH_SELECT = -1,
369     RENDER_PATH_SELECT,
370     CAPTURE_PATH_SELECT,
371     CHECKSCENE_PATH_SELECT,
372     CHECKSCENE_PATH_SELECT_CAPTURE,
373 };
374 
375 enum AudioServiceNameType {
376     AUDIO_SERVICE_IN = 0,
377     AUDIO_SERVICE_OUT,
378     AUDIO_SERVICE_MAX,
379 };
380 
381 /* dispatch cmdId */
382 enum AudioInterfaceLibParaCmdList {
383     AUDIO_DRV_PCM_IOCTL_HW_PARAMS = 0,
384     AUDIO_DRV_PCM_IOCTL_PREPARE,
385     AUDIO_DRV_PCM_IOCTL_PREPARE_CAPTURE,
386     AUDIO_DRV_PCM_IOCTL_WRITE,
387     AUDIO_DRV_PCM_IOCTL_READ,
388     AUDIO_DRV_PCM_IOCTRL_START,
389     AUDIO_DRV_PCM_IOCTRL_STOP,
390     AUDIO_DRV_PCM_IOCTRL_START_CAPTURE,
391     AUDIO_DRV_PCM_IOCTRL_STOP_CAPTURE,
392     AUDIO_DRV_PCM_IOCTRL_PAUSE,
393     AUDIO_DRV_PCM_IOCTRL_PAUSE_CAPTURE,
394     AUDIO_DRV_PCM_IOCTRL_RESUME,
395     AUDIO_DRV_PCM_IOCTRL_RESUME_CAPTURE,
396     AUDIO_DRV_PCM_IOCTL_MMAP_BUFFER,
397     AUDIO_DRV_PCM_IOCTL_MMAP_BUFFER_CAPTURE,
398     AUDIO_DRV_PCM_IOCTL_MMAP_POSITION,
399     AUDIO_DRV_PCM_IOCTL_MMAP_POSITION_CAPTURE,
400     AUDIO_DRV_PCM_IOCTRL_RENDER_OPEN,
401     AUDIO_DRV_PCM_IOCTRL_RENDER_CLOSE,
402     AUDIO_DRV_PCM_IOCTRL_CAPTURE_OPEN,
403     AUDIO_DRV_PCM_IOCTRL_CAPTURE_CLOSE,
404     AUDIO_DRV_PCM_IOCTL_BUTT,
405 };
406 
407 enum AudioStreamType {
408     AUDIO_CAPTURE_STREAM = 0,
409     AUDIO_RENDER_STREAM,
410 };
411 
412 typedef struct DevHandle *(*BindServiceRenderPassthrough)(const char *);
413 typedef int32_t (*InterfaceLibModeRenderPassthrough)(struct DevHandle *, struct AudioHwRenderParam *, int);
414 typedef void (*CloseServiceRenderPassthrough)(struct DevHandle *);
415 
416 typedef struct DevHandle *(*BindServiceCapturePassthrough)(const char *);
417 typedef int32_t (*InterfaceLibModeCapturePassthrough)(struct DevHandle *, struct AudioHwCaptureParam *, int);
418 typedef void (*CloseServiceCapturePassthrough)(struct DevHandle *);
419 
420 typedef struct int32_t *(*InterfaceLibModeGetAllCardInfo)(struct AudioAdapterDescriptor **, int *);
421 
422 typedef int32_t (*PathSelGetConfToJsonObj)(void);
423 typedef int32_t (*PathSelAnalysisJson)(void *adapterParam, enum AudioAdaptType adaptType);
424 
425 BindServiceRenderPassthrough *AudioPassthroughGetBindServiceRender(void);
426 InterfaceLibModeRenderPassthrough *AudioPassthroughGetInterfaceLibModeRender(void);
427 CloseServiceRenderPassthrough *AudioPassthroughGetCloseServiceRender(void);
428 
429 BindServiceCapturePassthrough *AudioPassthroughGetBindServiceCapture(void);
430 InterfaceLibModeCapturePassthrough *AudioPassthroughGetInterfaceLibModeCapture(void);
431 CloseServiceCapturePassthrough *AudioPassthroughGetCloseServiceCapture(void);
432 
433 #ifndef AUDIO_HAL_NOTSUPPORT_PATHSELECT
434 PathSelGetConfToJsonObj *AudioPassthroughGetPathSelGetConfToJsonObj(void);
435 PathSelAnalysisJson *AudioPassthroughGetPathSelAnalysisJson(void);
436 #endif
437 
438 int32_t CheckParaDesc(const struct AudioDeviceDescriptor *desc, const char *type);
439 int32_t CheckParaAttr(const struct AudioSampleAttributes *attrs);
440 int32_t AttrFormatToBit(const struct AudioSampleAttributes *attrs, int32_t *format);
441 int32_t InitHwRenderParam(struct AudioHwRender *hwRender, const struct AudioDeviceDescriptor *desc,
442     const struct AudioSampleAttributes *attrs);
443 int32_t InitForGetPortCapability(struct AudioPort portIndex, struct AudioPortCapability *capabilityIndex);
444 void AudioAdapterReleaseCapSubPorts(const struct AudioPortAndCapability *portCapabilitys, int32_t num);
445 int32_t AudioAdapterInitAllPorts(struct IAudioAdapter *adapter);
446 void AudioReleaseRenderHandle(struct AudioHwRender *hwRender);
447 int32_t AudioAdapterCreateRenderPre(struct AudioHwRender *hwRender, const struct AudioDeviceDescriptor *desc,
448     const struct AudioSampleAttributes *attrs, const struct AudioHwAdapter *hwAdapter);
449 int32_t AudioAdapterBindServiceRender(struct AudioHwRender *hwRender);
450 int32_t AudioAdapterCreateRender(struct IAudioAdapter *adapter, const struct AudioDeviceDescriptor *desc,
451     const struct AudioSampleAttributes *attrs, struct IAudioRender **render, uint32_t *renderId);
452 int32_t AudioAdapterDestroyRender(struct IAudioAdapter *adapter, uint32_t renderId);
453 int32_t GetAudioCaptureFunc(struct AudioHwCapture *hwCapture);
454 int32_t InitHwCaptureParam(struct AudioHwCapture *hwCapture, const struct AudioDeviceDescriptor *desc,
455     const struct AudioSampleAttributes *attrs);
456 void AudioReleaseCaptureHandle(struct AudioHwCapture *hwCapture);
457 int32_t AudioAdapterCreateCapturePre(struct AudioHwCapture *hwCapture, const struct AudioDeviceDescriptor *desc,
458     const struct AudioSampleAttributes *attrs, struct AudioHwAdapter *hwAdapter);
459 int32_t AudioAdapterInterfaceLibModeCapture(struct AudioHwCapture *hwCapture);
460 int32_t AudioAdapterCreateCapture(struct IAudioAdapter *adapter, const struct AudioDeviceDescriptor *desc,
461     const struct AudioSampleAttributes *attrs, struct IAudioCapture **capture, uint32_t *captureId);
462 int32_t AudioAdapterDestroyCapture(struct IAudioAdapter *adapter, uint32_t captureId);
463 int32_t AudioAdapterGetPortCapability(
464     struct IAudioAdapter *adapter, const struct AudioPort *port, struct AudioPortCapability *capability);
465 int32_t AudioAdapterSetPassthroughMode(
466     struct IAudioAdapter *adapter, const struct AudioPort *port, enum AudioPortPassthroughMode mode);
467 int32_t AudioAdapterGetPassthroughMode(
468     struct IAudioAdapter *adapter, const struct AudioPort *port, enum AudioPortPassthroughMode *mode);
469 int32_t AudioAdapterGetDeviceStatus(struct IAudioAdapter *adapter, struct AudioDeviceStatus *status);
470 int32_t PcmBytesToFrames(const struct AudioFrameRenderMode *frameRenderMode, uint64_t bytes, uint32_t *frameCount);
471 int32_t AudioRenderStart(struct IAudioRender *handle);
472 int32_t AudioRenderStop(struct IAudioRender *handle);
473 int32_t AudioRenderPause(struct IAudioRender *handle);
474 int32_t AudioRenderResume(struct IAudioRender *handle);
475 int32_t AudioRenderFlush(struct IAudioRender *handle);
476 int32_t AudioRenderGetFrameSize(struct IAudioRender *handle, uint64_t *size);
477 int32_t AudioRenderGetFrameCount(struct IAudioRender *handle, uint64_t *count);
478 int32_t AudioRenderSetSampleAttributes(struct IAudioRender *handle, const struct AudioSampleAttributes *attrs);
479 int32_t AudioRenderGetSampleAttributes(struct IAudioRender *handle, struct AudioSampleAttributes *attrs);
480 int32_t AudioRenderGetCurrentChannelId(struct IAudioRender *handle, uint32_t *channelId);
481 int32_t AudioRenderCheckSceneCapability(
482     struct IAudioRender *handle, const struct AudioSceneDescriptor *scene, bool *supported);
483 int32_t AudioRenderSelectScene(struct IAudioRender *handle, const struct AudioSceneDescriptor *scene);
484 int32_t AudioRenderSetMute(struct IAudioRender *handle, bool mute);
485 int32_t AudioRenderGetMute(struct IAudioRender *handle, bool *mute);
486 int32_t AudioRenderSetVolume(struct IAudioRender *handle, float volume);
487 int32_t AudioRenderGetVolume(struct IAudioRender *handle, float *volume);
488 int32_t AudioRenderGetGainThreshold(struct IAudioRender *handle, float *min, float *max);
489 int32_t AudioRenderGetGain(struct IAudioRender *handle, float *gain);
490 int32_t AudioRenderSetGain(struct IAudioRender *handle, float gain);
491 int32_t AudioRenderGetLatency(struct IAudioRender *handle, uint32_t *ms);
492 int32_t AudioRenderRenderFrame(struct IAudioRender *render, const int8_t *frame,
493     uint32_t frameLen, uint64_t *replyBytes);
494 int32_t AudioRenderGetRenderPosition(struct IAudioRender *render, uint64_t *frames, struct AudioTimeStamp *time);
495 int32_t AudioRenderSetRenderSpeed(struct IAudioRender *render, float speed);
496 int32_t AudioRenderGetRenderSpeed(struct IAudioRender *render, float *speed);
497 int32_t AudioRenderSetChannelMode(struct IAudioRender *render, enum AudioChannelMode mode);
498 int32_t AudioRenderGetChannelMode(struct IAudioRender *render, enum AudioChannelMode *mode);
499 int32_t AudioRenderSetExtraParams(struct IAudioRender *handle, const char *keyValueList);
500 int32_t AudioRenderGetExtraParams(struct IAudioRender *handle, char *keyValueList, uint32_t listLenth);
501 int32_t AudioRenderReqMmapBuffer(
502     struct IAudioRender *handle, int32_t reqSize, struct AudioMmapBufferDescriptor *desc);
503 int32_t AudioRenderGetMmapPosition(struct IAudioRender *handle, uint64_t *frames, struct AudioTimeStamp *time);
504 int32_t AudioRenderTurnStandbyMode(struct IAudioRender *handle);
505 int32_t AudioRenderAudioDevDump(struct IAudioRender *handle, int32_t range, int32_t fd);
506 int32_t AudioRenderRegCallback(struct IAudioRender *render, struct IAudioCallback *audioCallback, int8_t cookie);
507 int32_t AudioRenderDrainBuffer(struct IAudioRender *render, enum AudioDrainNotifyType *type);
508 int32_t AudioCaptureStart(struct IAudioCapture *handle);
509 int32_t AudioCaptureStop(struct IAudioCapture *handle);
510 int32_t AudioCapturePause(struct IAudioCapture *handle);
511 int32_t AudioCaptureResume(struct IAudioCapture *handle);
512 int32_t AudioCaptureFlush(struct IAudioCapture *handle);
513 int32_t AudioCaptureGetFrameSize(struct IAudioCapture *handle, uint64_t *size);
514 int32_t AudioCaptureGetFrameCount(struct IAudioCapture *handle, uint64_t *count);
515 int32_t AudioCaptureSetSampleAttributes(struct IAudioCapture *handle, const struct AudioSampleAttributes *attrs);
516 int32_t AudioCaptureGetSampleAttributes(struct IAudioCapture *handle, struct AudioSampleAttributes *attrs);
517 int32_t AudioCaptureGetCurrentChannelId(struct IAudioCapture *handle, uint32_t *channelId);
518 int32_t AudioCaptureCheckSceneCapability(
519     struct IAudioCapture *handle, const struct AudioSceneDescriptor *scene, bool *supported);
520 int32_t AudioCaptureSelectScene(struct IAudioCapture *handle, const struct AudioSceneDescriptor *scene);
521 int32_t AudioCaptureSetMute(struct IAudioCapture *handle, bool mute);
522 int32_t AudioCaptureGetMute(struct IAudioCapture *handle, bool *mute);
523 int32_t AudioCaptureSetVolume(struct IAudioCapture *handle, float volume);
524 int32_t AudioCaptureGetVolume(struct IAudioCapture *handle, float *volume);
525 int32_t AudioCaptureGetGainThreshold(struct IAudioCapture *handle, float *min, float *max);
526 int32_t AudioCaptureGetGain(struct IAudioCapture *handle, float *gain);
527 int32_t AudioCaptureSetGain(struct IAudioCapture *handle, float gain);
528 int32_t AudioCaptureCaptureFrame(struct IAudioCapture *capture, int8_t *frame,
529     uint32_t *frameLen, uint64_t *replyBytes);
530 int32_t AudioCaptureGetCapturePosition(struct IAudioCapture *capture, uint64_t *frames, struct AudioTimeStamp *time);
531 int32_t AudioCaptureSetExtraParams(struct IAudioCapture *handle, const char *keyValueList);
532 int32_t AudioCaptureGetExtraParams(struct IAudioCapture *handle, char *keyValueList, uint32_t keyValueListLen);
533 int32_t AudioCaptureReqMmapBuffer(
534     struct IAudioCapture *handle, int32_t reqSize, struct AudioMmapBufferDescriptor *desc);
535 int32_t AudioCaptureGetMmapPosition(struct IAudioCapture *handle, uint64_t *frames, struct AudioTimeStamp *time);
536 int32_t AudioCaptureTurnStandbyMode(struct IAudioCapture *handle);
537 int32_t AudioCaptureAudioDevDump(struct IAudioCapture *handle, int32_t range, int32_t fd);
538 int32_t CallbackProcessing(AudioHandle handle, enum AudioCallbackType callBackType);
539 
540 #ifdef __cplusplus
541 }
542 #endif
543 #endif
544