OpenSLES_Android.h revision 75e22870e41386cdc597bd29c76744d74d4c22ad
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef OPENSL_ES_ANDROID_H_
18#define OPENSL_ES_ANDROID_H_
19
20#ifdef __cplusplus
21extern "C" {
22
23/*---------------------------------------------------------------------------*/
24/* Android common types                                                      */
25/*---------------------------------------------------------------------------*/
26
27typedef sl_int64_t             SLAint64;           /* 64 bit signed integer */
28
29
30/*---------------------------------------------------------------------------*/
31/* Android Stream Type interface                                             */
32/*---------------------------------------------------------------------------*/
33
34extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDSTREAMTYPE;
35
36/** Android Stream Type interface methods */
37
38struct SLAndroidStreamTypeItf_;
39typedef const struct SLAndroidStreamTypeItf_ * const * SLAndroidStreamTypeItf;
40
41struct SLAndroidStreamTypeItf_ {
42    SLresult (*SetStreamType) (
43        SLAndroidStreamTypeItf self,
44        SLuint32 type
45    );
46    SLresult (*GetStreamType) (
47        SLAndroidStreamTypeItf self,
48        SLuint32 *pType
49    );
50};
51
52
53/*---------------------------------------------------------------------------*/
54/* Android Effect interface                                                  */
55/*---------------------------------------------------------------------------*/
56
57extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECT;
58
59/** Android Effect interface methods */
60
61struct SLAndroidEffectItf_;
62typedef const struct SLAndroidEffectItf_ * const * SLAndroidEffectItf;
63
64struct SLAndroidEffectItf_ {
65
66    SLresult (*CreateEffect) (SLAndroidEffectItf self,
67            SLInterfaceID effectImplementationId);
68
69    SLresult (*ReleaseEffect) (SLAndroidEffectItf self,
70            SLInterfaceID effectImplementationId);
71
72    SLresult (*SetEnabled) (SLAndroidEffectItf self,
73            SLInterfaceID effectImplementationId,
74            SLboolean enabled);
75
76    SLresult (*IsEnabled) (SLAndroidEffectItf self,
77            SLInterfaceID effectImplementationId,
78            SLboolean *pEnabled);
79
80    SLresult (*SendCommand) (SLAndroidEffectItf self,
81            SLInterfaceID effectImplementationId,
82            SLuint32 command,
83            SLuint32 commandSize,
84            void *pCommandData,
85            SLuint32 *replySize,
86            void *pReplyData);
87};
88
89
90/*---------------------------------------------------------------------------*/
91/* Android Effect Send interface                                             */
92/*---------------------------------------------------------------------------*/
93
94extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTSEND;
95
96/** Android Effect Send interface methods */
97
98struct SLAndroidEffectSendItf_;
99typedef const struct SLAndroidEffectSendItf_ * const * SLAndroidEffectSendItf;
100
101struct SLAndroidEffectSendItf_ {
102    SLresult (*EnableEffectSend) (
103        SLAndroidEffectSendItf self,
104        SLInterfaceID effectImplementationId,
105        SLboolean enable,
106        SLmillibel initialLevel
107    );
108    SLresult (*IsEnabled) (
109        SLAndroidEffectSendItf self,
110        SLInterfaceID effectImplementationId,
111        SLboolean *pEnable
112    );
113    SLresult (*SetDirectLevel) (
114        SLAndroidEffectSendItf self,
115        SLmillibel directLevel
116    );
117    SLresult (*GetDirectLevel) (
118        SLAndroidEffectSendItf self,
119        SLmillibel *pDirectLevel
120    );
121    SLresult (*SetSendLevel) (
122        SLAndroidEffectSendItf self,
123        SLInterfaceID effectImplementationId,
124        SLmillibel sendLevel
125    );
126    SLresult (*GetSendLevel)(
127        SLAndroidEffectSendItf self,
128        SLInterfaceID effectImplementationId,
129        SLmillibel *pSendLevel
130    );
131};
132
133
134/*---------------------------------------------------------------------------*/
135/* Android Effect Capabilities interface                                     */
136/*---------------------------------------------------------------------------*/
137
138extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTCAPABILITIES;
139
140/** Android Effect Capabilities interface methods */
141
142struct SLAndroidEffectCapabilitiesItf_;
143typedef const struct SLAndroidEffectCapabilitiesItf_ * const * SLAndroidEffectCapabilitiesItf;
144
145struct SLAndroidEffectCapabilitiesItf_ {
146
147    SLresult (*QueryNumEffects) (SLAndroidEffectCapabilitiesItf self,
148            SLuint32 *pNumSupportedEffects);
149
150
151    SLresult (*QueryEffect) (SLAndroidEffectCapabilitiesItf self,
152            SLuint32 index,
153            SLInterfaceID *pEffectType,
154            SLInterfaceID *pEffectImplementation,
155            const SLchar *pName,
156            SLuint16 *pNameSize);
157};
158
159
160/*---------------------------------------------------------------------------*/
161/* Android Configuration interface                                           */
162/*---------------------------------------------------------------------------*/
163extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDCONFIGURATION;
164
165/** Android Configuration interface methods */
166
167struct SLAndroidConfigurationItf_;
168typedef const struct SLAndroidConfigurationItf_ * const * SLAndroidConfigurationItf;
169
170struct SLAndroidConfigurationItf_ {
171
172    SLresult (*SetConfiguration) (SLAndroidConfigurationItf self,
173            const SLchar *configKey,
174            const void *pConfigValue,
175            SLuint32 valueSize);
176
177    SLresult (*GetConfiguration) (SLAndroidConfigurationItf self,
178           const SLchar *configKey,
179           SLuint32 *pValueSize,
180           void *pConfigValue
181       );
182};
183
184/*---------------------------------------------------------------------------*/
185/* Android File Descriptor Data Locator                                      */
186/*---------------------------------------------------------------------------*/
187/** Addendum to Data locator macros  */
188#define SL_DATALOCATOR_ANDROIDFD        ((SLuint32) 0x00000009)
189
190#define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll)
191
192/** File Descriptor-based data locator definition where locatorType must be SL_DATALOCATOR_ANDROIDFD */
193typedef struct SLDataLocator_AndroidFD_ {
194    SLuint32        locatorType;
195    SLint32         fd;
196    SLAint64        offset;
197    SLAint64        length;
198} SLDataLocator_AndroidFD;
199
200
201}
202#endif /* __cplusplus */
203
204#endif /* OPENSL_ES_ANDROID_H_ */
205