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 
16 #ifndef AUDIO_IF_LIB_RENDER_H
17 #define AUDIO_IF_LIB_RENDER_H
18 
19 #include "audio_if_lib_common.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #define RENDER_CMD  "render" // For Bind render service
26 
27 enum AudioInterfaceLibRenderCtrl {
28     AUDIODRV_CTL_IOCTL_ELEM_INFO = CTRL_NUM, // Ctrl
29     AUDIODRV_CTL_IOCTL_ELEM_READ,
30     AUDIODRV_CTL_IOCTL_ELEM_WRITE,
31     AUDIODRV_CTL_IOCTL_ELEM_LIST,
32     AUDIODRV_CTL_IOCTL_ELEM_CARD,
33     AUDIODRV_CTL_IOCTL_ELEM_HDMI,
34     AUDIODRV_CTL_IOCTL_MUTE_READ,     // mute
35     AUDIODRV_CTL_IOCTL_MUTE_WRITE,
36     AUDIODRV_CTL_IOCTL_PAUSE_WRITE,
37     AUDIODRV_CTL_IOCTL_CHANNEL_MODE_READ,
38     AUDIODRV_CTL_IOCTL_CHANNEL_MODE_WRITE,
39     AUDIODRV_CTL_IOCTL_GAIN_WRITE,    // gain
40     AUDIODRV_CTL_IOCTL_GAIN_READ,
41     AUDIODRV_CTL_IOCTL_SCENESELECT_WRITE, // scene selsect
42     AUDIODRV_CTL_IOCTL_GAINTHRESHOLD_READ, // scene threshold
43     AUDIODRV_CTL_IOCTL_VOL_THRESHOLD_READ,  // get VolThreshold
44 };
45 
46 int32_t AudioOutputRenderOpen(const struct DevHandle *handle,
47     int cmdId, const struct AudioHwRenderParam *handleData);
48 int32_t AudioOutputRenderHwParams(const struct DevHandle *handle,
49     int cmdId, const struct AudioHwRenderParam *handleData);
50 int32_t AudioOutputRenderClose(const struct DevHandle *handle,
51     int cmdId, const struct AudioHwRenderParam *handleData);
52 int32_t AudioOutputRenderPrepare(const struct DevHandle *handle,
53     int cmdId, const struct AudioHwRenderParam *handleData);
54 int32_t AudioOutputRenderStart(const struct DevHandle *handle,
55     int cmdId, const struct AudioHwRenderParam *handleData);
56 int32_t AudioOutputRenderGetMmapPosition(const struct DevHandle *handle,
57     int cmdId, struct AudioHwRenderParam *handleData);
58 int32_t AudioInterfaceLibModeRender(const struct DevHandle *handle,
59     struct AudioHwRenderParam *handleData, int cmdId);
60 int32_t AudioOutputRenderHwParams(const struct DevHandle *handle,
61     int cmdId, const struct AudioHwRenderParam *handleData);
62 int32_t AudioOutputRenderWrite(const struct DevHandle *handle,
63     int cmdId, const struct AudioHwRenderParam *handleData);
64 int32_t AudioOutputRenderStop(const struct DevHandle *handle,
65     int cmdId, const struct AudioHwRenderParam *handleData);
66 int32_t AudioOutputRenderStartPrepare(const struct DevHandle *handle,
67     int cmdId, const struct AudioHwRenderParam *handleData);
68 int32_t AudioCtlRenderGetVolume(const struct DevHandle *handle,
69     int cmdId, struct AudioHwRenderParam *handleData);
70 int32_t AudioCtlRenderSetVolume(const struct DevHandle *handle,
71     int cmdId, const struct AudioHwRenderParam *handleData);
72 int32_t AudioCtlRenderGetMuteStu(const struct DevHandle *handle,
73     int cmdId, struct AudioHwRenderParam *handleData);
74 int32_t AudioCtlRenderSetMuteStu(const struct DevHandle *handle,
75     int cmdId, const struct AudioHwRenderParam *handleData);
76 int32_t AudioCtlRenderSetPauseStu(const struct DevHandle *handle,
77     int cmdId, const struct AudioHwRenderParam *handleData);
78 int32_t AudioCtlRenderGetChannelMode(const struct DevHandle *handle,
79     int cmdId, struct AudioHwRenderParam *handleData);
80 int32_t AudioCtlRenderSetChannelMode(const struct DevHandle *handle,
81     int cmdId, const struct AudioHwRenderParam *handleData);
82 int32_t AudioCtlRenderSetGainStu(const struct DevHandle *handle,
83     int cmdId, const struct AudioHwRenderParam *handleData);
84 int32_t AudioCtlRenderGetGainStu(const struct DevHandle *handle,
85     int cmdId, struct AudioHwRenderParam *handleData);
86 int32_t AudioCtlRenderSceneSelect(const struct DevHandle *handle,
87     int cmdId, const struct AudioHwRenderParam *handleData);
88 int32_t AudioCtlRenderSceneGetGainThreshold(const struct DevHandle *handle,
89     int cmdId, struct AudioHwRenderParam *handleData);
90 int32_t AudioCtlRenderGetVolThreshold(const struct DevHandle *handle,
91     int cmdId, struct AudioHwRenderParam *handleData);
92 int32_t AudioOutputRenderReqMmapBuffer(const struct DevHandle *handle,
93     int cmdId, const struct AudioHwRenderParam *handleData);
94 #ifdef __cplusplus
95 }
96 #endif
97 #endif /* AUDIO_IF_LIB_RENDER_H */
98