The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 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> |
niko | bc72692 | 2009-07-20 15:07:26 -0700 | [diff] [blame] | 22 | #include <media/Metadata.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | |
| 24 | #define MAX_OPENCORE_INSTANCES 25 |
| 25 | |
| 26 | #ifdef MAX_OPENCORE_INSTANCES |
| 27 | #include <cutils/atomic.h> |
| 28 | #endif |
| 29 | |
| 30 | class PlayerDriver; |
| 31 | |
| 32 | namespace android { |
| 33 | |
| 34 | class PVPlayer : public MediaPlayerInterface |
| 35 | { |
| 36 | public: |
| 37 | PVPlayer(); |
| 38 | virtual ~PVPlayer(); |
| 39 | |
| 40 | virtual status_t initCheck(); |
| 41 | virtual status_t setDataSource(const char *url); |
| 42 | virtual status_t setDataSource(int fd, int64_t offset, int64_t length); |
| 43 | virtual status_t setVideoSurface(const sp<ISurface>& surface); |
| 44 | virtual status_t prepare(); |
| 45 | virtual status_t prepareAsync(); |
| 46 | virtual status_t start(); |
| 47 | virtual status_t stop(); |
| 48 | virtual status_t pause(); |
| 49 | virtual bool isPlaying(); |
| 50 | virtual status_t seekTo(int msec); |
| 51 | virtual status_t getCurrentPosition(int *msec); |
| 52 | virtual status_t getDuration(int *msec); |
| 53 | virtual status_t reset(); |
| 54 | virtual status_t setLooping(int loop); |
| 55 | virtual player_type playerType() { return PV_PLAYER; } |
Nicolas Catania | 20cb94e | 2009-05-12 23:25:55 -0700 | [diff] [blame] | 56 | virtual status_t invoke(const Parcel& request, Parcel *reply); |
niko | bc72692 | 2009-07-20 15:07:26 -0700 | [diff] [blame] | 57 | virtual status_t getMetadata( |
| 58 | const SortedVector<media::Metadata::Type>& ids, |
| 59 | Parcel *records); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | |
The Android Open Source Project | c39a6e0 | 2009-03-11 12:11:56 -0700 | [diff] [blame] | 61 | // make available to PlayerDriver |
| 62 | void sendEvent(int msg, int ext1=0, int ext2=0) { MediaPlayerBase::sendEvent(msg, ext1, ext2); } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | |
| 64 | private: |
| 65 | static void do_nothing(status_t s, void *cookie, bool cancelled) { } |
| 66 | static void run_init(status_t s, void *cookie, bool cancelled); |
| 67 | static void run_set_video_surface(status_t s, void *cookie, bool cancelled); |
| 68 | static void run_set_audio_output(status_t s, void *cookie, bool cancelled); |
| 69 | static void run_prepare(status_t s, void *cookie, bool cancelled); |
Ravi K Yenduri | b3dfca1 | 2009-06-04 15:46:53 -0500 | [diff] [blame] | 70 | static void check_for_live_streaming(status_t s, void *cookie, bool cancelled); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 71 | |
| 72 | PlayerDriver* mPlayerDriver; |
| 73 | char * mDataSourcePath; |
| 74 | bool mIsDataSourceSet; |
| 75 | sp<ISurface> mSurface; |
Jean-Baptiste Queru | b98803b | 2009-04-08 14:40:56 -0700 | [diff] [blame] | 76 | int mSharedFd; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | status_t mInit; |
| 78 | int mDuration; |
| 79 | |
| 80 | #ifdef MAX_OPENCORE_INSTANCES |
| 81 | static volatile int32_t sNumInstances; |
| 82 | #endif |
| 83 | }; |
| 84 | |
| 85 | }; // namespace android |
| 86 | |
| 87 | #endif // ANDROID_PVPLAYER_H |