1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci#ifndef OHOS_VDI_AUDIO_V1_0_IAUDIORENDER_H 17094332d3Sopenharmony_ci#define OHOS_VDI_AUDIO_V1_0_IAUDIORENDER_H 18094332d3Sopenharmony_ci 19094332d3Sopenharmony_ci#include <stdbool.h> 20094332d3Sopenharmony_ci#include <stdint.h> 21094332d3Sopenharmony_ci#include "audio_types_vdi.h" 22094332d3Sopenharmony_ci#include "iaudio_callback_vdi.h" 23094332d3Sopenharmony_ci 24094332d3Sopenharmony_ci#ifdef __cplusplus 25094332d3Sopenharmony_ciextern "C" { 26094332d3Sopenharmony_ci#endif /* __cplusplus */ 27094332d3Sopenharmony_ci 28094332d3Sopenharmony_ci#define IAUDIO_VDI_RENDER_MAJOR_VERSION 1 29094332d3Sopenharmony_ci#define IAUDIO_VDI_RENDER_MINOR_VERSION 0 30094332d3Sopenharmony_ci 31094332d3Sopenharmony_cistruct IAudioRenderVdi { 32094332d3Sopenharmony_ci int32_t (*GetLatency)(struct IAudioRenderVdi *self, uint32_t *ms); 33094332d3Sopenharmony_ci int32_t (*RenderFrame)(struct IAudioRenderVdi *self, const int8_t *frame, uint32_t frameLen, uint64_t *replyBytes); 34094332d3Sopenharmony_ci int32_t (*GetRenderPosition)(struct IAudioRenderVdi *self, uint64_t *frames, struct AudioTimeStampVdi *time); 35094332d3Sopenharmony_ci int32_t (*SetRenderSpeed)(struct IAudioRenderVdi *self, float speed); 36094332d3Sopenharmony_ci int32_t (*GetRenderSpeed)(struct IAudioRenderVdi *self, float *speed); 37094332d3Sopenharmony_ci int32_t (*SetChannelMode)(struct IAudioRenderVdi *self, enum AudioChannelModeVdi mode); 38094332d3Sopenharmony_ci int32_t (*GetChannelMode)(struct IAudioRenderVdi *self, enum AudioChannelModeVdi *mode); 39094332d3Sopenharmony_ci int32_t (*RegCallback)(struct IAudioRenderVdi *self, RenderCallbackVdi audioCallback, void *cookie); 40094332d3Sopenharmony_ci int32_t (*DrainBuffer)(struct IAudioRenderVdi *self, enum AudioDrainNotifyTypeVdi *type); 41094332d3Sopenharmony_ci int32_t (*IsSupportsDrain)(struct IAudioRenderVdi *self, bool *support); 42094332d3Sopenharmony_ci int32_t (*CheckSceneCapability)(struct IAudioRenderVdi *self, const struct AudioSceneDescriptorVdi *scene, 43094332d3Sopenharmony_ci bool *supported); 44094332d3Sopenharmony_ci int32_t (*SelectScene)(struct IAudioRenderVdi *self, const struct AudioSceneDescriptorVdi *scene); 45094332d3Sopenharmony_ci int32_t (*SetMute)(struct IAudioRenderVdi *self, bool mute); 46094332d3Sopenharmony_ci int32_t (*GetMute)(struct IAudioRenderVdi *self, bool *mute); 47094332d3Sopenharmony_ci int32_t (*SetVolume)(struct IAudioRenderVdi *self, float volume); 48094332d3Sopenharmony_ci int32_t (*GetVolume)(struct IAudioRenderVdi *self, float *volume); 49094332d3Sopenharmony_ci int32_t (*GetGainThreshold)(struct IAudioRenderVdi *self, float *min, float *max); 50094332d3Sopenharmony_ci int32_t (*GetGain)(struct IAudioRenderVdi *self, float *gain); 51094332d3Sopenharmony_ci int32_t (*SetGain)(struct IAudioRenderVdi *self, float gain); 52094332d3Sopenharmony_ci int32_t (*GetFrameSize)(struct IAudioRenderVdi *self, uint64_t *size); 53094332d3Sopenharmony_ci int32_t (*GetFrameCount)(struct IAudioRenderVdi *self, uint64_t *count); 54094332d3Sopenharmony_ci int32_t (*SetSampleAttributes)(struct IAudioRenderVdi *self, const struct AudioSampleAttributesVdi *attrs); 55094332d3Sopenharmony_ci int32_t (*GetSampleAttributes)(struct IAudioRenderVdi *self, struct AudioSampleAttributesVdi *attrs); 56094332d3Sopenharmony_ci int32_t (*GetCurrentChannelId)(struct IAudioRenderVdi *self, uint32_t *channelId); 57094332d3Sopenharmony_ci int32_t (*SetExtraParams)(struct IAudioRenderVdi *self, const char *keyValueList); 58094332d3Sopenharmony_ci int32_t (*GetExtraParams)(struct IAudioRenderVdi *self, char *keyValueList, uint32_t keyValueListLen); 59094332d3Sopenharmony_ci int32_t (*ReqMmapBuffer)(struct IAudioRenderVdi *self, int32_t reqSize, struct AudioMmapBufferDescriptorVdi *desc); 60094332d3Sopenharmony_ci int32_t (*GetMmapPosition)(struct IAudioRenderVdi *self, uint64_t *frames, struct AudioTimeStampVdi *time); 61094332d3Sopenharmony_ci int32_t (*AddAudioEffect)(struct IAudioRenderVdi *self, uint64_t effectid); 62094332d3Sopenharmony_ci int32_t (*RemoveAudioEffect)(struct IAudioRenderVdi *self, uint64_t effectid); 63094332d3Sopenharmony_ci int32_t (*GetFrameBufferSize)(struct IAudioRenderVdi *self, uint64_t *bufferSize); 64094332d3Sopenharmony_ci int32_t (*Start)(struct IAudioRenderVdi *self); 65094332d3Sopenharmony_ci int32_t (*Stop)(struct IAudioRenderVdi *self); 66094332d3Sopenharmony_ci int32_t (*Pause)(struct IAudioRenderVdi *self); 67094332d3Sopenharmony_ci int32_t (*Resume)(struct IAudioRenderVdi *self); 68094332d3Sopenharmony_ci int32_t (*Flush)(struct IAudioRenderVdi *self); 69094332d3Sopenharmony_ci int32_t (*TurnStandbyMode)(struct IAudioRenderVdi *self); 70094332d3Sopenharmony_ci int32_t (*AudioDevDump)(struct IAudioRenderVdi *self, int32_t range, int32_t fd); 71094332d3Sopenharmony_ci int32_t (*IsSupportsPauseAndResume)(struct IAudioRenderVdi *self, bool *supportPause, bool *supportResume); 72094332d3Sopenharmony_ci int32_t (*SetBufferSize)(struct IAudioRenderVdi *self, uint32_t size); 73094332d3Sopenharmony_ci}; 74094332d3Sopenharmony_ci 75094332d3Sopenharmony_ci#ifdef __cplusplus 76094332d3Sopenharmony_ci} 77094332d3Sopenharmony_ci#endif /* __cplusplus */ 78094332d3Sopenharmony_ci 79094332d3Sopenharmony_ci#endif /* OHOS_VDI_AUDIO_V1_0_IAUDIORENDER_H */