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