blob: 8164d8c5a462f1ab7c303325e39c0d3d3c4d6768 [file] [log] [blame]
The Android Open Source Project2729ea92008-10-21 07:00:00 -07001/*
2 * Copyright (C) 2008 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#ifndef ANDROID_PVPLAYER_H
18#define ANDROID_PVPLAYER_H
19
20#include <utils/Errors.h>
21#include <media/MediaPlayerInterface.h>
22
23class PlayerDriver;
24
25namespace android {
26
27class PVPlayer : public MediaPlayerInterface
28{
29public:
30 PVPlayer();
31 virtual ~PVPlayer();
32
33 virtual status_t initCheck();
34 virtual status_t setSigBusHandlerStructTLSKey(pthread_key_t key);
35 virtual status_t setDataSource(const char *url);
36 virtual status_t setDataSource(int fd, int64_t offset, int64_t length);
37 virtual status_t setVideoSurface(const sp<ISurface>& surface);
38 virtual status_t prepare();
39 virtual status_t prepareAsync();
40 virtual status_t start();
41 virtual status_t stop();
42 virtual status_t pause();
43 virtual bool isPlaying();
44 virtual status_t getVideoWidth(int *w);
45 virtual status_t getVideoHeight(int *h);
46 virtual status_t seekTo(int msec);
47 virtual status_t getCurrentPosition(int *msec);
48 virtual status_t getDuration(int *msec);
49 virtual status_t reset();
50 virtual status_t setLooping(int loop);
51 virtual player_type playerType() { return PV_PLAYER; }
52
53 // make available to PlayerDriver
54 void sendEvent(int msg, int ext1=0, int ext2=0) { MediaPlayerBase::sendEvent(msg, ext1, ext2); }
55
56private:
57 static void do_nothing(status_t s, void *cookie) { }
58 static void run_init(status_t s, void *cookie);
59 static void run_set_video_surface(status_t s, void *cookie);
60 static void run_set_audio_output(status_t s, void *cookie);
61 static void run_prepare(status_t s, void *cookie);
62
63 PlayerDriver* mPlayerDriver;
64 char * mDataSourcePath;
65 bool mIsDataSourceSet;
66 sp<ISurface> mSurface;
67 void * mMemBase;
68 off_t mMemSize;
69 status_t mInit;
70 int mDuration;
71};
72
73}; // namespace android
74
75#endif // ANDROID_PVPLAYER_H