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