MediaPlayer_to_android.cpp revision 3d332ff421e7179c36fb652771cc8ded53383729
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    CMediaPlayer *avp = (CMediaPlayer *)pPlayItf->mThis;
337
338    switch (avp->mAndroidObjType) {
339
340    case AUDIOVIDEOPLAYER_FROM_URIFD: {
341        int dur = ANDROID_UNKNOWN_TIME;
342        if (avp->mAVPlayer != 0) {
343            avp->mAVPlayer->getDurationMsec(&dur);
344        }
345        if (dur == ANDROID_UNKNOWN_TIME) {
346            *pDurMsec = XA_TIME_UNKNOWN;
347        } else {
348            *pDurMsec = (XAmillisecond)dur;
349        }
350    } break;
351
352    case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through
353    default:
354        *pDurMsec = XA_TIME_UNKNOWN;
355        break;
356    }
357
358    return XA_RESULT_SUCCESS;
359}
360
361
362XAresult android_Player_getPosition(IPlay *pPlayItf, XAmillisecond *pPosMsec) {
363    SL_LOGD("android_Player_getPosition()");
364    XAresult result = XA_RESULT_SUCCESS;
365    CMediaPlayer *avp = (CMediaPlayer *)pPlayItf->mThis;
366
367    switch (avp->mAndroidObjType) {
368
369    case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through
370    case AUDIOVIDEOPLAYER_FROM_URIFD: {
371        int pos = -1;
372        if (avp->mAVPlayer != 0) {
373            avp->mAVPlayer->getPositionMsec(&pos);
374        }
375        if (pos == ANDROID_UNKNOWN_TIME) {
376            *pPosMsec = XA_TIME_UNKNOWN;
377        } else {
378            *pPosMsec = (XAmillisecond)pos;
379        }
380    } break;
381
382    default:
383        // we shouldn't be here
384        assert(false);
385        break;
386    }
387
388    return result;
389}
390
391
392//-----------------------------------------------------------------------------
393/**
394 * pre-condition: mp != NULL
395 */
396void android_Player_volumeUpdate(CMediaPlayer* mp)
397{
398    android::GenericPlayer* avp = mp->mAVPlayer.get();
399    if (avp != NULL) {
400        float volumes[2];
401        // MediaPlayer does not currently support EffectSend or MuteSolo
402        android_player_volumeUpdate(volumes, &mp->mVolume, mp->mNumChannels, 1.0f, NULL);
403        float leftVol = volumes[0], rightVol = volumes[1];
404        avp->setVolume(leftVol, rightVol);
405    }
406}
407
408//-----------------------------------------------------------------------------
409/**
410 * pre-condition: gp != 0
411 */
412XAresult android_Player_setPlayState(const android::sp<android::GenericPlayer> &gp,
413        SLuint32 playState,
414        AndroidObjectState* pObjState)
415{
416    XAresult result = XA_RESULT_SUCCESS;
417    AndroidObjectState objState = *pObjState;
418
419    switch (playState) {
420     case SL_PLAYSTATE_STOPPED: {
421         SL_LOGV("setting AVPlayer to SL_PLAYSTATE_STOPPED");
422         gp->stop();
423         }
424         break;
425     case SL_PLAYSTATE_PAUSED: {
426         SL_LOGV("setting AVPlayer to SL_PLAYSTATE_PAUSED");
427         switch(objState) {
428         case ANDROID_UNINITIALIZED:
429             *pObjState = ANDROID_PREPARING;
430             gp->prepare();
431             break;
432         case ANDROID_PREPARING:
433             break;
434         case ANDROID_READY:
435             gp->pause();
436             break;
437         default:
438             SL_LOGE("Android object in invalid state");
439             break;
440         }
441         }
442         break;
443     case SL_PLAYSTATE_PLAYING: {
444         SL_LOGV("setting AVPlayer to SL_PLAYSTATE_PLAYING");
445         switch(objState) {
446         case ANDROID_UNINITIALIZED:
447             *pObjState = ANDROID_PREPARING;
448             gp->prepare();
449             // intended fall through
450         case ANDROID_PREPARING:
451             // intended fall through
452         case ANDROID_READY:
453             gp->play();
454             break;
455         default:
456             SL_LOGE("Android object in invalid state");
457             break;
458         }
459         }
460         break;
461     default:
462         // checked by caller, should not happen
463         break;
464     }
465
466    return result;
467}
468
469
470/**
471 * pre-condition: mp != NULL
472 */
473XAresult android_Player_seek(CMediaPlayer *mp, SLmillisecond posMsec) {
474    XAresult result = XA_RESULT_SUCCESS;
475    switch (mp->mAndroidObjType) {
476      case AUDIOVIDEOPLAYER_FROM_URIFD:
477        if (mp->mAVPlayer !=0) {
478            mp->mAVPlayer->seek(posMsec);
479        }
480        break;
481      case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through
482      default: {
483          result = XA_RESULT_PARAMETER_INVALID;
484      }
485    }
486    return result;
487}
488
489
490/**
491 * pre-condition: mp != NULL
492 */
493XAresult android_Player_loop(CMediaPlayer *mp, SLboolean loopEnable) {
494    XAresult result = XA_RESULT_SUCCESS;
495    switch (mp->mAndroidObjType) {
496      case AUDIOVIDEOPLAYER_FROM_URIFD:
497        if (mp->mAVPlayer !=0) {
498            mp->mAVPlayer->loop(loopEnable);
499        }
500        break;
501      case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through
502      default: {
503          result = XA_RESULT_PARAMETER_INVALID;
504      }
505    }
506    return result;
507}
508
509
510//-----------------------------------------------------------------------------
511void android_Player_androidBufferQueue_registerCallback_l(CMediaPlayer *mp) {
512    if ((mp->mAndroidObjType == AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE)
513            && (mp->mAVPlayer != 0)) {
514        SL_LOGD("android_Player_androidBufferQueue_registerCallback_l");
515        android::StreamPlayer* splr = static_cast<android::StreamPlayer*>(mp->mAVPlayer.get());
516        splr->registerQueueCallback(
517                (const void*)mp, false /*userIsAudioPlayer*/,
518                mp->mAndroidBufferQueue.mContext, (const void*)&(mp->mAndroidBufferQueue.mItf));
519
520    }
521}
522
523
524void android_Player_androidBufferQueue_clear_l(CMediaPlayer *mp) {
525    if ((mp->mAndroidObjType == AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE)
526            && (mp->mAVPlayer != 0)) {
527        android::StreamPlayer* splr = static_cast<android::StreamPlayer*>(mp->mAVPlayer.get());
528        splr->appClear_l();
529    }
530}
531
532
533void android_Player_androidBufferQueue_onRefilled_l(CMediaPlayer *mp) {
534    if ((mp->mAndroidObjType == AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE)
535            && (mp->mAVPlayer != 0)) {
536        android::StreamPlayer* splr = static_cast<android::StreamPlayer*>(mp->mAVPlayer.get());
537        splr->queueRefilled_l();
538    }
539}
540
541
542/*
543 *  pre-conditions:
544 *      mp != NULL
545 *      mp->mAVPlayer != 0 (player is realized)
546 *      nativeWindow can be NULL, but if NULL it is treated as an error
547 */
548SLresult android_Player_setNativeWindow(CMediaPlayer *mp, ANativeWindow *nativeWindow)
549{
550    assert(mp != NULL);
551    assert(mp->mAVPlayer != 0);
552    if (nativeWindow == NULL) {
553        SL_LOGE("ANativeWindow is NULL");
554        return SL_RESULT_PARAMETER_INVALID;
555    }
556    SLresult result;
557    int err;
558    int value;
559    // this could crash if app passes in a bad parameter, but that's OK
560    err = (*nativeWindow->query)(nativeWindow, NATIVE_WINDOW_CONCRETE_TYPE, &value);
561    if (0 != err) {
562        SL_LOGE("Query NATIVE_WINDOW_CONCRETE_TYPE on ANativeWindow * %p failed; "
563                "errno %d", nativeWindow, err);
564        result = SL_RESULT_PARAMETER_INVALID;
565    } else {
566        switch (value) {
567        case NATIVE_WINDOW_SURFACE: {                // Surface
568            SL_LOGV("Displaying on ANativeWindow of type NATIVE_WINDOW_SURFACE");
569            android::sp<android::Surface> nativeSurface(
570                    static_cast<android::Surface *>(nativeWindow));
571            mp->mAVPlayer->setVideoSurface(nativeSurface);
572            result = SL_RESULT_SUCCESS;
573            } break;
574        case NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT: { // SurfaceTextureClient
575            SL_LOGV("Displaying on ANativeWindow of type NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT");
576            android::sp<android::SurfaceTextureClient> surfaceTextureClient(
577                    static_cast<android::SurfaceTextureClient *>(nativeWindow));
578            android::sp<android::ISurfaceTexture> nativeSurfaceTexture(
579                    surfaceTextureClient->getISurfaceTexture());
580            mp->mAVPlayer->setVideoSurfaceTexture(nativeSurfaceTexture);
581            result = SL_RESULT_SUCCESS;
582            } break;
583        case NATIVE_WINDOW_FRAMEBUFFER:              // FramebufferNativeWindow
584            // fall through
585        default:
586            SL_LOGE("ANativeWindow * %p has unknown or unsupported concrete type %d",
587                    nativeWindow, value);
588            result = SL_RESULT_PARAMETER_INVALID;
589            break;
590        }
591    }
592    return result;
593}
594