MediaPlayer_to_android.h 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 <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 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 */ 43extern 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 */ 52extern XAresult android_Player_getDuration(IPlay *pPlayItf, SLmillisecond *pDurMsec); 53extern XAresult android_Player_getPosition(IPlay *pPlayItf, SLmillisecond *pPosMsec); 54 55/** 56 * pre-condition: mp != NULL 57 */ 58extern void android_Player_volumeUpdate(CMediaPlayer *mp); 59 60/************************************************************************************************** 61 * Playback control and events 62 ****************************/ 63/** 64 * pre-condition: gp != 0 65 */ 66extern XAresult android_Player_setPlayState(const android::sp<android::GenericPlayer> &gp, 67 SLuint32 playState, 68 AndroidObjectState* pObjState); 69 70/** 71 * for all functions below: pre-condition: mp != NULL 72 */ 73extern XAresult android_Player_seek(CMediaPlayer *mp, SLmillisecond posMsec); 74extern XAresult android_Player_loop(CMediaPlayer *mp, SLboolean loopEnable); 75 76 77 78/************************************************************************************************** 79 * Buffer Queue events 80 ****************************/ 81 82/************************************************************************************************** 83 * Android Buffer Queue 84 ****************************/ 85 86/* must be called with a lock on mp->mThis */ 87extern void android_Player_androidBufferQueue_registerCallback_l(CMediaPlayer *mp); 88/* must be called with a lock on mp->mThis */ 89extern void android_Player_androidBufferQueue_clear_l(CMediaPlayer *mp); 90/* must be called with a lock on mp->mThis */ 91extern void android_Player_androidBufferQueue_onRefilled_l(CMediaPlayer *mp); 92