OpenSLES_Android.h revision 01e9f5fa4698856f92bcfd88188ee4c8397b22db
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#endif
23
24/*---------------------------------------------------------------------------*/
25/* Android common types                                                      */
26/*---------------------------------------------------------------------------*/
27
28typedef sl_int64_t             SLAint64;           /* 64 bit signed integer */
29
30
31/*---------------------------------------------------------------------------*/
32/* Android Effect interface                                                  */
33/*---------------------------------------------------------------------------*/
34
35extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECT;
36
37/** Android Effect interface methods */
38
39struct SLAndroidEffectItf_;
40typedef const struct SLAndroidEffectItf_ * const * SLAndroidEffectItf;
41
42struct SLAndroidEffectItf_ {
43
44    SLresult (*CreateEffect) (SLAndroidEffectItf self,
45            SLInterfaceID effectImplementationId);
46
47    SLresult (*ReleaseEffect) (SLAndroidEffectItf self,
48            SLInterfaceID effectImplementationId);
49
50    SLresult (*SetEnabled) (SLAndroidEffectItf self,
51            SLInterfaceID effectImplementationId,
52            SLboolean enabled);
53
54    SLresult (*IsEnabled) (SLAndroidEffectItf self,
55            SLInterfaceID effectImplementationId,
56            SLboolean *pEnabled);
57
58    SLresult (*SendCommand) (SLAndroidEffectItf self,
59            SLInterfaceID effectImplementationId,
60            SLuint32 command,
61            SLuint32 commandSize,
62            void *pCommandData,
63            SLuint32 *replySize,
64            void *pReplyData);
65};
66
67
68/*---------------------------------------------------------------------------*/
69/* Android Effect Send interface                                             */
70/*---------------------------------------------------------------------------*/
71
72extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTSEND;
73
74/** Android Effect Send interface methods */
75
76struct SLAndroidEffectSendItf_;
77typedef const struct SLAndroidEffectSendItf_ * const * SLAndroidEffectSendItf;
78
79struct SLAndroidEffectSendItf_ {
80    SLresult (*EnableEffectSend) (
81        SLAndroidEffectSendItf self,
82        SLInterfaceID effectImplementationId,
83        SLboolean enable,
84        SLmillibel initialLevel
85    );
86    SLresult (*IsEnabled) (
87        SLAndroidEffectSendItf self,
88        SLInterfaceID effectImplementationId,
89        SLboolean *pEnable
90    );
91    SLresult (*SetDirectLevel) (
92        SLAndroidEffectSendItf self,
93        SLmillibel directLevel
94    );
95    SLresult (*GetDirectLevel) (
96        SLAndroidEffectSendItf self,
97        SLmillibel *pDirectLevel
98    );
99    SLresult (*SetSendLevel) (
100        SLAndroidEffectSendItf self,
101        SLInterfaceID effectImplementationId,
102        SLmillibel sendLevel
103    );
104    SLresult (*GetSendLevel)(
105        SLAndroidEffectSendItf self,
106        SLInterfaceID effectImplementationId,
107        SLmillibel *pSendLevel
108    );
109};
110
111
112/*---------------------------------------------------------------------------*/
113/* Android Effect Capabilities interface                                     */
114/*---------------------------------------------------------------------------*/
115
116extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTCAPABILITIES;
117
118/** Android Effect Capabilities interface methods */
119
120struct SLAndroidEffectCapabilitiesItf_;
121typedef const struct SLAndroidEffectCapabilitiesItf_ * const * SLAndroidEffectCapabilitiesItf;
122
123struct SLAndroidEffectCapabilitiesItf_ {
124
125    SLresult (*QueryNumEffects) (SLAndroidEffectCapabilitiesItf self,
126            SLuint32 *pNumSupportedEffects);
127
128
129    SLresult (*QueryEffect) (SLAndroidEffectCapabilitiesItf self,
130            SLuint32 index,
131            SLInterfaceID *pEffectType,
132            SLInterfaceID *pEffectImplementation,
133            SLchar *pName,
134            SLuint16 *pNameSize);
135};
136
137
138/*---------------------------------------------------------------------------*/
139/* Android Configuration interface                                           */
140/*---------------------------------------------------------------------------*/
141extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDCONFIGURATION;
142
143/** Android Configuration interface methods */
144
145struct SLAndroidConfigurationItf_;
146typedef const struct SLAndroidConfigurationItf_ * const * SLAndroidConfigurationItf;
147
148struct SLAndroidConfigurationItf_ {
149
150    SLresult (*SetConfiguration) (SLAndroidConfigurationItf self,
151            const SLchar *configKey,
152            const void *pConfigValue,
153            SLuint32 valueSize);
154
155    SLresult (*GetConfiguration) (SLAndroidConfigurationItf self,
156           const SLchar *configKey,
157           SLuint32 *pValueSize,
158           void *pConfigValue
159       );
160};
161
162
163/*---------------------------------------------------------------------------*/
164/* Android Simple Buffer Queue Interface                                     */
165/*---------------------------------------------------------------------------*/
166
167extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDSIMPLEBUFFERQUEUE;
168
169struct SLAndroidSimpleBufferQueueItf_;
170typedef const struct SLAndroidSimpleBufferQueueItf_ * const * SLAndroidSimpleBufferQueueItf;
171
172typedef void (/*SLAPIENTRY*/ *slAndroidSimpleBufferQueueCallback)(
173	SLAndroidSimpleBufferQueueItf caller,
174	void *pContext
175);
176
177/** Android simple buffer queue state **/
178
179typedef struct SLAndroidSimpleBufferQueueState_ {
180	SLuint32	count;
181	SLuint32	index;
182} SLAndroidSimpleBufferQueueState;
183
184
185struct SLAndroidSimpleBufferQueueItf_ {
186	SLresult (*Enqueue) (
187		SLAndroidSimpleBufferQueueItf self,
188		const void *pBuffer,
189		SLuint32 size
190	);
191	SLresult (*Clear) (
192		SLAndroidSimpleBufferQueueItf self
193	);
194	SLresult (*GetState) (
195		SLAndroidSimpleBufferQueueItf self,
196		SLAndroidSimpleBufferQueueState *pState
197	);
198	SLresult (*RegisterCallback) (
199		SLAndroidSimpleBufferQueueItf self,
200		slAndroidSimpleBufferQueueCallback callback,
201		void* pContext
202	);
203};
204
205
206/*---------------------------------------------------------------------------*/
207/* Android File Descriptor Data Locator                                      */
208/*---------------------------------------------------------------------------*/
209
210/** Addendum to Data locator macros  */
211#define SL_DATALOCATOR_ANDROIDFD                ((SLuint32) 0x800007BC)
212
213#define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll)
214
215/** File Descriptor-based data locator definition, locatorType must be SL_DATALOCATOR_ANDROIDFD */
216typedef struct SLDataLocator_AndroidFD_ {
217    SLuint32        locatorType;
218    SLint32         fd;
219    SLAint64        offset;
220    SLAint64        length;
221} SLDataLocator_AndroidFD;
222
223
224/*---------------------------------------------------------------------------*/
225/* Android Android Simple Buffer Queue Data Locator                          */
226/*---------------------------------------------------------------------------*/
227
228/** Addendum to Data locator macros  */
229#define SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE ((SLuint32) 0x800007BD)
230
231/** BufferQueue-based data locator definition where locatorType must be SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE*/
232typedef struct SLDataLocator_AndroidSimpleBufferQueue {
233	SLuint32	locatorType;
234	SLuint32	numBuffers;
235} SLDataLocator_AndroidSimpleBufferQueue;
236
237
238#ifdef __cplusplus
239}
240#endif /* __cplusplus */
241
242#endif /* OPENSL_ES_ANDROID_H_ */
243