MediaPlayer_to_android.cpp revision 35ac702ee1ad91e5c8748c12450222d50b366a52
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#include "sles_allinclusive.h"
18#include "utils/RefBase.h"
19#include "android_prompts.h"
20// LocAVPlayer and StreamPlayer derive from GenericMediaPlayer,
21//    so no need to #include "android_GenericMediaPlayer.h"
22#include "android_LocAVPlayer.h"
23#include "android_StreamPlayer.h"
24
25
26//-----------------------------------------------------------------------------
27static void player_handleMediaPlayerEventNotifications(int event, int data1, int data2, void* user)
28{
29    if (NULL == user) {
30        return;
31    }
32
33    CMediaPlayer* mp = (CMediaPlayer*) user;
34    SL_LOGV("received event %d, data %d from AVPlayer", event, data1);
35
36    switch(event) {
37
38      case android::GenericPlayer::kEventPrepared: {
39        if (PLAYER_SUCCESS == data1) {
40            object_lock_exclusive(&mp->mObject);
41            SL_LOGV("Received AVPlayer::kEventPrepared from AVPlayer for CMediaPlayer %p", mp);
42            mp->mAndroidObjState = ANDROID_READY;
43            object_unlock_exclusive(&mp->mObject);
44        }
45        break;
46      }
47
48      case android::GenericPlayer::kEventHasVideoSize: {
49        SL_LOGV("Received AVPlayer::kEventHasVideoSize (%d,%d) for CMediaPlayer %p",
50                data1, data2, mp);
51
52        object_lock_exclusive(&mp->mObject);
53
54        // remove an existing video info entry (here we only have one video stream)
55        for(size_t i=0 ; i < mp->mStreamInfo.mStreamInfoTable.size() ; i++) {
56            if (XA_DOMAINTYPE_VIDEO == mp->mStreamInfo.mStreamInfoTable.itemAt(i).domain) {
57                mp->mStreamInfo.mStreamInfoTable.removeAt(i);
58                break;
59            }
60        }
61        // update the stream information with a new video info entry
62        StreamInfo streamInfo;
63        streamInfo.domain = XA_DOMAINTYPE_VIDEO;
64        streamInfo.videoInfo.codecId = 0;// unknown, we don't have that info FIXME
65        streamInfo.videoInfo.width = (XAuint32)data1;
66        streamInfo.videoInfo.height = (XAuint32)data2;
67        streamInfo.videoInfo.bitRate = 0;// unknown, we don't have that info FIXME
68        streamInfo.videoInfo.duration = XA_TIME_UNKNOWN;
69        StreamInfo &contInfo = mp->mStreamInfo.mStreamInfoTable.editItemAt(0);
70        contInfo.containerInfo.numStreams = 1;
71        ssize_t index = mp->mStreamInfo.mStreamInfoTable.add(streamInfo);
72
73        xaStreamEventChangeCallback callback = mp->mStreamInfo.mCallback;
74        void* callbackPContext = mp->mStreamInfo.mContext;
75
76        object_unlock_exclusive(&mp->mObject);
77
78        // enqueue notification (outside of lock) that the stream information has been updated
79        if ((NULL != callback) && (index >= 0)) {
80#ifdef XA_SYNCHRONOUS_STREAMCBEVENT_PROPERTYCHANGE
81            (*callback)(&mp->mStreamInfo.mItf, XA_STREAMCBEVENT_PROPERTYCHANGE /*eventId*/,
82                    1 /*streamIndex, only one stream supported here, 0 is reserved*/,
83                    NULL /*pEventData, always NULL in OpenMAX AL 1.0.1*/,
84                    callbackPContext /*pContext*/);
85#else
86            SLresult res = EnqueueAsyncCallback_piipp(mp, callback,
87                    /*p1*/ &mp->mStreamInfo.mItf,
88                    /*i1*/ XA_STREAMCBEVENT_PROPERTYCHANGE /*eventId*/,
89                    /*i2*/ 1 /*streamIndex, only one stream supported here, 0 is reserved*/,
90                    /*p2*/ NULL /*pEventData, always NULL in OpenMAX AL 1.0.1*/,
91                    /*p3*/ callbackPContext /*pContext*/);
92#endif
93        }
94        break;
95      }
96
97      case android::GenericPlayer::kEventEndOfStream: {
98        SL_LOGV("Received AVPlayer::kEventEndOfStream for CMediaPlayer %p", mp);
99
100        object_lock_exclusive(&mp->mObject);
101        // should be xaPlayCallback but we're sharing the itf between SL and AL
102        slPlayCallback playCallback = NULL;
103        void * playContext = NULL;
104        // XAPlayItf callback or no callback?
105        if (mp->mPlay.mEventFlags & XA_PLAYEVENT_HEADATEND) {
106            playCallback = mp->mPlay.mCallback;
107            playContext = mp->mPlay.mContext;
108        }
109        object_unlock_exclusive(&mp->mObject);
110
111        // enqueue callback with no lock held
112        if (NULL != playCallback) {
113#ifdef XA_SYNCHRONOUS_PLAYEVENT_HEADATEND
114            (*playCallback)(&mp->mPlay.mItf, playContext, XA_PLAYEVENT_HEADATEND);
115#else
116            SLresult res = EnqueueAsyncCallback_ppi(mp, playCallback, &mp->mPlay.mItf, playContext,
117                    XA_PLAYEVENT_HEADATEND);
118            LOGW_IF(SL_RESULT_SUCCESS != res,
119                    "Callback %p(%p, %p, XA_PLAYEVENT_HEADATEND) dropped", playCallback,
120                    &mp->mPlay.mItf, playContext);
121#endif
122        }
123        break;
124      }
125
126      case android::GenericPlayer::kEventChannelCount: {
127        SL_LOGV("kEventChannelCount channels = %d", data1);
128        object_lock_exclusive(&mp->mObject);
129        if (UNKNOWN_NUMCHANNELS == mp->mNumChannels && UNKNOWN_NUMCHANNELS != data1) {
130            mp->mNumChannels = data1;
131            android_Player_volumeUpdate(mp);
132        }
133        object_unlock_exclusive(&mp->mObject);
134      }
135      break;
136
137      case android::GenericPlayer::kEventPrefetchFillLevelUpdate: {
138        SL_LOGV("kEventPrefetchFillLevelUpdate");
139      }
140      break;
141
142      case android::GenericPlayer::kEventPrefetchStatusChange: {
143        SL_LOGV("kEventPrefetchStatusChange");
144      }
145      break;
146
147
148      default: {
149        SL_LOGE("Received unknown event %d, data %d from AVPlayer", event, data1);
150      }
151    }
152}
153
154
155//-----------------------------------------------------------------------------
156XAresult android_Player_checkSourceSink(CMediaPlayer *mp) {
157
158    XAresult result = XA_RESULT_SUCCESS;
159
160    const SLDataSource *pSrc    = &mp->mDataSource.u.mSource;
161    const SLDataSink *pAudioSnk = &mp->mAudioSink.u.mSink;
162
163    // format check:
164    const SLuint32 sourceLocatorType = *(SLuint32 *)pSrc->pLocator;
165    const SLuint32 sourceFormatType  = *(SLuint32 *)pSrc->pFormat;
166    const SLuint32 audioSinkLocatorType = *(SLuint32 *)pAudioSnk->pLocator;
167    //const SLuint32 sinkFormatType = *(SLuint32 *)pAudioSnk->pFormat;
168
169    // Source check
170    switch(sourceLocatorType) {
171
172    case XA_DATALOCATOR_ANDROIDBUFFERQUEUE: {
173        switch (sourceFormatType) {
174        case XA_DATAFORMAT_MIME: {
175            SLDataFormat_MIME *df_mime = (SLDataFormat_MIME *) pSrc->pFormat;
176            if (SL_CONTAINERTYPE_MPEG_TS != df_mime->containerType) {
177                SL_LOGE("Cannot create player with XA_DATALOCATOR_ANDROIDBUFFERQUEUE data source "
178                        "that is not fed MPEG-2 TS data");
179                return SL_RESULT_CONTENT_UNSUPPORTED;
180            }
181        } break;
182        default:
183            SL_LOGE("Cannot create player with XA_DATALOCATOR_ANDROIDBUFFERQUEUE data source "
184                    "without SL_DATAFORMAT_MIME format");
185            return XA_RESULT_CONTENT_UNSUPPORTED;
186        }
187    } break;
188
189    case XA_DATALOCATOR_URI: // intended fall-through
190    case XA_DATALOCATOR_ANDROIDFD:
191        break;
192
193    default:
194        SL_LOGE("Cannot create media player with data locator type 0x%x",
195                (unsigned) sourceLocatorType);
196        return SL_RESULT_PARAMETER_INVALID;
197    }// switch (locatorType)
198
199    // Audio sink check: only playback is supported here
200    switch(audioSinkLocatorType) {
201
202    case XA_DATALOCATOR_OUTPUTMIX:
203        break;
204
205    default:
206        SL_LOGE("Cannot create media player with audio sink data locator of type 0x%x",
207                (unsigned) audioSinkLocatorType);
208        return XA_RESULT_PARAMETER_INVALID;
209    }// switch (locaaudioSinkLocatorTypeorType)
210
211    return result;
212}
213
214
215//-----------------------------------------------------------------------------
216XAresult android_Player_create(CMediaPlayer *mp) {
217
218    XAresult result = XA_RESULT_SUCCESS;
219
220    // FIXME verify data source
221    const SLDataSource *pDataSrc = &mp->mDataSource.u.mSource;
222    // FIXME verify audio data sink
223    const SLDataSink *pAudioSnk = &mp->mAudioSink.u.mSink;
224    // FIXME verify image data sink
225    const SLDataSink *pVideoSnk = &mp->mImageVideoSink.u.mSink;
226
227    XAuint32 sourceLocator = *(XAuint32 *)pDataSrc->pLocator;
228    switch(sourceLocator) {
229    // FIXME support Android simple buffer queue as well
230    case XA_DATALOCATOR_ANDROIDBUFFERQUEUE:
231        mp->mAndroidObjType = AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE;
232        break;
233    case XA_DATALOCATOR_URI: // intended fall-through
234    case SL_DATALOCATOR_ANDROIDFD:
235        mp->mAndroidObjType = AUDIOVIDEOPLAYER_FROM_URIFD;
236        break;
237    case XA_DATALOCATOR_ADDRESS: // intended fall-through
238    default:
239        SL_LOGE("Unable to create MediaPlayer for data source locator 0x%x", sourceLocator);
240        result = XA_RESULT_PARAMETER_INVALID;
241        break;
242    }
243
244    // FIXME duplicates an initialization also done by higher level
245    mp->mAndroidObjState = ANDROID_UNINITIALIZED;
246    mp->mStreamType = ANDROID_DEFAULT_OUTPUT_STREAM_TYPE;
247    mp->mSessionId = android::AudioSystem::newAudioSessionId();
248
249    return result;
250}
251
252
253//-----------------------------------------------------------------------------
254// FIXME abstract out the diff between CMediaPlayer and CAudioPlayer
255XAresult android_Player_realize(CMediaPlayer *mp, SLboolean async) {
256    SL_LOGV("android_Player_realize_l(%p)", mp);
257    XAresult result = XA_RESULT_SUCCESS;
258
259    const SLDataSource *pDataSrc = &mp->mDataSource.u.mSource;
260    const SLuint32 sourceLocator = *(SLuint32 *)pDataSrc->pLocator;
261
262    AudioPlayback_Parameters ap_params;
263    ap_params.sessionId = mp->mSessionId;
264    ap_params.streamType = mp->mStreamType;
265    ap_params.trackcb = NULL;
266    ap_params.trackcbUser = NULL;
267
268    switch(mp->mAndroidObjType) {
269    case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: {
270        mp->mAVPlayer = new android::StreamPlayer(&ap_params, true /*hasVideo*/);
271        mp->mAVPlayer->init(player_handleMediaPlayerEventNotifications, (void*)mp);
272        }
273        break;
274    case AUDIOVIDEOPLAYER_FROM_URIFD: {
275        mp->mAVPlayer = new android::LocAVPlayer(&ap_params, true /*hasVideo*/);
276        mp->mAVPlayer->init(player_handleMediaPlayerEventNotifications, (void*)mp);
277        switch (mp->mDataSource.mLocator.mLocatorType) {
278        case XA_DATALOCATOR_URI:
279            ((android::LocAVPlayer*)mp->mAVPlayer.get())->setDataSource(
280                    (const char*)mp->mDataSource.mLocator.mURI.URI);
281            break;
282        case XA_DATALOCATOR_ANDROIDFD: {
283            int64_t offset = (int64_t)mp->mDataSource.mLocator.mFD.offset;
284            ((android::LocAVPlayer*)mp->mAVPlayer.get())->setDataSource(
285                    (int)mp->mDataSource.mLocator.mFD.fd,
286                    offset == SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ?
287                            (int64_t)PLAYER_FD_FIND_FILE_SIZE : offset,
288                    (int64_t)mp->mDataSource.mLocator.mFD.length);
289            }
290            break;
291        default:
292            SL_LOGE("Invalid or unsupported data locator type %u for data source",
293                    mp->mDataSource.mLocator.mLocatorType);
294            result = XA_RESULT_PARAMETER_INVALID;
295        }
296        }
297        break;
298    case INVALID_TYPE: // intended fall-through
299    default:
300        SL_LOGE("Unable to realize MediaPlayer, invalid internal Android object type");
301        result = XA_RESULT_PARAMETER_INVALID;
302        break;
303    }
304
305    if (XA_RESULT_SUCCESS == result) {
306
307        // if there is a video sink
308        if (XA_DATALOCATOR_NATIVEDISPLAY ==
309                mp->mImageVideoSink.mLocator.mLocatorType) {
310            ANativeWindow *nativeWindow = (ANativeWindow *)
311                    mp->mImageVideoSink.mLocator.mNativeDisplay.hWindow;
312            // we already verified earlier that hWindow is non-NULL
313            assert(nativeWindow != NULL);
314            result = android_Player_setNativeWindow(mp, nativeWindow);
315        }
316
317    }
318
319    return result;
320}
321
322//-----------------------------------------------------------------------------
323XAresult android_Player_destroy(CMediaPlayer *mp) {
324    SL_LOGV("android_Player_destroy(%p)", mp);
325    XAresult result = XA_RESULT_SUCCESS;
326
327    if (mp->mAVPlayer != 0) {
328        mp->mAVPlayer.clear();
329    }
330
331    return result;
332}
333
334
335XAresult android_Player_getDuration(IPlay *pPlayItf, XAmillisecond *pDurMsec) {
336    XAresult result = XA_RESULT_SUCCESS;
337    CMediaPlayer *avp = (CMediaPlayer *)pPlayItf->mThis;
338
339    switch (avp->mAndroidObjType) {
340
341    case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through
342    case AUDIOVIDEOPLAYER_FROM_URIFD: {
343        int dur = -1;
344        if (avp->mAVPlayer != 0) {
345            avp->mAVPlayer->getDurationMsec(&dur);
346        }
347        if (dur == ANDROID_UNKNOWN_TIME) {
348            *pDurMsec = XA_TIME_UNKNOWN;
349        } else {
350            *pDurMsec = (XAmillisecond)dur;
351        }
352    } break;
353
354    default:
355        // we shouldn't be here
356        assert(false);
357        break;
358    }
359
360    return result;
361}
362
363
364XAresult android_Player_getPosition(IPlay *pPlayItf, XAmillisecond *pPosMsec) {
365    SL_LOGD("android_Player_getPosition()");
366    XAresult result = XA_RESULT_SUCCESS;
367    CMediaPlayer *avp = (CMediaPlayer *)pPlayItf->mThis;
368
369    switch (avp->mAndroidObjType) {
370
371    case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through
372    case AUDIOVIDEOPLAYER_FROM_URIFD: {
373        int pos = -1;
374        if (avp->mAVPlayer != 0) {
375            avp->mAVPlayer->getPositionMsec(&pos);
376        }
377        if (pos == ANDROID_UNKNOWN_TIME) {
378            *pPosMsec = XA_TIME_UNKNOWN;
379        } else {
380            *pPosMsec = (XAmillisecond)pos;
381        }
382    } break;
383
384    default:
385        // we shouldn't be here
386        assert(false);
387        break;
388    }
389
390    return result;
391}
392
393
394//-----------------------------------------------------------------------------
395/**
396 * pre-condition: mp != NULL
397 */
398void android_Player_volumeUpdate(CMediaPlayer* mp)
399{
400    android::GenericPlayer* avp = mp->mAVPlayer.get();
401    if (avp != NULL) {
402        float volumes[2];
403        // MediaPlayer does not currently support EffectSend or MuteSolo
404        android_player_volumeUpdate(volumes, &mp->mVolume, mp->mNumChannels, 1.0f, NULL);
405        float leftVol = volumes[0], rightVol = volumes[1];
406        avp->setVolume(leftVol, rightVol);
407    }
408}
409
410//-----------------------------------------------------------------------------
411/**
412 * pre-condition: gp != 0
413 */
414XAresult android_Player_setPlayState(const android::sp<android::GenericPlayer> &gp,
415        SLuint32 playState,
416        AndroidObjectState* pObjState)
417{
418    XAresult result = XA_RESULT_SUCCESS;
419    AndroidObjectState objState = *pObjState;
420
421    switch (playState) {
422     case SL_PLAYSTATE_STOPPED: {
423         SL_LOGV("setting AVPlayer to SL_PLAYSTATE_STOPPED");
424         gp->stop();
425         }
426         break;
427     case SL_PLAYSTATE_PAUSED: {
428         SL_LOGV("setting AVPlayer to SL_PLAYSTATE_PAUSED");
429         switch(objState) {
430         case ANDROID_UNINITIALIZED:
431             *pObjState = ANDROID_PREPARING;
432             gp->prepare();
433             break;
434         case ANDROID_PREPARING:
435             break;
436         case ANDROID_READY:
437             gp->pause();
438             break;
439         default:
440             SL_LOGE("Android object in invalid state");
441             break;
442         }
443         }
444         break;
445     case SL_PLAYSTATE_PLAYING: {
446         SL_LOGV("setting AVPlayer to SL_PLAYSTATE_PLAYING");
447         switch(objState) {
448         case ANDROID_UNINITIALIZED:
449             *pObjState = ANDROID_PREPARING;
450             gp->prepare();
451             // intended fall through
452         case ANDROID_PREPARING:
453             // intended fall through
454         case ANDROID_READY:
455             gp->play();
456             break;
457         default:
458             SL_LOGE("Android object in invalid state");
459             break;
460         }
461         }
462         break;
463     default:
464         // checked by caller, should not happen
465         break;
466     }
467
468    return result;
469}
470
471
472/**
473 * pre-condition: mp != NULL
474 */
475XAresult android_Player_seek(CMediaPlayer *mp, SLmillisecond posMsec) {
476    XAresult result = XA_RESULT_SUCCESS;
477    switch (mp->mAndroidObjType) {
478      case AUDIOVIDEOPLAYER_FROM_URIFD:
479        if (mp->mAVPlayer !=0) {
480            mp->mAVPlayer->seek(posMsec);
481        }
482        break;
483      case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through
484      default: {
485          result = XA_RESULT_PARAMETER_INVALID;
486      }
487    }
488    return result;
489}
490
491
492/**
493 * pre-condition: mp != NULL
494 */
495XAresult android_Player_loop(CMediaPlayer *mp, SLboolean loopEnable) {
496    XAresult result = XA_RESULT_SUCCESS;
497    switch (mp->mAndroidObjType) {
498      case AUDIOVIDEOPLAYER_FROM_URIFD:
499        if (mp->mAVPlayer !=0) {
500            mp->mAVPlayer->loop(loopEnable);
501        }
502        break;
503      case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through
504      default: {
505          result = XA_RESULT_PARAMETER_INVALID;
506      }
507    }
508    return result;
509}
510
511
512//-----------------------------------------------------------------------------
513void android_Player_androidBufferQueue_registerCallback_l(CMediaPlayer *mp) {
514    if ((mp->mAndroidObjType == AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE)
515            && (mp->mAVPlayer != 0)) {
516        SL_LOGD("android_Player_androidBufferQueue_registerCallback_l");
517        android::StreamPlayer* splr = static_cast<android::StreamPlayer*>(mp->mAVPlayer.get());
518        splr->registerQueueCallback(
519                (const void*)mp, false /*userIsAudioPlayer*/,
520                mp->mAndroidBufferQueue.mContext, (const void*)&(mp->mAndroidBufferQueue.mItf));
521
522    }
523}
524
525
526void android_Player_androidBufferQueue_clear_l(CMediaPlayer *mp) {
527    if ((mp->mAndroidObjType == AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE)
528            && (mp->mAVPlayer != 0)) {
529        android::StreamPlayer* splr = static_cast<android::StreamPlayer*>(mp->mAVPlayer.get());
530        splr->appClear_l();
531    }
532}
533
534
535void android_Player_androidBufferQueue_onRefilled_l(CMediaPlayer *mp) {
536    if ((mp->mAndroidObjType == AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE)
537            && (mp->mAVPlayer != 0)) {
538        android::StreamPlayer* splr = static_cast<android::StreamPlayer*>(mp->mAVPlayer.get());
539        splr->queueRefilled_l();
540    }
541}
542
543
544/*
545 *  pre-conditions:
546 *      mp != NULL
547 *      mp->mAVPlayer != 0 (player is realized)
548 *      nativeWindow can be NULL, but if NULL it is treated as an error
549 */
550SLresult android_Player_setNativeWindow(CMediaPlayer *mp, ANativeWindow *nativeWindow)
551{
552    assert(mp != NULL);
553    assert(mp->mAVPlayer != 0);
554    if (nativeWindow == NULL) {
555        SL_LOGE("ANativeWindow is NULL");
556        return SL_RESULT_PARAMETER_INVALID;
557    }
558    SLresult result;
559    int err;
560    int value;
561    // this could crash if app passes in a bad parameter, but that's OK
562    err = (*nativeWindow->query)(nativeWindow, NATIVE_WINDOW_CONCRETE_TYPE, &value);
563    if (0 != err) {
564        SL_LOGE("Query NATIVE_WINDOW_CONCRETE_TYPE on ANativeWindow * %p failed; "
565                "errno %d", nativeWindow, err);
566        result = SL_RESULT_PARAMETER_INVALID;
567    } else {
568        switch (value) {
569        case NATIVE_WINDOW_SURFACE: {                // Surface
570            SL_LOGV("Displaying on ANativeWindow of type NATIVE_WINDOW_SURFACE");
571            android::sp<android::Surface> nativeSurface(
572                    static_cast<android::Surface *>(nativeWindow));
573            mp->mAVPlayer->setVideoSurface(nativeSurface);
574            result = SL_RESULT_SUCCESS;
575            } break;
576        case NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT: { // SurfaceTextureClient
577            SL_LOGV("Displaying on ANativeWindow of type NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT");
578            android::sp<android::SurfaceTextureClient> surfaceTextureClient(
579                    static_cast<android::SurfaceTextureClient *>(nativeWindow));
580            android::sp<android::ISurfaceTexture> nativeSurfaceTexture(
581                    surfaceTextureClient->getISurfaceTexture());
582            mp->mAVPlayer->setVideoSurfaceTexture(nativeSurfaceTexture);
583            result = SL_RESULT_SUCCESS;
584            } break;
585        case NATIVE_WINDOW_FRAMEBUFFER:              // FramebufferNativeWindow
586            // fall through
587        default:
588            SL_LOGE("ANativeWindow * %p has unknown or unsupported concrete type %d",
589                    nativeWindow, value);
590            result = SL_RESULT_PARAMETER_INVALID;
591            break;
592        }
593    }
594    return result;
595}
596