NuPlayerDriver.cpp revision f933441648ef6a71dee783d733aac17b9508b452
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//#define LOG_NDEBUG 0
18#define LOG_TAG "NuPlayerDriver"
19#include <utils/Log.h>
20
21#include "NuPlayerDriver.h"
22
23#include "NuPlayer.h"
24
25#include <media/stagefright/foundation/ALooper.h>
26
27namespace android {
28
29NuPlayerDriver::NuPlayerDriver()
30    : mLooper(new ALooper) {
31    mLooper->setName("NuPlayerDriver Looper");
32
33    mLooper->start(
34            false, /* runOnCallingThread */
35            true,  /* canCallJava */
36            PRIORITY_AUDIO);
37
38    mPlayer = new NuPlayer;
39    mLooper->registerHandler(mPlayer);
40
41    mPlayer->setListener(this);
42}
43
44NuPlayerDriver::~NuPlayerDriver() {
45    mLooper->stop();
46}
47
48status_t NuPlayerDriver::initCheck() {
49    return OK;
50}
51
52status_t NuPlayerDriver::setDataSource(
53        const char *url, const KeyedVector<String8, String8> *headers) {
54    return INVALID_OPERATION;
55}
56
57status_t NuPlayerDriver::setDataSource(int fd, int64_t offset, int64_t length) {
58    return INVALID_OPERATION;
59}
60
61status_t NuPlayerDriver::setDataSource(const sp<IStreamSource> &source) {
62    mPlayer->setDataSource(source);
63
64    return OK;
65}
66
67status_t NuPlayerDriver::setVideoSurface(const sp<Surface> &surface) {
68    mPlayer->setVideoSurface(surface);
69
70    return OK;
71}
72
73status_t NuPlayerDriver::prepare() {
74    return OK;
75}
76
77status_t NuPlayerDriver::prepareAsync() {
78    return OK;
79}
80
81status_t NuPlayerDriver::start() {
82    mPlayer->start();
83
84    return OK;
85}
86
87status_t NuPlayerDriver::stop() {
88    return OK;
89}
90
91status_t NuPlayerDriver::pause() {
92    return OK;
93}
94
95bool NuPlayerDriver::isPlaying() {
96    return false;
97}
98
99status_t NuPlayerDriver::seekTo(int msec) {
100    return INVALID_OPERATION;
101}
102
103status_t NuPlayerDriver::getCurrentPosition(int *msec) {
104    return INVALID_OPERATION;
105}
106
107status_t NuPlayerDriver::getDuration(int *msec) {
108    return INVALID_OPERATION;
109}
110
111status_t NuPlayerDriver::reset() {
112    return OK;
113}
114
115status_t NuPlayerDriver::setLooping(int loop) {
116    return INVALID_OPERATION;
117}
118
119player_type NuPlayerDriver::playerType() {
120    return NU_PLAYER;
121}
122
123status_t NuPlayerDriver::invoke(const Parcel &request, Parcel *reply) {
124    return INVALID_OPERATION;
125}
126
127void NuPlayerDriver::setAudioSink(const sp<AudioSink> &audioSink) {
128    mPlayer->setAudioSink(audioSink);
129}
130
131status_t NuPlayerDriver::getMetadata(
132        const media::Metadata::Filter& ids, Parcel *records) {
133    return INVALID_OPERATION;
134}
135
136}  // namespace android
137