Home | History | Annotate | Download | only in src
      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 #endif
    131 };
    132 
    133 static const ClassTable CAudioRecorder_class = {
    134     AudioRecorder_interfaces,
    135     INTERFACES_AudioRecorder,
    136     MPH_to_AudioRecorder,
    137     "AudioRecorder",
    138     sizeof(CAudioRecorder),
    139     SL_OBJECTID_AUDIORECORDER,
    140     0,      // OpenMAX AL object ID
    141     CAudioRecorder_Realize,
    142     CAudioRecorder_Resume,
    143     CAudioRecorder_Destroy,
    144     CAudioRecorder_PreDestroy
    145 };
    146 
    147 #endif
    148 
    149 
    150 // Engine class
    151 
    152 static const struct iid_vtable Engine_interfaces[INTERFACES_Engine] = {
    153     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CEngine, mObject)},
    154     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
    155         offsetof(CEngine, mDynamicInterfaceManagement)},
    156     {MPH_ENGINE, INTERFACE_IMPLICIT, offsetof(CEngine, mEngine)},
    157     {MPH_ENGINECAPABILITIES, INTERFACE_IMPLICIT_BASE, offsetof(CEngine, mEngineCapabilities)},
    158     {MPH_THREADSYNC, INTERFACE_IMPLICIT_BASE, offsetof(CEngine, mThreadSync)},
    159     {MPH_AUDIOIODEVICECAPABILITIES, INTERFACE_IMPLICIT_BASE,
    160         offsetof(CEngine, mAudioIODeviceCapabilities)},
    161     {MPH_AUDIODECODERCAPABILITIES, INTERFACE_EXPLICIT_BASE,
    162         offsetof(CEngine, mAudioDecoderCapabilities)},
    163     {MPH_AUDIOENCODERCAPABILITIES, INTERFACE_EXPLICIT_BASE,
    164         offsetof(CEngine, mAudioEncoderCapabilities)},
    165     {MPH_3DCOMMIT, INTERFACE_EXPLICIT_GAME, offsetof(CEngine, m3DCommit)},
    166     {MPH_DEVICEVOLUME, INTERFACE_OPTIONAL, offsetof(CEngine, mDeviceVolume)},
    167     {MPH_XAENGINE, INTERFACE_IMPLICIT, offsetof(CEngine, mXAEngine)},
    168 #ifdef ANDROID
    169     {MPH_ANDROIDEFFECTCAPABILITIES, INTERFACE_EXPLICIT,
    170         offsetof(CEngine, mAndroidEffectCapabilities)},
    171 #endif
    172     {MPH_XAVIDEODECODERCAPABILITIES, INTERFACE_EXPLICIT,
    173         offsetof(CEngine, mVideoDecoderCapabilities)},
    174 };
    175 
    176 static const ClassTable CEngine_class = {
    177     Engine_interfaces,
    178     INTERFACES_Engine,
    179     MPH_to_Engine,
    180     "Engine",
    181     sizeof(CEngine),
    182     SL_OBJECTID_ENGINE,
    183     XA_OBJECTID_ENGINE,
    184     CEngine_Realize,
    185     CEngine_Resume,
    186     CEngine_Destroy,
    187     CEngine_PreDestroy
    188 };
    189 
    190 
    191 #if USE_PROFILES & USE_PROFILES_OPTIONAL
    192 
    193 // LEDDevice class
    194 
    195 static const struct iid_vtable LEDDevice_interfaces[INTERFACES_LEDDevice] = {
    196     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CLEDDevice, mObject)},
    197     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
    198         offsetof(CLEDDevice, mDynamicInterfaceManagement)},
    199     {MPH_LED, INTERFACE_IMPLICIT, offsetof(CLEDDevice, mLEDArray)},
    200 };
    201 
    202 static const ClassTable CLEDDevice_class = {
    203     LEDDevice_interfaces,
    204     INTERFACES_LEDDevice,
    205     MPH_to_LEDDevice,
    206     "LEDDevice",
    207     sizeof(CLEDDevice),
    208     SL_OBJECTID_LEDDEVICE,
    209     XA_OBJECTID_LEDDEVICE,
    210     NULL,
    211     NULL,
    212     NULL,
    213     NULL
    214 };
    215 
    216 #endif
    217 
    218 
    219 #if USE_PROFILES & USE_PROFILES_GAME
    220 
    221 // Listener class
    222 
    223 static const struct iid_vtable Listener_interfaces[INTERFACES_Listener] = {
    224     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CListener, mObject)},
    225     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
    226         offsetof(CListener, mDynamicInterfaceManagement)},
    227     {MPH_3DDOPPLER, INTERFACE_DYNAMIC_GAME, offsetof(CListener, m3DDoppler)},
    228     {MPH_3DLOCATION, INTERFACE_EXPLICIT_GAME, offsetof(CListener, m3DLocation)},
    229 };
    230 
    231 static const ClassTable CListener_class = {
    232     Listener_interfaces,
    233     INTERFACES_Listener,
    234     MPH_to_Listener,
    235     "Listener",
    236     sizeof(CListener),
    237     SL_OBJECTID_LISTENER,
    238     0,      // OpenMAX AL object ID
    239     NULL,
    240     NULL,
    241     NULL,
    242     NULL
    243 };
    244 
    245 #endif
    246 
    247 
    248 #if USE_PROFILES & (USE_PROFILES_GAME | USE_PROFILES_MUSIC)
    249 
    250 // MetadataExtractor class
    251 
    252 static const struct iid_vtable MetadataExtractor_interfaces[INTERFACES_MetadataExtractor] = {
    253     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CMetadataExtractor, mObject)},
    254     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
    255         offsetof(CMetadataExtractor, mDynamicInterfaceManagement)},
    256     {MPH_DYNAMICSOURCE, INTERFACE_IMPLICIT, offsetof(CMetadataExtractor, mDynamicSource)},
    257     {MPH_METADATAEXTRACTION, INTERFACE_IMPLICIT, offsetof(CMetadataExtractor, mMetadataExtraction)},
    258     {MPH_METADATATRAVERSAL, INTERFACE_IMPLICIT, offsetof(CMetadataExtractor, mMetadataTraversal)},
    259 };
    260 
    261 static const ClassTable CMetadataExtractor_class = {
    262     MetadataExtractor_interfaces,
    263     INTERFACES_MetadataExtractor,
    264     MPH_to_MetadataExtractor,
    265     "MetadataExtractor",
    266     sizeof(CMetadataExtractor),
    267     SL_OBJECTID_METADATAEXTRACTOR,
    268     XA_OBJECTID_METADATAEXTRACTOR,
    269     NULL,
    270     NULL,
    271     NULL,
    272     NULL
    273 };
    274 
    275 #endif
    276 
    277 
    278 #if USE_PROFILES & USE_PROFILES_GAME
    279 
    280 // MidiPlayer class
    281 
    282 static const struct iid_vtable MidiPlayer_interfaces[INTERFACES_MidiPlayer] = {
    283     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CMidiPlayer, mObject)},
    284     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
    285         offsetof(CMidiPlayer, mDynamicInterfaceManagement)},
    286     {MPH_PLAY, INTERFACE_IMPLICIT, offsetof(CMidiPlayer, mPlay)},
    287     {MPH_3DDOPPLER, INTERFACE_DYNAMIC_GAME, offsetof(C3DGroup, m3DDoppler)},
    288     {MPH_3DGROUPING, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, m3DGrouping)},
    289     {MPH_3DLOCATION, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, m3DLocation)},
    290     {MPH_3DSOURCE, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, m3DSource)},
    291     {MPH_BUFFERQUEUE, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, mBufferQueue)},
    292     {MPH_EFFECTSEND, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, mEffectSend)},
    293     {MPH_MUTESOLO, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, mMuteSolo)},
    294     {MPH_METADATAEXTRACTION, INTERFACE_DYNAMIC_GAME, offsetof(CMidiPlayer, mMetadataExtraction)},
    295     {MPH_METADATATRAVERSAL, INTERFACE_DYNAMIC_GAME, offsetof(CMidiPlayer, mMetadataTraversal)},
    296     {MPH_MIDIMESSAGE, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mMIDIMessage)},
    297     {MPH_MIDITIME, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mMIDITime)},
    298     {MPH_MIDITEMPO, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mMIDITempo)},
    299     {MPH_MIDIMUTESOLO, INTERFACE_EXPLICIT_GAME, offsetof(CMidiPlayer, mMIDIMuteSolo)},
    300     {MPH_PREFETCHSTATUS, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mPrefetchStatus)},
    301     {MPH_SEEK, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mSeek)},
    302     {MPH_VOLUME, INTERFACE_EXPLICIT_GAME_PHONE, offsetof(CMidiPlayer, mVolume)},
    303     {MPH_3DMACROSCOPIC, INTERFACE_OPTIONAL, offsetof(CMidiPlayer, m3DMacroscopic)},
    304     {MPH_BASSBOOST, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mBassBoost)},
    305     {MPH_DYNAMICSOURCE, INTERFACE_OPTIONAL, offsetof(CMidiPlayer, mDynamicSource)},
    306     {MPH_ENVIRONMENTALREVERB, INTERFACE_DYNAMIC_OPTIONAL,
    307         offsetof(CMidiPlayer, mEnvironmentalReverb)},
    308     {MPH_EQUALIZER, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mEqualizer)},
    309     {MPH_PITCH, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mPitch)},
    310     {MPH_PRESETREVERB, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mPresetReverb)},
    311     {MPH_PLAYBACKRATE, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mPlaybackRate)},
    312     {MPH_VIRTUALIZER, INTERFACE_DYNAMIC_OPTIONAL, offsetof(CMidiPlayer, mVirtualizer)},
    313     {MPH_VISUALIZATION, INTERFACE_OPTIONAL, offsetof(CMidiPlayer, mVisualization)},
    314 };
    315 
    316 static const ClassTable CMidiPlayer_class = {
    317     MidiPlayer_interfaces,
    318     INTERFACES_MidiPlayer,
    319     MPH_to_MidiPlayer,
    320     "MidiPlayer",
    321     sizeof(CMidiPlayer),
    322     SL_OBJECTID_MIDIPLAYER,
    323     0,      // OpenMAX AL object ID
    324     NULL,
    325     NULL,
    326     NULL,
    327     NULL
    328 };
    329 
    330 #endif
    331 
    332 
    333 // OutputMix class
    334 
    335 static const struct iid_vtable OutputMix_interfaces[INTERFACES_OutputMix] = {
    336     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(COutputMix, mObject)},
    337     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
    338         offsetof(COutputMix, mDynamicInterfaceManagement)},
    339     {MPH_OUTPUTMIX, INTERFACE_IMPLICIT, offsetof(COutputMix, mOutputMix)},
    340 #ifdef USE_OUTPUTMIXEXT
    341     {MPH_OUTPUTMIXEXT, INTERFACE_UNAVAILABLE, offsetof(COutputMix, mOutputMixExt)},
    342 #else
    343     {MPH_OUTPUTMIXEXT, INTERFACE_UNAVAILABLE, 0},
    344 #endif
    345     {MPH_ENVIRONMENTALREVERB, INTERFACE_DYNAMIC,
    346         offsetof(COutputMix, mEnvironmentalReverb)},
    347     {MPH_EQUALIZER, INTERFACE_DYNAMIC, offsetof(COutputMix, mEqualizer)},
    348     {MPH_PRESETREVERB, INTERFACE_DYNAMIC, offsetof(COutputMix, mPresetReverb)},
    349     {MPH_VIRTUALIZER, INTERFACE_DYNAMIC, offsetof(COutputMix, mVirtualizer)},
    350     // The overall Volume interface is explicit optional,
    351     // but portions of Volume are mandated only in Game and Music profiles
    352     {MPH_VOLUME, INTERFACE_OPTIONAL, offsetof(COutputMix, mVolume)},
    353     {MPH_BASSBOOST, INTERFACE_DYNAMIC, offsetof(COutputMix, mBassBoost)},
    354     {MPH_VISUALIZATION, INTERFACE_OPTIONAL, offsetof(COutputMix, mVisualization)},
    355 #ifdef ANDROID
    356     {MPH_ANDROIDEFFECT, INTERFACE_EXPLICIT, offsetof(COutputMix, mAndroidEffect)},
    357 #endif
    358 };
    359 
    360 static const ClassTable COutputMix_class = {
    361     OutputMix_interfaces,
    362     INTERFACES_OutputMix,
    363     MPH_to_OutputMix,
    364     "OutputMix",
    365     sizeof(COutputMix),
    366     SL_OBJECTID_OUTPUTMIX,
    367     XA_OBJECTID_OUTPUTMIX,
    368     COutputMix_Realize,
    369     COutputMix_Resume,
    370     COutputMix_Destroy,
    371     COutputMix_PreDestroy
    372 };
    373 
    374 
    375 #if USE_PROFILES & USE_PROFILES_OPTIONAL
    376 
    377 // Vibra class
    378 
    379 static const struct iid_vtable VibraDevice_interfaces[INTERFACES_VibraDevice] = {
    380     {MPH_OBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CVibraDevice, mObject)},
    381     {MPH_DYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
    382         offsetof(CVibraDevice, mDynamicInterfaceManagement)},
    383     {MPH_VIBRA, INTERFACE_IMPLICIT, offsetof(CVibraDevice, mVibra)},
    384 };
    385 
    386 static const ClassTable CVibraDevice_class = {
    387     VibraDevice_interfaces,
    388     INTERFACES_VibraDevice,
    389     MPH_to_Vibra,
    390     "VibraDevice",
    391     sizeof(CVibraDevice),
    392     SL_OBJECTID_VIBRADEVICE,
    393     XA_OBJECTID_VIBRADEVICE,
    394     NULL,
    395     NULL,
    396     NULL,
    397     NULL
    398 };
    399 
    400 #endif
    401 
    402 
    403 // Media player class
    404 
    405 static const struct iid_vtable MediaPlayer_interfaces[INTERFACES_MediaPlayer] = {
    406     {MPH_XAOBJECT, INTERFACE_IMPLICIT_PREREALIZE, offsetof(CMediaPlayer, mObject)},
    407     {MPH_XADYNAMICINTERFACEMANAGEMENT, INTERFACE_IMPLICIT,
    408         offsetof(CMediaPlayer, mDynamicInterfaceManagement)},
    409     {MPH_XAPLAY, INTERFACE_IMPLICIT, offsetof(CMediaPlayer, mPlay)},
    410     {MPH_XASTREAMINFORMATION, INTERFACE_EXPLICIT, offsetof(CMediaPlayer, mStreamInfo)},
    411     {MPH_XAVOLUME, INTERFACE_IMPLICIT, offsetof(CMediaPlayer, mVolume)},
    412     {MPH_XASEEK, INTERFACE_EXPLICIT, offsetof(CMediaPlayer, mSeek)},
    413     {MPH_XAPREFETCHSTATUS, INTERFACE_EXPLICIT, offsetof(CMediaPlayer, mPrefetchStatus)},
    414 #ifdef ANDROID
    415     {MPH_ANDROIDBUFFERQUEUESOURCE, INTERFACE_EXPLICIT, offsetof(CMediaPlayer, mAndroidBufferQueue)},
    416 #endif
    417 };
    418 
    419 static const ClassTable CMediaPlayer_class = {
    420     MediaPlayer_interfaces,
    421     INTERFACES_MediaPlayer,
    422     MPH_to_MediaPlayer,
    423     "MediaPlayer",
    424     sizeof(CMediaPlayer),
    425     0,      // OpenSL ES object ID
    426     XA_OBJECTID_MEDIAPLAYER,
    427     CMediaPlayer_Realize,
    428     CMediaPlayer_Resume,
    429     CMediaPlayer_Destroy,
    430     CMediaPlayer_PreDestroy
    431 };
    432 
    433 
    434 static const ClassTable * const slClasses[] = {
    435     // Do not change order of these entries; they are in numerical order
    436     &CEngine_class,
    437 #if USE_PROFILES & USE_PROFILES_OPTIONAL
    438     &CLEDDevice_class,
    439     &CVibraDevice_class,
    440 #else
    441     NULL,
    442     NULL,
    443 #endif
    444     &CAudioPlayer_class,
    445 #if (USE_PROFILES & USE_PROFILES_OPTIONAL) || defined(ANDROID)
    446     &CAudioRecorder_class,
    447 #else
    448     NULL,
    449 #endif
    450 #if USE_PROFILES & (USE_PROFILES_GAME | USE_PROFILES_PHONE)
    451     &CMidiPlayer_class,
    452 #else
    453     NULL,
    454 #endif
    455 #if USE_PROFILES & USE_PROFILES_GAME
    456     &CListener_class,
    457     &C3DGroup_class,
    458 #else
    459     NULL,
    460     NULL,
    461 #endif
    462     &COutputMix_class,
    463 #if USE_PROFILES & (USE_PROFILES_GAME | USE_PROFILES_MUSIC)
    464     &CMetadataExtractor_class
    465 #else
    466     NULL
    467 #endif
    468 };
    469 
    470 
    471 static const ClassTable * const xaClasses[] = {
    472     &CEngine_class,
    473 #if USE_PROFILES & USE_PROFILES_OPTIONAL
    474     &CLEDDevice_class,
    475     &CVibraDevice_class,
    476 #else
    477     NULL,
    478     NULL,
    479 #endif
    480     &CMediaPlayer_class,
    481 #if 1
    482     NULL,
    483     NULL,
    484 #else
    485     &CMediaRecorder_class,
    486     &CRadioDevice_class,
    487 #endif
    488     &COutputMix_class,
    489 #if USE_PROFILES & (USE_PROFILES_GAME | USE_PROFILES_MUSIC)
    490     &CMetadataExtractor_class,
    491 #else
    492     NULL,
    493 #endif
    494 #if 1
    495     NULL
    496 #else
    497     &CCameraDevice_class
    498 #endif
    499 };
    500 
    501 
    502 /* \brief Map SL_OBJECTID to class or NULL if object ID not supported */
    503 
    504 LI_API const ClassTable *objectIDtoClass(SLuint32 objectID)
    505 {
    506     // object ID is the engine and always present
    507     assert(NULL != slClasses[0]);
    508     SLuint32 slObjectID0 = slClasses[0]->mSLObjectID;
    509     if ((slObjectID0 <= objectID) && ((slObjectID0 + sizeof(slClasses)/sizeof(slClasses[0])) >
    510             objectID)) {
    511         return slClasses[objectID - slObjectID0];
    512     }
    513     assert(NULL != xaClasses[0]);
    514     SLuint32 xaObjectID0 = xaClasses[0]->mXAObjectID;
    515     if ((xaObjectID0 <= objectID) && ((xaObjectID0 + sizeof(xaClasses)/sizeof(xaClasses[0])) >
    516             objectID)) {
    517         return xaClasses[objectID - xaObjectID0];
    518     }
    519     return NULL;
    520 }
    521