1/* 2** 3** Copyright 2009, The Android Open Source Project 4** 5** Licensed under the Apache License, Version 2.0 (the "License"); 6** you may not use this file except in compliance with the License. 7** You may obtain a copy of the License at 8** 9** http://www.apache.org/licenses/LICENSE-2.0 10** 11** Unless required by applicable law or agreed to in writing, software 12** distributed under the License is distributed on an "AS IS" BASIS, 13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14** See the License for the specific language governing permissions and 15** limitations under the License. 16*/ 17 18#ifndef ANDROID_STAGEFRIGHTPLAYER_H 19#define ANDROID_STAGEFRIGHTPLAYER_H 20 21#include <media/MediaPlayerInterface.h> 22 23namespace android { 24 25struct AwesomePlayer; 26 27class StagefrightPlayer : public MediaPlayerInterface { 28public: 29 StagefrightPlayer(); 30 virtual ~StagefrightPlayer(); 31 32 virtual status_t initCheck(); 33 34 virtual status_t setUID(uid_t uid); 35 36 virtual status_t setDataSource( 37 const sp<IMediaHTTPService> &httpService, 38 const char *url, 39 const KeyedVector<String8, String8> *headers); 40 41 virtual status_t setDataSource(int fd, int64_t offset, int64_t length); 42 43 virtual status_t setDataSource(const sp<IStreamSource> &source); 44 45 virtual status_t setVideoSurfaceTexture( 46 const sp<IGraphicBufferProducer> &bufferProducer); 47 virtual status_t prepare(); 48 virtual status_t prepareAsync(); 49 virtual status_t start(); 50 virtual status_t stop(); 51 virtual status_t pause(); 52 virtual bool isPlaying(); 53 virtual status_t seekTo(int msec); 54 virtual status_t getCurrentPosition(int *msec); 55 virtual status_t getDuration(int *msec); 56 virtual status_t reset(); 57 virtual status_t setLooping(int loop); 58 virtual player_type playerType(); 59 virtual status_t invoke(const Parcel &request, Parcel *reply); 60 virtual void setAudioSink(const sp<AudioSink> &audioSink); 61 virtual status_t setParameter(int key, const Parcel &request); 62 virtual status_t getParameter(int key, Parcel *reply); 63 virtual status_t setPlaybackSettings(const AudioPlaybackRate &rate); 64 virtual status_t getPlaybackSettings(AudioPlaybackRate *rate /* nonnull */); 65 66 virtual status_t getMetadata( 67 const media::Metadata::Filter& ids, Parcel *records); 68 69 virtual status_t dump(int fd, const Vector<String16> &args) const; 70 71private: 72 AwesomePlayer *mPlayer; 73 74 StagefrightPlayer(const StagefrightPlayer &); 75 StagefrightPlayer &operator=(const StagefrightPlayer &); 76}; 77 78} // namespace android 79 80#endif // ANDROID_STAGEFRIGHTPLAYER_H 81