• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /* Classes vs. interfaces */
18 
19 #include "sles_allinclusive.h"
20 
21 
22 #if USE_PROFILES & USE_PROFILES_GAME
23 
24 // 3DGroup class
25 
26 static const struct iid_vtable _3DGroup_interfaces[INTERFACES_3DGroup] = {
27     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(C3DGroup, mObject)},
28     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
29         offsetof(C3DGroup, mDynamicInterfaceManagement)},
30     {MPH_3DLOCATION, INTERFACE_IMPLICIT, offsetof(C3DGroup, m3DLocation)},
31     {MPH_3DDOPPLER, INTERFACE_DYNAMIC_GAME, offsetof(C3DGroup, m3DDoppler)},
32     {MPH_3DSOURCE, INTERFACE_EXPLICIT_GAME, offsetof(C3DGroup, m3DSource)},
33     {MPH_3DMACROSCOPIC, INTERFACE_OPTIONAL, offsetof(C3DGroup, m3DMacroscopic)},
34 };
35 
36 static const ClassTable C3DGroup_class = {
37     _3DGroup_interfaces,
38     INTERFACES_3DGroup,
39     MPH_to_3DGroup,
40     "3DGroup",
41     sizeof(C3DGroup),
42     SL_OBJECTID_3DGROUP,
43     0,      // OpenMAX AL object ID
44     NULL,
45     NULL,
46     NULL,
47     C3DGroup_PreDestroy
48 };
49 
50 #endif
51 
52 
53 // AudioPlayer class
54 
55 static const struct iid_vtable AudioPlayer_interfaces[INTERFACES_AudioPlayer] = {
56     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CAudioPlayer, mObject)},
57     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
58         offsetof(CAudioPlayer, mDynamicInterfaceManagement)},
59     {MPH_PLAY, INTERFACE_IMPLICIT, offsetof(CAudioPlayer, mPlay)},
60     {MPH_3DDOPPLER, INTERFACE_DYNAMIC_GAME, offsetof(CAudioPlayer, m3DDoppler)},
61     {MPH_3DGROUPING, INTERFACE_EXPLICIT_GAME, offsetof(CAudioPlayer, m3DGrouping)},
62     {MPH_3DLOCATION, INTERFACE_EXPLICIT_GAME, offsetof(CAudioPlayer, m3DLocation)},
63     {MPH_3DSOURCE, INTERFACE_EXPLICIT_GAME, offsetof(CAudioPlayer, m3DSource)},
64     {MPH_BUFFERQUEUE, INTERFACE_EXPLICIT, offsetof(CAudioPlayer, mBufferQueue)},
65     {MPH_EFFECTSEND, INTERFACE_EXPLICIT, offsetof(CAudioPlayer, mEffectSend)},
66     {MPH_MUTESOLO, INTERFACE_EXPLICIT, offsetof(CAudioPlayer, mMuteSolo)},
67     {MPH_METADATAEXTRACTION, INTERFACE_DYNAMIC,
68         offsetof(CAudioPlayer, mMetadataExtraction)},
69     {MPH_METADATATRAVERSAL, INTERFACE_DYNAMIC_GAME_MUSIC,
70         offsetof(CAudioPlayer, mMetadataTraversal)},
71     {MPH_PREFETCHSTATUS, INTERFACE_EXPLICIT, offsetof(CAudioPlayer, mPrefetchStatus)},
72     {MPH_RATEPITCH, INTERFACE_DYNAMIC_GAME, offsetof(CAudioPlayer, mRatePitch)},
73     {MPH_SEEK, INTERFACE_EXPLICIT, offsetof(CAudioPlayer, mSeek)},
74     // The base Volume interface is explicit, but portions are only for Game and Music profiles
75     {MPH_VOLUME, INTERFACE_EXPLICIT, offsetof(CAudioPlayer, mVolume)},
76     {MPH_3DMACROSCOPIC, INTERFACE_OPTIONAL, offsetof(CAudioPlayer, m3DMacroscopic)},
77     {MPH_BASSBOOST, INTERFACE_DYNAMIC, offsetof(CAudioPlayer, mBassBoost)},
78     {MPH_DYNAMICSOURCE, INTERFACE_OPTIONAL, offsetof(CAudioPlayer, mDynamicSource)},
79     {MPH_ENVIRONMENTALREVERB, INTERFACE_DYNAMIC,
80         offsetof(CAudioPlayer, mEnvironmentalReverb)},
81     {MPH_EQUALIZER, INTERFACE_DYNAMIC, offsetof(CAudioPlayer, mEqualizer)},
82     {MPH_PITCH, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CAudioPlayer, mPitch)},
83     {MPH_PRESETREVERB, INTERFACE_DYNAMIC, offsetof(CAudioPlayer, mPresetReverb)},
84     {MPH_PLAYBACKRATE, INTERFACE_DYNAMIC, offsetof(CAudioPlayer, mPlaybackRate)},
85     {MPH_VIRTUALIZER, INTERFACE_DYNAMIC, offsetof(CAudioPlayer, mVirtualizer)},
86     {MPH_VISUALIZATION, INTERFACE_OPTIONAL, offsetof(CAudioPlayer, mVisualization)},
87 #ifdef ANDROID
88     {MPH_ANDROIDEFFECT, INTERFACE_EXPLICIT, offsetof(CAudioPlayer, mAndroidEffect)},
89     {MPH_ANDROIDEFFECTSEND, INTERFACE_EXPLICIT, offsetof(CAudioPlayer, mAndroidEffectSend)},
90     {MPH_ANDROIDCONFIGURATION, INTERFACE_EXPLICIT_PREREALIZE,
91             offsetof(CAudioPlayer, mAndroidConfiguration)},
92     {MPH_ANDROIDBUFFERQUEUESOURCE, INTERFACE_EXPLICIT, offsetof(CAudioPlayer, mAndroidBufferQueue)},
93 #endif
94 };
95 
96 static const ClassTable CAudioPlayer_class = {
97     AudioPlayer_interfaces,
98     INTERFACES_AudioPlayer,
99     MPH_to_AudioPlayer,
100     "AudioPlayer",
101     sizeof(CAudioPlayer),
102     SL_OBJECTID_AUDIOPLAYER,
103     0,      // OpenMAX AL object ID
104     CAudioPlayer_Realize,
105     CAudioPlayer_Resume,
106     CAudioPlayer_Destroy,
107     CAudioPlayer_PreDestroy
108 };
109 
110 
111 #if (USE_PROFILES & USE_PROFILES_OPTIONAL) || defined(ANDROID)
112 
113 // AudioRecorder class
114 
115 static const struct iid_vtable AudioRecorder_interfaces[INTERFACES_AudioRecorder] = {
116     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CAudioRecorder, mObject)},
117     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
118         offsetof(CAudioRecorder, mDynamicInterfaceManagement)},
119     {MPH_RECORD, INTERFACE_IMPLICIT, offsetof(CAudioRecorder, mRecord)},
120     {MPH_AUDIOENCODER, INTERFACE_EXPLICIT, offsetof(CAudioRecorder, mAudioEncoder)},
121     {MPH_BASSBOOST, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CAudioRecorder, mBassBoost)},
122     {MPH_DYNAMICSOURCE, INTERFACE_OPTIONAL, offsetof(CAudioRecorder, mDynamicSource)},
123     {MPH_EQUALIZER, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CAudioRecorder, mEqualizer)},
124     {MPH_VISUALIZATION, INTERFACE_OPTIONAL, offsetof(CAudioRecorder, mVisualization)},
125     {MPH_VOLUME, INTERFACE_OPTIONAL, offsetof(CAudioRecorder, mVolume)},
126 #ifdef ANDROID
127     {MPH_ANDROIDSIMPLEBUFFERQUEUE, INTERFACE_EXPLICIT, offsetof(CAudioRecorder, mBufferQueue)},
128     {MPH_ANDROIDCONFIGURATION, INTERFACE_EXPLICIT_PREREALIZE,
129             offsetof(CAudioRecorder, mAndroidConfiguration)},
130     /* marked explicit for Android implementation, not an SL ES explicit interface */
131     {MPH_ANDROIDACOUSTICECHOCANCELLATION, INTERFACE_EXPLICIT, offsetof(CAudioRecorder,
132                                                               mAcousticEchoCancellation)},
133     /* marked explicit for Android implementation, not an SL ES explicit interface */
134     {MPH_ANDROIDAUTOMATICGAINCONTROL, INTERFACE_EXPLICIT, offsetof(CAudioRecorder,
135                                                                    mAutomaticGainControl)},
136     /* marked explicit for Android implementation, not an SL ES explicit interface */
137     {MPH_ANDROIDNOISESUPPRESSION, INTERFACE_EXPLICIT, offsetof(CAudioRecorder, mNoiseSuppression)},
138 #endif
139 };
140 
141 static const ClassTable CAudioRecorder_class = {
142     AudioRecorder_interfaces,
143     INTERFACES_AudioRecorder,
144     MPH_to_AudioRecorder,
145     "AudioRecorder",
146     sizeof(CAudioRecorder),
147     SL_OBJECTID_AUDIORECORDER,
148     0,      // OpenMAX AL object ID
149     CAudioRecorder_Realize,
150     CAudioRecorder_Resume,
151     CAudioRecorder_Destroy,
152     CAudioRecorder_PreDestroy
153 };
154 
155 #endif
156 
157 
158 // Engine class
159 
160 static const struct iid_vtable Engine_interfaces[INTERFACES_Engine] = {
161     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CEngine, mObject)},
162     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
163         offsetof(CEngine, mDynamicInterfaceManagement)},
164     {MPH_ENGINE, INTERFACE_IMPLICIT, offsetof(CEngine, mEngine)},
165     {MPH_ENGINECAPABILITIES, INTERFACE_IMPLICIT_BASE, offsetof(CEngine, mEngineCapabilities)},
166     {MPH_THREADSYNC, INTERFACE_IMPLICIT_BASE, offsetof(CEngine, mThreadSync)},
167     {MPH_AUDIOIODEVICECAPABILITIES, INTERFACE_IMPLICIT_BASE,
168         offsetof(CEngine, mAudioIODeviceCapabilities)},
169     {MPH_AUDIODECODERCAPABILITIES, INTERFACE_EXPLICIT_BASE,
170         offsetof(CEngine, mAudioDecoderCapabilities)},
171     {MPH_AUDIOENCODERCAPABILITIES, INTERFACE_EXPLICIT_BASE,
172         offsetof(CEngine, mAudioEncoderCapabilities)},
173     {MPH_3DCOMMIT, INTERFACE_EXPLICIT_GAME, offsetof(CEngine, m3DCommit)},
174     {MPH_DEVICEVOLUME, INTERFACE_OPTIONAL, offsetof(CEngine, mDeviceVolume)},
175     {MPH_XAENGINE, INTERFACE_IMPLICIT, offsetof(CEngine, mXAEngine)},
176 #ifdef ANDROID
177     {MPH_ANDROIDEFFECTCAPABILITIES, INTERFACE_EXPLICIT,
178         offsetof(CEngine, mAndroidEffectCapabilities)},
179 #endif
180     {MPH_XAVIDEODECODERCAPABILITIES, INTERFACE_EXPLICIT,
181         offsetof(CEngine, mVideoDecoderCapabilities)},
182 };
183 
184 static const ClassTable CEngine_class = {
185     Engine_interfaces,
186     INTERFACES_Engine,
187     MPH_to_Engine,
188     "Engine",
189     sizeof(CEngine),
190     SL_OBJECTID_ENGINE,
191     XA_OBJECTID_ENGINE,
192     CEngine_Realize,
193     CEngine_Resume,
194     CEngine_Destroy,
195     CEngine_PreDestroy
196 };
197 
198 
199 #if USE_PROFILES & USE_PROFILES_OPTIONAL
200 
201 // LEDDevice class
202 
203 static const struct iid_vtable LEDDevice_interfaces[INTERFACES_LEDDevice] = {
204     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CLEDDevice, mObject)},
205     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
206         offsetof(CLEDDevice, mDynamicInterfaceManagement)},
207     {MPH_LED, INTERFACE_IMPLICIT, offsetof(CLEDDevice, mLEDArray)},
208 };
209 
210 static const ClassTable CLEDDevice_class = {
211     LEDDevice_interfaces,
212     INTERFACES_LEDDevice,
213     MPH_to_LEDDevice,
214     "LEDDevice",
215     sizeof(CLEDDevice),
216     SL_OBJECTID_LEDDEVICE,
217     XA_OBJECTID_LEDDEVICE,
218     NULL,
219     NULL,
220     NULL,
221     NULL
222 };
223 
224 #endif
225 
226 
227 #if USE_PROFILES & USE_PROFILES_GAME
228 
229 // Listener class
230 
231 static const struct iid_vtable Listener_interfaces[INTERFACES_Listener] = {
232     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CListener, mObject)},
233     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
234         offsetof(CListener, mDynamicInterfaceManagement)},
235     {MPH_3DDOPPLER, INTERFACE_DYNAMIC_GAME, offsetof(CListener, m3DDoppler)},
236     {MPH_3DLOCATION, INTERFACE_EXPLICIT_GAME, offsetof(CListener, m3DLocation)},
237 };
238 
239 static const ClassTable CListener_class = {
240     Listener_interfaces,
241     INTERFACES_Listener,
242     MPH_to_Listener,
243     "Listener",
244     sizeof(CListener),
245     SL_OBJECTID_LISTENER,
246     0,      // OpenMAX AL object ID
247     NULL,
248     NULL,
249     NULL,
250     NULL
251 };
252 
253 #endif
254 
255 
256 #if USE_PROFILES & (USE_PROFILES_GAME | USE_PROFILES_MUSIC)
257 
258 // MetadataExtractor class
259 
260 static const struct iid_vtable MetadataExtractor_interfaces[INTERFACES_MetadataExtractor] = {
261     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CMetadataExtractor, mObject)},
262     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
263         offsetof(CMetadataExtractor, mDynamicInterfaceManagement)},
264     {MPH_DYNAMICSOURCE, INTERFACE_IMPLICIT, offsetof(CMetadataExtractor, mDynamicSource)},
265     {MPH_METADATAEXTRACTION, INTERFACE_IMPLICIT, offsetof(CMetadataExtractor, mMetadataExtraction)},
266     {MPH_METADATATRAVERSAL, INTERFACE_IMPLICIT, offsetof(CMetadataExtractor, mMetadataTraversal)},
267 };
268 
269 static const ClassTable CMetadataExtractor_class = {
270     MetadataExtractor_interfaces,
271     INTERFACES_MetadataExtractor,
272     MPH_to_MetadataExtractor,
273     "MetadataExtractor",
274     sizeof(CMetadataExtractor),
275     SL_OBJECTID_METADATAEXTRACTOR,
276     XA_OBJECTID_METADATAEXTRACTOR,
277     NULL,
278     NULL,
279     NULL,
280     NULL
281 };
282 
283 #endif
284 
285 
286 #if USE_PROFILES & USE_PROFILES_GAME
287 
288 // MidiPlayer class
289 
290 static const struct iid_vtable MidiPlayer_interfaces[INTERFACES_MidiPlayer] = {
291     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CMidiPlayer, mObject)},
292     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
293         offsetof(CMidiPlayer, mDynamicInterfaceManagement)},
294     {MPH_PLAY, INTERFACE_IMPLICIT, offsetof(CMidiPlayer, mPlay)},
295     {MPH_3DDOPPLER, INTERFACE_DYNAMIC_GAME, offsetof(C3DGroup, m3DDoppler)},
296     {MPH_3DGROUPING, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, m3DGrouping)},
297     {MPH_3DLOCATION, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, m3DLocation)},
298     {MPH_3DSOURCE, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, m3DSource)},
299     {MPH_BUFFERQUEUE, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, mBufferQueue)},
300     {MPH_EFFECTSEND, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, mEffectSend)},
301     {MPH_MUTESOLO, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, mMuteSolo)},
302     {MPH_METADATAEXTRACTION, INTERFACE_DYNAMIC_GAME, offsetof(CMidiPlayer, mMetadataExtraction)},
303     {MPH_METADATATRAVERSAL, INTERFACE_DYNAMIC_GAME, offsetof(CMidiPlayer, mMetadataTraversal)},
304     {MPH_MIDIMESSAGE, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mMIDIMessage)},
305     {MPH_MIDITIME, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mMIDITime)},
306     {MPH_MIDITEMPO, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mMIDITempo)},
307     {MPH_MIDIMUTESOLO, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, mMIDIMuteSolo)},
308     {MPH_PREFETCHSTATUS, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mPrefetchStatus)},
309     {MPH_SEEK, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mSeek)},
310     {MPH_VOLUME, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mVolume)},
311     {MPH_3DMACROSCOPIC, INTERFACE_OPTIONAL, offsetof(CMidiPlayer, m3DMacroscopic)},
312     {MPH_BASSBOOST, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mBassBoost)},
313     {MPH_DYNAMICSOURCE, INTERFACE_OPTIONAL, offsetof(CMidiPlayer, mDynamicSource)},
314     {MPH_ENVIRONMENTALREVERB, INTERFACE_DYNAMIC_OPTIONAL,
315         offsetof(CMidiPlayer, mEnvironmentalReverb)},
316     {MPH_EQUALIZER, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mEqualizer)},
317     {MPH_PITCH, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mPitch)},
318     {MPH_PRESETREVERB, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mPresetReverb)},
319     {MPH_PLAYBACKRATE, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mPlaybackRate)},
320     {MPH_VIRTUALIZER, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mVirtualizer)},
321     {MPH_VISUALIZATION, INTERFACE_OPTIONAL, offsetof(CMidiPlayer, mVisualization)},
322 };
323 
324 static const ClassTable CMidiPlayer_class = {
325     MidiPlayer_interfaces,
326     INTERFACES_MidiPlayer,
327     MPH_to_MidiPlayer,
328     "MidiPlayer",
329     sizeof(CMidiPlayer),
330     SL_OBJECTID_MIDIPLAYER,
331     0,      // OpenMAX AL object ID
332     NULL,
333     NULL,
334     NULL,
335     NULL
336 };
337 
338 #endif
339 
340 
341 // OutputMix class
342 
343 static const struct iid_vtable OutputMix_interfaces[INTERFACES_OutputMix] = {
344     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(COutputMix, mObject)},
345     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
346         offsetof(COutputMix, mDynamicInterfaceManagement)},
347     {MPH_OUTPUTMIX, INTERFACE_IMPLICIT, offsetof(COutputMix, mOutputMix)},
348 #ifdef USE_OUTPUTMIXEXT
349     {MPH_OUTPUTMIXEXT, INTERFACE_UNAVAILABLE, offsetof(COutputMix, mOutputMixExt)},
350 #else
351     {MPH_OUTPUTMIXEXT, INTERFACE_UNAVAILABLE, 0},
352 #endif
353     {MPH_ENVIRONMENTALREVERB, INTERFACE_DYNAMIC,
354         offsetof(COutputMix, mEnvironmentalReverb)},
355     {MPH_EQUALIZER, INTERFACE_DYNAMIC, offsetof(COutputMix, mEqualizer)},
356     {MPH_PRESETREVERB, INTERFACE_DYNAMIC, offsetof(COutputMix, mPresetReverb)},
357     {MPH_VIRTUALIZER, INTERFACE_DYNAMIC, offsetof(COutputMix, mVirtualizer)},
358     // The overall Volume interface is explicit optional,
359     // but portions of Volume are mandated only in Game and Music profiles
360     {MPH_VOLUME, INTERFACE_OPTIONAL, offsetof(COutputMix, mVolume)},
361     {MPH_BASSBOOST, INTERFACE_DYNAMIC, offsetof(COutputMix, mBassBoost)},
362     {MPH_VISUALIZATION, INTERFACE_OPTIONAL, offsetof(COutputMix, mVisualization)},
363 #ifdef ANDROID
364     {MPH_ANDROIDEFFECT, INTERFACE_EXPLICIT, offsetof(COutputMix, mAndroidEffect)},
365 #endif
366 };
367 
368 static const ClassTable COutputMix_class = {
369     OutputMix_interfaces,
370     INTERFACES_OutputMix,
371     MPH_to_OutputMix,
372     "OutputMix",
373     sizeof(COutputMix),
374     SL_OBJECTID_OUTPUTMIX,
375     XA_OBJECTID_OUTPUTMIX,
376     COutputMix_Realize,
377     COutputMix_Resume,
378     COutputMix_Destroy,
379     COutputMix_PreDestroy
380 };
381 
382 
383 #if USE_PROFILES & USE_PROFILES_OPTIONAL
384 
385 // Vibra class
386 
387 static const struct iid_vtable VibraDevice_interfaces[INTERFACES_VibraDevice] = {
388     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CVibraDevice, mObject)},
389     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
390         offsetof(CVibraDevice, mDynamicInterfaceManagement)},
391     {MPH_VIBRA, INTERFACE_IMPLICIT, offsetof(CVibraDevice, mVibra)},
392 };
393 
394 static const ClassTable CVibraDevice_class = {
395     VibraDevice_interfaces,
396     INTERFACES_VibraDevice,
397     MPH_to_Vibra,
398     "VibraDevice",
399     sizeof(CVibraDevice),
400     SL_OBJECTID_VIBRADEVICE,
401     XA_OBJECTID_VIBRADEVICE,
402     NULL,
403     NULL,
404     NULL,
405     NULL
406 };
407 
408 #endif
409 
410 
411 // Media player class
412 
413 static const struct iid_vtable MediaPlayer_interfaces[INTERFACES_MediaPlayer] = {
414     {MPH_XAOBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CMediaPlayer, mObject)},
415     {MPH_XADYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
416         offsetof(CMediaPlayer, mDynamicInterfaceManagement)},
417     {MPH_XAPLAY, INTERFACE_IMPLICIT, offsetof(CMediaPlayer, mPlay)},
418     {MPH_XASTREAMINFORMATION, INTERFACE_EXPLICIT, offsetof(CMediaPlayer, mStreamInfo)},
419     {MPH_XAVOLUME, INTERFACE_IMPLICIT, offsetof(CMediaPlayer, mVolume)},
420     {MPH_XASEEK, INTERFACE_EXPLICIT, offsetof(CMediaPlayer, mSeek)},
421     {MPH_XAPREFETCHSTATUS, INTERFACE_EXPLICIT, offsetof(CMediaPlayer, mPrefetchStatus)},
422 #ifdef ANDROID
423     {MPH_ANDROIDBUFFERQUEUESOURCE, INTERFACE_EXPLICIT, offsetof(CMediaPlayer, mAndroidBufferQueue)},
424 #endif
425 };
426 
427 static const ClassTable CMediaPlayer_class = {
428     MediaPlayer_interfaces,
429     INTERFACES_MediaPlayer,
430     MPH_to_MediaPlayer,
431     "MediaPlayer",
432     sizeof(CMediaPlayer),
433     0,      // OpenSL ES object ID
434     XA_OBJECTID_MEDIAPLAYER,
435     CMediaPlayer_Realize,
436     CMediaPlayer_Resume,
437     CMediaPlayer_Destroy,
438     CMediaPlayer_PreDestroy
439 };
440 
441 
442 static const ClassTable * const slClasses[] = {
443     // Do not change order of these entries; they are in numerical order
444     &CEngine_class,
445 #if USE_PROFILES & USE_PROFILES_OPTIONAL
446     &CLEDDevice_class,
447     &CVibraDevice_class,
448 #else
449     NULL,
450     NULL,
451 #endif
452     &CAudioPlayer_class,
453 #if (USE_PROFILES & USE_PROFILES_OPTIONAL) || defined(ANDROID)
454     &CAudioRecorder_class,
455 #else
456     NULL,
457 #endif
458 #if USE_PROFILES & (USE_PROFILES_GAME | USE_PROFILES_PHONE)
459     &CMidiPlayer_class,
460 #else
461     NULL,
462 #endif
463 #if USE_PROFILES & USE_PROFILES_GAME
464     &CListener_class,
465     &C3DGroup_class,
466 #else
467     NULL,
468     NULL,
469 #endif
470     &COutputMix_class,
471 #if USE_PROFILES & (USE_PROFILES_GAME | USE_PROFILES_MUSIC)
472     &CMetadataExtractor_class
473 #else
474     NULL
475 #endif
476 };
477 
478 
479 static const ClassTable * const xaClasses[] = {
480     &CEngine_class,
481 #if USE_PROFILES & USE_PROFILES_OPTIONAL
482     &CLEDDevice_class,
483     &CVibraDevice_class,
484 #else
485     NULL,
486     NULL,
487 #endif
488     &CMediaPlayer_class,
489 #if 1
490     NULL,
491     NULL,
492 #else
493     &CMediaRecorder_class,
494     &CRadioDevice_class,
495 #endif
496     &COutputMix_class,
497 #if USE_PROFILES & (USE_PROFILES_GAME | USE_PROFILES_MUSIC)
498     &CMetadataExtractor_class,
499 #else
500     NULL,
501 #endif
502 #if 1
503     NULL
504 #else
505     &CCameraDevice_class
506 #endif
507 };
508 
509 
510 /* \brief Map SL_OBJECTID to class or NULL if object ID not supported */
511 
objectIDtoClass(SLuint32 objectID)512 LI_API const ClassTable *objectIDtoClass(SLuint32 objectID)
513 {
514     // object ID is the engine and always present
515     assert(NULL != slClasses[0]);
516     SLuint32 slObjectID0 = slClasses[0]->mSLObjectID;
517     if ((slObjectID0 <= objectID) && ((slObjectID0 + sizeof(slClasses)/sizeof(slClasses[0])) >
518             objectID)) {
519         return slClasses[objectID - slObjectID0];
520     }
521     assert(NULL != xaClasses[0]);
522     SLuint32 xaObjectID0 = xaClasses[0]->mXAObjectID;
523     if ((xaObjectID0 <= objectID) && ((xaObjectID0 + sizeof(xaClasses)/sizeof(xaClasses[0])) >
524             objectID)) {
525         return xaClasses[objectID - xaObjectID0];
526     }
527     return NULL;
528 }
529