CMediaPlayer.c revision 7da229586b6c8893a1731bfe3eae7996e2ccffc6
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/** \file CMediaPlayer.c MediaPlayer class */
18
19#include "sles_allinclusive.h"
20
21#ifdef ANDROID
22#include <gui/SurfaceTextureClient.h>
23#include "android/android_GenericMediaPlayer.h"
24using namespace android;
25#endif
26
27
28XAresult CMediaPlayer_Realize(void *self, XAboolean async)
29{
30    XAresult result = XA_RESULT_SUCCESS;
31
32#ifdef ANDROID
33    CMediaPlayer *thiz = (CMediaPlayer *) self;
34
35    // realize player
36    result = android_Player_realize(thiz, async);
37#endif
38
39    return result;
40}
41
42XAresult CMediaPlayer_Resume(void *self, XAboolean async)
43{
44    return XA_RESULT_SUCCESS;
45}
46
47
48/** \brief Hook called by Object::Destroy when a media player is destroyed */
49
50void CMediaPlayer_Destroy(void *self)
51{
52    CMediaPlayer *thiz = (CMediaPlayer *) self;
53    freeDataLocatorFormat(&thiz->mDataSource);
54    freeDataLocatorFormat(&thiz->mBankSource);
55    freeDataLocatorFormat(&thiz->mAudioSink);
56    freeDataLocatorFormat(&thiz->mImageVideoSink);
57    freeDataLocatorFormat(&thiz->mVibraSink);
58    freeDataLocatorFormat(&thiz->mLEDArraySink);
59#ifdef ANDROID
60    android_Player_destroy(thiz);
61#endif
62}
63
64
65predestroy_t CMediaPlayer_PreDestroy(void *self)
66{
67#ifdef ANDROID
68    CMediaPlayer *thiz = (CMediaPlayer *) self;
69    android_Player_preDestroy(thiz);
70#endif
71    return predestroy_ok;
72}
73