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