• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_RENDER_H
17 #define AUDIO_INTERFACE_LIB_RENDER_H
18 
19 #include "audio_interface_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 AudioCriBuffStatus {
28     CIR_BUFF_NO_FULL = 1,
29     CIR_BUFF_FULL,
30 };
31 
32 enum AudioInterfaceLibRenderCtrl {
33     AUDIODRV_CTL_IOCTL_ELEM_INFO = CTRL_NUM, // Ctrl
34     AUDIODRV_CTL_IOCTL_ELEM_READ,
35     AUDIODRV_CTL_IOCTL_ELEM_WRITE,
36     AUDIODRV_CTL_IOCTL_MUTE_READ,     // mute
37     AUDIODRV_CTL_IOCTL_MUTE_WRITE,
38     AUDIODRV_CTL_IOCTL_PAUSE_WRITE,
39     AUDIODRV_CTL_IOCTL_CHANNEL_MODE_READ,
40     AUDIODRV_CTL_IOCTL_CHANNEL_MODE_WRITE,
41     AUDIODRV_CTL_IOCTL_GAIN_WRITE,    // gain
42     AUDIODRV_CTL_IOCTL_GAIN_READ,
43     AUDIODRV_CTL_IOCTL_SCENESELECT_WRITE, // scene selsect
44     AUDIODRV_CTL_IOCTL_GAINTHRESHOLD_READ, // scene threshold
45     AUDIODRV_CTL_IOCTL_ACODEC_CHANGE_IN,   // acodec change in
46     AUDIODRV_CTL_IOCTL_ACODEC_CHANGE_OUT,  // acodec change out
47     AUDIODRV_CTL_IOCTL_VOL_THRESHOLD_READ,  // get VolThreshold
48 };
49 
50 typedef int32_t (*InterfaceLibCtlRender)(struct DevHandle *handle, int cmdId, struct AudioHwRenderParam *handleData);
51 
52 struct InterfaceLibCtlRenderList {
53     enum AudioInterfaceLibRenderCtrl cmd;
54     InterfaceLibCtlRender func;
55 };
56 
57 struct DevHandle *AudioBindServiceRender(const char *name);
58 void AudioCloseServiceRender(const struct DevHandle *handle);
59 int32_t AudioInterfaceLibModeRender(const struct DevHandle *handle,
60     struct AudioHwRenderParam *handleData, int cmdId);
61 int32_t AudioOutputRenderHwParams(const struct DevHandle *handle,
62     int cmdId, const struct AudioHwRenderParam *handleData);
63 int32_t AudioOutputRenderWrite(const struct DevHandle *handle,
64     int cmdId, const struct AudioHwRenderParam *handleData);
65 int32_t AudioOutputRenderStop(const struct DevHandle *handle,
66     int cmdId, const struct AudioHwRenderParam *handleData);
67 int32_t AudioOutputRenderStartPrepare(const struct DevHandle *handle,
68     int cmdId, const struct AudioHwRenderParam *handleData);
69 int32_t AudioCtlRenderGetVolume(const struct DevHandle *handle,
70     int cmdId, struct AudioHwRenderParam *handleData);
71 int32_t AudioCtlRenderSetVolume(const struct DevHandle *handle,
72     int cmdId, const struct AudioHwRenderParam *handleData);
73 int32_t AudioCtlRenderGetMuteStu(const struct DevHandle *handle,
74     int cmdId, struct AudioHwRenderParam *handleData);
75 int32_t AudioCtlRenderSetMuteStu(const struct DevHandle *handle,
76     int cmdId, const struct AudioHwRenderParam *handleData);
77 int32_t AudioCtlRenderSetPauseStu(const struct DevHandle *handle,
78     int cmdId, const struct AudioHwRenderParam *handleData);
79 int32_t AudioCtlRenderGetChannelMode(const struct DevHandle *handle,
80     int cmdId, struct AudioHwRenderParam *handleData);
81 int32_t AudioCtlRenderSetChannelMode(const struct DevHandle *handle,
82     int cmdId, const struct AudioHwRenderParam *handleData);
83 int32_t AudioCtlRenderSetGainStu(const struct DevHandle *handle,
84     int cmdId, const struct AudioHwRenderParam *handleData);
85 int32_t AudioCtlRenderGetGainStu(const struct DevHandle *handle,
86     int cmdId, struct AudioHwRenderParam *handleData);
87 int32_t AudioCtlRenderSceneSelect(const struct DevHandle *handle,
88     int cmdId, const struct AudioHwRenderParam *handleData);
89 int32_t AudioCtlRenderSceneGetGainThreshold(const struct DevHandle *handle,
90     int cmdId, struct AudioHwRenderParam *handleData);
91 int32_t AudioCtlRenderSetAcodecMode(const struct DevHandle *handle,
92     int cmdId, const struct AudioHwRenderParam *handleData);
93 int32_t AudioCtlRenderGetVolThreshold(const struct DevHandle *handle,
94     int cmdId, struct AudioHwRenderParam *handleData);
95 int32_t AudioOutputRenderReqMmapBuffer(const struct DevHandle *handle,
96     int cmdId, const struct AudioHwRenderParam *handleData);
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 #endif /* AUDIO_INTERFACE_LIB_RENDER_H */
102