You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.6 KiB
80 lines
2.6 KiB
4 months ago
|
/*
|
||
|
* 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 <string>
|
||
|
|
||
|
#include <binder/ProcessState.h>
|
||
|
#include <binder/IServiceManager.h>
|
||
|
#include <media/mediaplayer.h>
|
||
|
#include <media/stagefright/MediaSource.h>
|
||
|
|
||
|
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<IGraphicBufferProducer>& bufferProducer) const;
|
||
|
bool GetPlayTimeInfo(int& currentMsec, int& durationMsec) const;
|
||
|
private:
|
||
|
int fd;
|
||
|
std::string bootvideoPath;
|
||
|
sp<BootvideoClient> client;
|
||
|
sp<IMediaPlayer> player;
|
||
|
};
|
||
|
}; // namespace android
|
||
|
|
||
|
#endif
|