Home | History | Annotate | Download | only in android
      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 <system/window.h>
     18 
     19 /**************************************************************************************************
     20  * Player lifecycle
     21  ****************************/
     22 extern XAresult android_Player_checkSourceSink(CMediaPlayer *mp);
     23 
     24 extern XAresult android_Player_create(CMediaPlayer *mp);
     25 
     26 extern XAresult android_Player_realize(CMediaPlayer *mp, SLboolean async);
     27 
     28 extern XAresult android_Player_destroy(CMediaPlayer *mp);
     29 
     30 extern XAresult android_Player_preDestroy(CMediaPlayer *mp);
     31 
     32 
     33 /**************************************************************************************************
     34  * Configuration
     35  ****************************/
     36 
     37 /**
     38  *  pre-conditions:
     39  *      pMediaPlayer != NULL
     40  *      pMediaPlayer->mAVPlayer != 0 (player is realized)
     41  *      nativeWindow can be NULL, but if NULL it is treated as an error
     42  */
     43 extern SLresult android_Player_setNativeWindow(CMediaPlayer *pMediaPlayer,
     44         ANativeWindow *nativeWindow);
     45 
     46 /**
     47  * pre-conditions:
     48  *    pPlayItf != NULL
     49  *    pDurMsec, pPosMsec ! = NULL
     50  *    IObjectToObjectID( ((IPlay *) self)->mThis ) == XA_OBJECTID_MEDIAPLAYER
     51  */
     52 extern XAresult android_Player_getDuration(IPlay *pPlayItf, SLmillisecond *pDurMsec);
     53 extern XAresult android_Player_getPosition(IPlay *pPlayItf, SLmillisecond *pPosMsec);
     54 
     55 /**
     56  * pre-condition: mp != NULL
     57  */
     58 extern void android_Player_volumeUpdate(CMediaPlayer *mp);
     59 extern void android_Player_usePlayEventMask(CMediaPlayer *mp);
     60 
     61 /**************************************************************************************************
     62  * Playback control and events
     63  ****************************/
     64 /**
     65  * pre-condition: gp != 0
     66  */
     67 extern XAresult android_Player_setPlayState(const android::sp<android::GenericPlayer> &gp,
     68         SLuint32 playState,
     69         AndroidObjectState* pObjState);
     70 
     71 /**
     72  * for all functions below: pre-condition: mp != NULL
     73  */
     74 extern XAresult android_Player_seek(CMediaPlayer *mp, SLmillisecond posMsec);
     75 extern XAresult android_Player_loop(CMediaPlayer *mp, SLboolean loopEnable);
     76 
     77 
     78 
     79 /**************************************************************************************************
     80  * Buffer Queue events
     81  ****************************/
     82 
     83 /**************************************************************************************************
     84  * Android Buffer Queue
     85  ****************************/
     86 
     87 /* must be called with a lock on mp->mThis */
     88 extern void android_Player_androidBufferQueue_clear_l(CMediaPlayer *mp);
     89 /* must be called with a lock on mp->mThis */
     90 extern void android_Player_androidBufferQueue_onRefilled_l(CMediaPlayer *mp);
     91