MediaPlayer_to_android.h revision 35a5a30fdad179ccf38d8d756590411326159a89
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 * pre-conditions: gp != 0, surface != 0
38 */
39extern XAresult android_Player_setVideoSurface(
40        const android::sp<android::GenericPlayer> &gp,
41        const android::sp<android::Surface> &surface);
42
43/**
44 * pre-conditions: gp != 0, surfaceTexture != 0
45 */
46extern XAresult android_Player_setVideoSurfaceTexture(
47        const android::sp<android::GenericPlayer> &gp,
48        const android::sp<android::ISurfaceTexture> &surfaceTexture);
49
50/**
51 * pre-conditions:
52 *    pPlayItf != NULL
53 *    pDurMsec, pPosMsec ! = NULL
54 *    IObjectToObjectID( ((IPlay *) self)->mThis ) == XA_OBJECTID_MEDIAPLAYER
55 */
56extern XAresult android_Player_getDuration(IPlay *pPlayItf, SLmillisecond *pDurMsec);
57extern XAresult android_Player_getPosition(IPlay *pPlayItf, SLmillisecond *pPosMsec);
58
59/**
60 * pre-condition: gp != 0, pVolItf != NULL
61 */
62extern XAresult android_Player_volumeUpdate(
63        const android::sp<android::GenericPlayer> &gp, IVolume *pVolItf);
64
65/**************************************************************************************************
66 * Playback control and events
67 ****************************/
68/**
69 * pre-condition: gp != 0
70 */
71extern XAresult android_Player_setPlayState(const android::sp<android::GenericPlayer> &gp,
72        SLuint32 playState,
73        AndroidObjectState* pObjState);
74
75/**
76 * for all functions below: pre-condition: mp != NULL
77 */
78extern XAresult android_Player_seek(CMediaPlayer *ap, SLmillisecond posMsec);
79extern XAresult android_Player_loop(CMediaPlayer *mp, SLboolean loopEnable);
80
81
82
83/**************************************************************************************************
84 * Buffer Queue events
85 ****************************/
86
87/**************************************************************************************************
88 * Android Buffer Queue
89 ****************************/
90
91/* must be called with a lock on mp->mThis */
92extern void android_Player_androidBufferQueue_registerCallback_l(CMediaPlayer *mp);
93/* must be called with a lock on mp->mThis */
94extern void android_Player_androidBufferQueue_clear_l(CMediaPlayer *mp);
95/* must be called with a lock on mp->mThis */
96extern void android_Player_androidBufferQueue_onRefilled_l(CMediaPlayer *mp);
97