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_PROXY_INTERNAL_H 17 #define AUDIO_PROXY_INTERNAL_H 18 19 #include "audio_adapter.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 int32_t AudioProxyAdapterInitAllPorts(struct AudioAdapter *adapter); 25 int32_t AudioProxyAdapterCreateRender(struct AudioAdapter *adapter, 26 const struct AudioDeviceDescriptor *desc, 27 const struct AudioSampleAttributes *attrs, 28 struct AudioRender **render); 29 int32_t AudioProxyAdapterDestroyRender(struct AudioAdapter *adapter, 30 struct AudioRender *render); 31 int32_t AudioProxyAdapterCreateCapture(struct AudioAdapter *adapter, 32 const struct AudioDeviceDescriptor *desc, 33 const struct AudioSampleAttributes *attrs, 34 struct AudioCapture **capture); 35 int32_t AudioProxyAdapterDestroyCapture(struct AudioAdapter *adapter, 36 struct AudioCapture *capture); 37 int32_t AudioProxyAdapterGetPortCapability(struct AudioAdapter *adapter, 38 const struct AudioPort *port, struct AudioPortCapability *capability); 39 int32_t AudioProxyAdapterSetPassthroughMode(struct AudioAdapter *adapter, 40 const struct AudioPort *port, enum AudioPortPassthroughMode mode); 41 int32_t AudioProxyAdapterGetPassthroughMode(struct AudioAdapter *adapter, 42 const struct AudioPort *port, enum AudioPortPassthroughMode *mode); 43 int32_t AudioProxyAdapterGetDeviceStatus(struct AudioAdapter *adapter, struct AudioDeviceStatus *status); 44 int32_t AudioProxyRenderStart(AudioHandle handle); 45 int32_t AudioProxyRenderStop(AudioHandle handle); 46 int32_t AudioProxyRenderPause(AudioHandle handle); 47 int32_t AudioProxyRenderResume(AudioHandle handle); 48 int32_t AudioProxyRenderFlush(AudioHandle handle); 49 int32_t AudioProxyRenderGetFrameSize(const AudioHandle handle, uint64_t *size); 50 int32_t AudioProxyRenderGetFrameCount(const AudioHandle handle, uint64_t *count); 51 int32_t AudioProxyRenderSetSampleAttributes(const AudioHandle handle, 52 const struct AudioSampleAttributes *attrs); 53 int32_t AudioProxyRenderGetSampleAttributes(const AudioHandle handle, 54 struct AudioSampleAttributes *attrs); 55 int32_t AudioProxyRenderGetCurrentChannelId(const AudioHandle handle, uint32_t *channelId); 56 int32_t AudioProxyRenderCheckSceneCapability(const AudioHandle handle, 57 const struct AudioSceneDescriptor *scene, bool *supported); 58 int32_t AudioProxyRenderSelectScene(const AudioHandle handle, 59 const struct AudioSceneDescriptor *scene); 60 int32_t AudioProxyRenderSetMute(const AudioHandle handle, bool mute); 61 int32_t AudioProxyRenderGetMute(const AudioHandle handle, bool *mute); 62 int32_t AudioProxyRenderSetVolume(const AudioHandle handle, float volume); 63 int32_t AudioProxyRenderGetVolume(const AudioHandle handle, float *volume); 64 int32_t AudioProxyRenderGetGainThreshold(AudioHandle handle, float *min, float *max); 65 int32_t AudioProxyRenderGetGain(const AudioHandle handle, float *gain); 66 int32_t AudioProxyRenderSetGain(const AudioHandle handle, float gain); 67 int32_t AudioProxyRenderGetLatency(struct AudioRender *render, uint32_t *ms); 68 int32_t AudioProxyRenderRenderFrame(struct AudioRender *render, const void *frame, 69 uint64_t requestBytes, uint64_t *replyBytes); 70 int32_t AudioProxyRenderGetRenderPosition(struct AudioRender *render, 71 uint64_t *frames, struct AudioTimeStamp *time); 72 int32_t AudioProxyRenderSetRenderSpeed(struct AudioRender *render, float speed); 73 int32_t AudioProxyRenderGetRenderSpeed(struct AudioRender *render, float *speed); 74 int32_t AudioProxyRenderSetChannelMode(struct AudioRender *render, enum AudioChannelMode mode); 75 int32_t AudioProxyRenderGetChannelMode(struct AudioRender *render, enum AudioChannelMode *mode); 76 int32_t AudioProxyRenderSetExtraParams(AudioHandle render, const char *keyValueList); 77 int32_t AudioProxyRenderGetExtraParams(AudioHandle render, char *keyValueList, int32_t listLenth); 78 int32_t AudioProxyRenderReqMmapBuffer(AudioHandle render, int32_t reqSize, struct AudioMmapBufferDescripter *desc); 79 int32_t AudioProxyRenderGetMmapPosition(AudioHandle render, uint64_t *frames, struct AudioTimeStamp *time); 80 int32_t AudioProxyRenderTurnStandbyMode(AudioHandle render); 81 int32_t AudioProxyRenderAudioDevDump(AudioHandle render, int32_t range, int32_t fd); 82 int32_t AudioProxyRenderRegCallback(struct AudioRender *render, RenderCallback callback, void *cookie); 83 int32_t AudioProxyRenderDrainBuffer(struct AudioRender *render, enum AudioDrainNotifyType *type); 84 int32_t AudioProxyCaptureStart(const AudioHandle handle); 85 int32_t AudioProxyCaptureStop(const AudioHandle handle); 86 int32_t AudioProxyCapturePause(const AudioHandle handle); 87 int32_t AudioProxyCaptureResume(const AudioHandle handle); 88 int32_t AudioProxyCaptureFlush(const AudioHandle handle); 89 int32_t AudioProxyCaptureGetFrameSize(const AudioHandle handle, uint64_t *size); 90 int32_t AudioProxyCaptureGetFrameCount(const AudioHandle handle, uint64_t *count); 91 int32_t AudioProxyCaptureSetSampleAttributes(AudioHandle handle, 92 const struct AudioSampleAttributes *attrs); 93 int32_t AudioProxyCaptureGetSampleAttributes(const AudioHandle handle, 94 struct AudioSampleAttributes *attrs); 95 int32_t AudioProxyCaptureGetCurrentChannelId(const AudioHandle handle, uint32_t *channelId); 96 int32_t AudioProxyCaptureCheckSceneCapability(const AudioHandle handle, 97 const struct AudioSceneDescriptor *scene, bool *supported); 98 int32_t AudioProxyCaptureSelectScene(const AudioHandle handle, 99 const struct AudioSceneDescriptor *scene); 100 int32_t AudioProxyCaptureSetMute(const AudioHandle handle, bool mute); 101 int32_t AudioProxyCaptureGetMute(const AudioHandle handle, bool *mute); 102 int32_t AudioProxyCaptureSetVolume(const AudioHandle handle, float volume); 103 int32_t AudioProxyCaptureGetVolume(const AudioHandle handle, float *volume); 104 int32_t AudioProxyCaptureGetGainThreshold(const AudioHandle handle, float *min, float *max); 105 int32_t AudioProxyCaptureGetGain(const AudioHandle handle, float *gain); 106 int32_t AudioProxyCaptureSetGain(const AudioHandle handle, float gain); 107 int32_t AudioProxyCaptureCaptureFrame(struct AudioCapture *capture, 108 void *frame, uint64_t requestBytes, uint64_t *replyBytes); 109 int32_t AudioProxyCaptureGetCapturePosition(struct AudioCapture *capture, 110 uint64_t *frames, struct AudioTimeStamp *time); 111 int32_t AudioProxyCaptureSetExtraParams(AudioHandle capture, const char *keyValueList); 112 int32_t AudioProxyCaptureGetExtraParams(const AudioHandle capture, char *keyValueList, int32_t listLenth); 113 int32_t AudioProxyCaptureReqMmapBuffer(const AudioHandle capture, 114 int32_t reqSize, struct AudioMmapBufferDescripter *desc); 115 int32_t AudioProxyCaptureGetMmapPosition(const AudioHandle capture, uint64_t *frames, struct AudioTimeStamp *time); 116 int32_t AudioProxyCaptureTurnStandbyMode(const AudioHandle capture); 117 int32_t AudioProxyCaptureAudioDevDump(AudioHandle capture, int32_t range, int32_t fd); 118 int32_t AudioProxyAdapterSetMicMute(struct AudioAdapter *adapter, bool mute); 119 int32_t AudioProxyAdapterGetMicMute(struct AudioAdapter *adapter, bool *mute); 120 int32_t AudioProxyAdapterSetVoiceVolume(struct AudioAdapter *adapter, float volume); 121 int32_t AudioProxyAdapterSetExtraParams(struct AudioAdapter *adapter, enum AudioExtParamKey key, 122 const char *condition, const char *value); 123 int32_t AudioProxyAdapterGetExtraParams(struct AudioAdapter *adapter, enum AudioExtParamKey key, 124 const char *condition, char *value, int32_t length); 125 int32_t AudioProxyAdapterUpdateAudioRoute(struct AudioAdapter *adapter, 126 const struct AudioRoute *route, int32_t *routeHandle); 127 int32_t AudioProxyAdapterReleaseAudioRoute(struct AudioAdapter *adapter, int32_t routeHandle); 128 #ifdef __cplusplus 129 } 130 #endif 131 #endif 132