diff options
author | Filippos Karapetis | 2009-01-11 03:34:50 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-01-11 03:34:50 +0000 |
commit | 0b4dd7c4593587355c1965eb0d266040c83f0382 (patch) | |
tree | c9f6b62c14ba25ccbdf5e8773d5c4e0dc367b7ea /graphics/video/video_player.h | |
parent | 08c71e39490590125645215ce65fdcb71f11fae6 (diff) | |
download | scummvm-rg350-0b4dd7c4593587355c1965eb0d266040c83f0382.tar.gz scummvm-rg350-0b4dd7c4593587355c1965eb0d266040c83f0382.tar.bz2 scummvm-rg350-0b4dd7c4593587355c1965eb0d266040c83f0382.zip |
Committed a modified version of wjp's patch for the video player:
- Split the video player from the video decoders. It's now possible to have one video player for multiple decoders
- Added the palette weight calculation from the BS1 engine into VideoPlayer::setPalette. It's now possible to find the values of the white and black colors via getWhite() and getBlack() (useful for subtitle overlays)
- Adapted FTA2's movie playing code to the new changes to video player
- Fixed a slight bug in the DXA decoder (_videoinfo.startTime was not initialized)
svn-id: r35816
Diffstat (limited to 'graphics/video/video_player.h')
-rw-r--r-- | graphics/video/video_player.h | 68 |
1 files changed, 45 insertions, 23 deletions
diff --git a/graphics/video/video_player.h b/graphics/video/video_player.h index 4a44349552..a32996df75 100644 --- a/graphics/video/video_player.h +++ b/graphics/video/video_player.h @@ -39,10 +39,10 @@ namespace Graphics { /** * Implementation of a generic video decoder */ -class VideoPlayer { +class VideoDecoder { public: - VideoPlayer(); - virtual ~VideoPlayer(); + VideoDecoder(); + virtual ~VideoDecoder(); /** * Returns the width of the video @@ -98,12 +98,12 @@ public: * Load a video file * @param filename the filename to load */ - virtual bool loadFile(const char *filename); + virtual bool loadFile(const char *filename) = 0; /** * Close a video file */ - virtual void closeFile(); + virtual void closeFile()=0; /** * Returns if a video file is loaded or not @@ -117,6 +117,16 @@ public: virtual void setPalette(byte *pal); /** + * Return the black palette color for the current frame + */ + byte getBlack() { return _black; } + + /** + * Return the white palette color for the current frame + */ + byte getWhite() { return _white; } + + /** * Copy current frame into the specified position of the destination * buffer. * @param dst the buffer @@ -127,24 +137,9 @@ public: void copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch); /** - * Decode the next frame - */ - virtual bool decodeNextFrame(); - - /** - * A default implementation of a video player - * Plays a non-interactive full screen video till it's stopped by a - * specific event - * @param filename the name of the file to play - * @param stopEvents a list of events that can stop the video + * Decode the next frame to _videoFrameBuffer */ - bool playVideo(const char *filename, Common::List<Common::Event> *stopEvents); - - /** - * Perform postprocessing once the frame data is copied to the screen, - * right before the frame is drawn. Called from playVideo() - */ - virtual void performPostProcessing(byte *screen); + virtual bool decodeNextFrame() = 0; protected: struct { @@ -157,11 +152,38 @@ protected: uint32 startTime; } _videoInfo; + byte _black, _white; + Common::SeekableReadStream *_fileStream; byte *_videoFrameBuffer; +}; + +class VideoPlayer { +public: + VideoPlayer(VideoDecoder* decoder) : _skipVideo(false), _decoder(decoder) + { } + ~VideoPlayer() { } + /** + * A default implementation of a video player + * Plays a non-interactive full screen video till it's stopped by a + * specific event + * @param filename the name of the file to play + * @param stopEvents a list of events that can stop the video + * + * Returns true if the video was played to the end, false if skipped + */ + bool playVideo(Common::List<Common::Event> *stopEvents); + +protected: + /** + * Perform postprocessing once the frame data is copied to the screen, + * right before the frame is drawn. Called by playVideo() + */ + virtual void performPostProcessing(byte *screen); + bool _skipVideo; + VideoDecoder* _decoder; -private: void processVideoEvents(Common::List<Common::Event> *stopEvents); }; |