/* * Copyright (c) Hisilicon Technologies Co., Ltd.. 2016-2019. All rights reserved. * Description: bootvideo player head file */ #ifndef BOOTVIDEO_PLAYER_H #define BOOTVIDEO_PLAYER_H #include #include #include #include #include namespace android { enum RotationDegree { // screen rotation DEGREE_0 = 0, DEGREE_90, DEGREE_180, DEGREE_270 }; class BootvideoClient : public BnMediaPlayerClient { public: friend class BootvideoPlayer; BootvideoClient(); ~BootvideoClient(); bool IsComplete() const; bool IsError() const; bool WaitForPrepared() const; bool WaitForFirstFrame() const; void ForceStop(); virtual void notify(int msg, int ext1 __unused, int ext2 __unused, const Parcel *obj __unused); protected: // media info msg: msg = 200 // android native msg: reference media_info_type enum int the mediaplayer.h file static const int MEDIA_INFO_NOT_SUPPORT = 1004; // media not support static const int MEDIA_INFO_FIRST_FRAME_TIME = 1010; // The Fist frame time static const int MEDIA_INFO_STREAM_IFRAME_ERROR = 1012; // i frame decoding error, Does not affect the play // player extension msg: reference PlayerEventType enum in the MediaDefine.h file static const int MEDIA_INFO_UNKNOWN = 1; // media info unkown static const int MEDIA_INFO_RENDERING_START = 3; // The Fist frame start rendering static const int MEDIA_INFO_PLAY_AUDIO_ERROR = 804; // Audio can not be played static const int MEDIA_INFO_PLAY_VIDEO_ERROR = 805; // Video can not be played static const int MEDIA_INFO_TIMED_TEXT_ERROR = 900; // Text can not be played static const int MEDIA_INFO_FIRST_AUDIO_FRAME = 5011; // The First audio frame start decode private: bool isPrepared; bool isFirstFrame; bool isComplete; bool isError; bool isForceStop; DISALLOW_EVIL_CONSTRUCTORS(BootvideoClient); }; class BootvideoPlayer : public RefBase { public: BootvideoPlayer(); ~BootvideoPlayer(); bool IsPlayEnd() const; bool IsPlayFail() const; bool InitPlay(); bool StartPlay(int volme); bool StopPlay(); bool SetVolume(int mute, int volume) const; bool SetDataSource(std::string path); bool SetSideBand(const sp& bufferProducer) const; bool GetPlayTimeInfo(int& currentMsec, int& durationMsec) const; private: int fd; std::string bootvideoPath; sp client; sp player; }; }; // namespace android #endif