1 /* 2 * Copyright (c) 2023 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 OHOS_VDI_AUDIO_V1_0_IAUDIOCAPTURE_H 17 #define OHOS_VDI_AUDIO_V1_0_IAUDIOCAPTURE_H 18 19 #include <stdbool.h> 20 #include <stdint.h> 21 #include "audio_types_vdi.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif /* __cplusplus */ 26 27 #define IAUDIO_VDI_CAPTURE_MAJOR_VERSION 1 28 #define IAUDIO_VDI_CAPTURE_MINOR_VERSION 0 29 30 struct IAudioCaptureVdi { 31 int32_t (*CaptureFrame)(struct IAudioCaptureVdi *self, int8_t *frame, uint32_t *frameLen, uint64_t *replyBytes); 32 int32_t (*GetCapturePosition)(struct IAudioCaptureVdi *self, uint64_t *frames, struct AudioTimeStampVdi *time); 33 int32_t (*CheckSceneCapability)(struct IAudioCaptureVdi *self, const struct AudioSceneDescriptorVdi *scene, 34 bool *supported); 35 int32_t (*SelectScene)(struct IAudioCaptureVdi *self, const struct AudioSceneDescriptorVdi *scene); 36 int32_t (*SetMute)(struct IAudioCaptureVdi *self, bool mute); 37 int32_t (*GetMute)(struct IAudioCaptureVdi *self, bool *mute); 38 int32_t (*SetVolume)(struct IAudioCaptureVdi *self, float volume); 39 int32_t (*GetVolume)(struct IAudioCaptureVdi *self, float *volume); 40 int32_t (*GetGainThreshold)(struct IAudioCaptureVdi *self, float *min, float *max); 41 int32_t (*GetGain)(struct IAudioCaptureVdi *self, float *gain); 42 int32_t (*SetGain)(struct IAudioCaptureVdi *self, float gain); 43 int32_t (*GetFrameSize)(struct IAudioCaptureVdi *self, uint64_t *size); 44 int32_t (*GetFrameCount)(struct IAudioCaptureVdi *self, uint64_t *count); 45 int32_t (*SetSampleAttributes)(struct IAudioCaptureVdi *self, const struct AudioSampleAttributesVdi *attrs); 46 int32_t (*GetSampleAttributes)(struct IAudioCaptureVdi *self, struct AudioSampleAttributesVdi *attrs); 47 int32_t (*GetCurrentChannelId)(struct IAudioCaptureVdi *self, uint32_t *channelId); 48 int32_t (*SetExtraParams)(struct IAudioCaptureVdi *self, const char *keyValueList); 49 int32_t (*GetExtraParams)(struct IAudioCaptureVdi *self, char *keyValueList, uint32_t keyValueListLen); 50 int32_t (*ReqMmapBuffer)(struct IAudioCaptureVdi *self, int32_t reqSize, struct AudioMmapBufferDescriptorVdi *desc); 51 int32_t (*GetMmapPosition)(struct IAudioCaptureVdi *self, uint64_t *frames, struct AudioTimeStampVdi *time); 52 int32_t (*AddAudioEffect)(struct IAudioCaptureVdi *self, uint64_t effectid); 53 int32_t (*RemoveAudioEffect)(struct IAudioCaptureVdi *self, uint64_t effectid); 54 int32_t (*GetFrameBufferSize)(struct IAudioCaptureVdi *self, uint64_t *bufferSize); 55 int32_t (*Start)(struct IAudioCaptureVdi *self); 56 int32_t (*Stop)(struct IAudioCaptureVdi *self); 57 int32_t (*Pause)(struct IAudioCaptureVdi *self); 58 int32_t (*Resume)(struct IAudioCaptureVdi *self); 59 int32_t (*Flush)(struct IAudioCaptureVdi *self); 60 int32_t (*TurnStandbyMode)(struct IAudioCaptureVdi *self); 61 int32_t (*AudioDevDump)(struct IAudioCaptureVdi *self, int32_t range, int32_t fd); 62 int32_t (*IsSupportsPauseAndResume)(struct IAudioCaptureVdi *self, bool *supportPause, bool *supportResume); 63 }; 64 65 #ifdef __cplusplus 66 } 67 #endif /* __cplusplus */ 68 69 #endif /* OHOS_VDI_AUDIO_V1_0_IAUDIOCAPTURE_H */