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_INTERFACE_LIB_CAPTURE_H 17 #define AUDIO_INTERFACE_LIB_CAPTURE_H 18 19 #include "audio_interface_lib_common.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 #define CAPTURE_CMD "capture" // For Bind capture service 26 27 enum AudioCriBuffStatusCapture { 28 CIR_BUFF_NORMAL = 1, 29 CIR_BUFF_EMPTY = 3, 30 }; 31 32 enum AudioInterfaceLibCaptureCtrl { 33 AUDIODRV_CTL_IOCTL_ELEM_INFO_CAPTURE = CTRL_NUM, // Ctrl 34 AUDIODRV_CTL_IOCTL_ELEM_READ_CAPTURE, 35 AUDIODRV_CTL_IOCTL_ELEM_WRITE_CAPTURE, 36 AUDIODRV_CTL_IOCTL_MUTE_READ_CAPTURE, // mute 37 AUDIODRV_CTL_IOCTL_MUTE_WRITE_CAPTURE, 38 AUDIODRV_CTL_IOCTL_PAUSE_READ_CAPTURE, // pause 39 AUDIODRV_CTL_IOCTL_PAUSE_WRITE_CAPTURE, 40 AUDIODRV_CTL_IOCTL_ELEM_BUTT_CAPTURE, 41 AUDIODRV_CTL_IOCTL_GAIN_READ_CAPTURE, // gain 42 AUDIODRV_CTL_IOCTL_GAIN_WRITE_CAPTURE, 43 AUDIODRV_CTL_IOCTL_SCENESELECT_CAPTURE, // scene selsect 44 AUDIODRV_CTL_IOCTL_GAINTHRESHOLD_CAPTURE, // scene threshold 45 AUDIODRV_CTL_IOCTL_VOL_THRESHOLD_CAPTURE, // scene threshold 46 }; 47 48 struct DevHandleCapture *AudioBindServiceCapture(const char *name); 49 void AudioCloseServiceCapture(const struct DevHandleCapture *handle); 50 int32_t AudioInterfaceLibModeCapture(const struct DevHandleCapture *handle, 51 struct AudioHwCaptureParam *handleData, int cmdId); 52 int32_t AudioOutputCaptureHwParams(const struct DevHandleCapture *handle, 53 int cmdId, const struct AudioHwCaptureParam *handleData); 54 int32_t AudioOutputCaptureRead(const struct DevHandleCapture *handle, 55 int cmdId, struct AudioHwCaptureParam *handleData); 56 int32_t AudioOutputCaptureStop(const struct DevHandleCapture *handle, 57 int cmdId, const struct AudioHwCaptureParam *handleData); 58 int32_t AudioOutputCaptureStartPrepare(const struct DevHandleCapture *handle, 59 int cmdId, const struct AudioHwCaptureParam *handleData); 60 int32_t AudioCtlCaptureGetVolume(const struct DevHandleCapture *handle, 61 int cmdId, struct AudioHwCaptureParam *handleData); 62 int32_t AudioCtlCaptureSetVolume(const struct DevHandleCapture *handle, 63 int cmdId, const struct AudioHwCaptureParam *handleData); 64 int32_t AudioCtlCaptureGetMuteStu(const struct DevHandleCapture *handle, 65 int cmdId, struct AudioHwCaptureParam *handleData); 66 int32_t AudioCtlCaptureSetMuteStu(const struct DevHandleCapture *handle, 67 int cmdId, const struct AudioHwCaptureParam *handleData); 68 int32_t AudioCtlCaptureSetPauseStu(const struct DevHandleCapture *handle, 69 int cmdId, const struct AudioHwCaptureParam *handleData); 70 int32_t AudioCtlCaptureSetGainStu(const struct DevHandleCapture *handle, 71 int cmdId, const struct AudioHwCaptureParam *handleData); 72 int32_t AudioCtlCaptureGetGainStu(const struct DevHandleCapture *handle, 73 int cmdId, struct AudioHwCaptureParam *handleData); 74 int32_t AudioCtlCaptureSceneSelect(const struct DevHandleCapture *handle, 75 int cmdId, const struct AudioHwCaptureParam *handleData); 76 int32_t AudioCtlCaptureGetGainThreshold(const struct DevHandleCapture *handle, 77 int cmdId, struct AudioHwCaptureParam *handleData); 78 int32_t AudioCtlCaptureGetVolThreshold(const struct DevHandleCapture *handle, 79 int cmdId, struct AudioHwCaptureParam *handleData); 80 int32_t AudioOutputCaptureReqMmapBuffer(const struct DevHandleCapture *handle, 81 int cmdId, const struct AudioHwCaptureParam *handleData); 82 83 #ifdef __cplusplus 84 } 85 #endif 86 #endif /* AUDIO_INTERFACE_LIB_CAPTURE_H */ 87