2008-11-15 02:31:11 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 17:47:58 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2014-02-18 01:34:27 +00:00
|
|
|
*
|
2008-11-15 02:31:11 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:27 +00:00
|
|
|
*
|
2008-11-15 02:31:11 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 17:47:58 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-11-15 02:31:11 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-23 17:37:17 +00:00
|
|
|
#ifndef VIDEO_FLICDECODER_H
|
|
|
|
#define VIDEO_FLICDECODER_H
|
2008-11-15 02:31:11 +00:00
|
|
|
|
2011-01-23 17:37:17 +00:00
|
|
|
#include "video/video_decoder.h"
|
2008-11-15 02:31:11 +00:00
|
|
|
#include "common/list.h"
|
2011-05-01 15:47:29 +00:00
|
|
|
#include "common/rect.h"
|
2009-01-07 23:36:41 +00:00
|
|
|
|
|
|
|
namespace Common {
|
2011-04-25 19:29:26 +00:00
|
|
|
class SeekableReadStream;
|
2009-01-07 23:36:41 +00:00
|
|
|
}
|
2008-11-15 02:31:11 +00:00
|
|
|
|
2012-08-12 12:43:32 +00:00
|
|
|
namespace Graphics {
|
|
|
|
struct PixelFormat;
|
|
|
|
struct Surface;
|
|
|
|
}
|
|
|
|
|
2011-01-23 19:08:09 +00:00
|
|
|
namespace Video {
|
2008-11-15 02:31:11 +00:00
|
|
|
|
2009-11-24 22:08:34 +00:00
|
|
|
/**
|
2009-11-25 08:07:20 +00:00
|
|
|
* Decoder for FLIC videos.
|
2011-01-23 01:27:40 +00:00
|
|
|
*
|
2009-11-24 22:08:34 +00:00
|
|
|
* Video decoder used in engines:
|
2016-10-02 21:18:39 +00:00
|
|
|
* - chewy
|
2020-06-15 19:47:25 +00:00
|
|
|
* - petka
|
2018-05-17 17:52:15 +00:00
|
|
|
* - prince
|
2009-11-24 22:08:34 +00:00
|
|
|
* - tucker
|
|
|
|
*/
|
2012-08-16 18:00:14 +00:00
|
|
|
class FlicDecoder : public VideoDecoder {
|
2008-11-15 02:31:11 +00:00
|
|
|
public:
|
2009-05-17 08:44:20 +00:00
|
|
|
FlicDecoder();
|
|
|
|
virtual ~FlicDecoder();
|
2009-01-05 15:10:13 +00:00
|
|
|
|
2016-10-02 21:18:39 +00:00
|
|
|
virtual bool loadStream(Common::SeekableReadStream *stream);
|
2009-01-05 17:05:50 +00:00
|
|
|
|
2012-08-12 12:43:32 +00:00
|
|
|
const Common::List<Common::Rect> *getDirtyRects() const;
|
|
|
|
void clearDirtyRects();
|
|
|
|
void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
|
2010-05-18 14:17:24 +00:00
|
|
|
|
2016-10-02 21:18:39 +00:00
|
|
|
protected:
|
2012-08-12 12:43:32 +00:00
|
|
|
class FlicVideoTrack : public VideoTrack {
|
|
|
|
public:
|
2016-10-02 21:18:39 +00:00
|
|
|
FlicVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader = false);
|
2012-08-12 12:43:32 +00:00
|
|
|
~FlicVideoTrack();
|
|
|
|
|
2016-10-02 21:18:39 +00:00
|
|
|
virtual void readHeader();
|
|
|
|
|
2012-08-12 12:43:32 +00:00
|
|
|
bool endOfTrack() const;
|
2016-10-02 21:18:39 +00:00
|
|
|
virtual bool isRewindable() const { return true; }
|
|
|
|
virtual bool rewind();
|
2012-08-12 12:43:32 +00:00
|
|
|
|
|
|
|
uint16 getWidth() const;
|
|
|
|
uint16 getHeight() const;
|
|
|
|
Graphics::PixelFormat getPixelFormat() const;
|
|
|
|
int getCurFrame() const { return _curFrame; }
|
|
|
|
int getFrameCount() const { return _frameCount; }
|
|
|
|
uint32 getNextFrameStartTime() const { return _nextFrameStartTime; }
|
2016-10-02 21:18:39 +00:00
|
|
|
virtual const Graphics::Surface *decodeNextFrame();
|
|
|
|
virtual void handleFrame();
|
2012-08-12 12:43:32 +00:00
|
|
|
const byte *getPalette() const { _dirtyPalette = false; return _palette; }
|
|
|
|
bool hasDirtyPalette() const { return _dirtyPalette; }
|
|
|
|
|
|
|
|
const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
|
|
|
|
void clearDirtyRects() { _dirtyRects.clear(); }
|
|
|
|
void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
|
|
|
|
|
2016-10-02 21:18:39 +00:00
|
|
|
protected:
|
2012-08-12 12:43:32 +00:00
|
|
|
Common::SeekableReadStream *_fileStream;
|
|
|
|
Graphics::Surface *_surface;
|
|
|
|
|
|
|
|
int _curFrame;
|
|
|
|
bool _atRingFrame;
|
|
|
|
|
2018-06-29 10:41:44 +00:00
|
|
|
uint32 _offsetFrame1;
|
|
|
|
uint32 _offsetFrame2;
|
2012-08-12 12:43:32 +00:00
|
|
|
byte *_palette;
|
|
|
|
mutable bool _dirtyPalette;
|
|
|
|
|
|
|
|
uint32 _frameCount;
|
|
|
|
uint32 _frameDelay, _startFrameDelay;
|
|
|
|
uint32 _nextFrameStartTime;
|
|
|
|
|
|
|
|
Common::List<Common::Rect> _dirtyRects;
|
|
|
|
|
2012-12-26 02:39:54 +00:00
|
|
|
void copyFrame(uint8 *data);
|
2012-08-12 12:43:32 +00:00
|
|
|
void decodeByteRun(uint8 *data);
|
|
|
|
void decodeDeltaFLC(uint8 *data);
|
|
|
|
void unpackPalette(uint8 *mem);
|
|
|
|
};
|
2008-11-15 02:31:11 +00:00
|
|
|
};
|
|
|
|
|
2011-01-23 19:08:09 +00:00
|
|
|
} // End of namespace Video
|
2008-11-15 02:31:11 +00:00
|
|
|
|
|
|
|
#endif
|