blob: 5f302ed8c4cdfcb62c6bd8e68483e2e8df2b8452 [file] [log] [blame]
The Android Open Source Project54b6cfa2008-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();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070044 virtual status_t seekTo(int msec);
45 virtual status_t getCurrentPosition(int *msec);
46 virtual status_t getDuration(int *msec);
47 virtual status_t reset();
48 virtual status_t setLooping(int loop);
49 virtual player_type playerType() { return PV_PLAYER; }
50
51 // make available to PlayerDriver
52 void sendEvent(int msg, int ext1=0, int ext2=0) { MediaPlayerBase::sendEvent(msg, ext1, ext2); }
53
54private:
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -080055 static void do_nothing(status_t s, void *cookie, bool cancelled) { }
56 static void run_init(status_t s, void *cookie, bool cancelled);
57 static void run_set_video_surface(status_t s, void *cookie, bool cancelled);
58 static void run_set_audio_output(status_t s, void *cookie, bool cancelled);
59 static void run_prepare(status_t s, void *cookie, bool cancelled);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070060
61 PlayerDriver* mPlayerDriver;
62 char * mDataSourcePath;
63 bool mIsDataSourceSet;
64 sp<ISurface> mSurface;
65 void * mMemBase;
66 off_t mMemSize;
67 status_t mInit;
68 int mDuration;
69};
70
71}; // namespace android
72
73#endif // ANDROID_PVPLAYER_H