2007-05-30 21:56:52 +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.
|
2006-06-28 14:06:54 +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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-23 17:37:17 +00:00
|
|
|
#ifndef VIDEO_DXA_DECODER_H
|
|
|
|
#define VIDEO_DXA_DECODER_H
|
2006-06-28 14:06:54 +00:00
|
|
|
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "common/rational.h"
|
|
|
|
#include "graphics/pixelformat.h"
|
2011-01-23 17:37:17 +00:00
|
|
|
#include "video/video_decoder.h"
|
2006-06-28 14:06:54 +00:00
|
|
|
|
2011-04-24 08:34:27 +00:00
|
|
|
namespace Common {
|
|
|
|
class SeekableReadStream;
|
|
|
|
}
|
|
|
|
|
2011-01-23 19:08:09 +00:00
|
|
|
namespace Video {
|
2006-12-11 06:53:46 +00:00
|
|
|
|
2009-11-24 22:08:34 +00:00
|
|
|
/**
|
|
|
|
* Decoder for DXA videos.
|
|
|
|
*
|
|
|
|
* Video decoder used in engines:
|
|
|
|
* - agos
|
|
|
|
* - sword1
|
|
|
|
* - sword2
|
|
|
|
*/
|
2010-05-18 14:17:24 +00:00
|
|
|
class DXADecoder : public FixedRateVideoDecoder {
|
2006-06-28 14:06:54 +00:00
|
|
|
public:
|
2009-03-09 03:45:23 +00:00
|
|
|
DXADecoder();
|
|
|
|
virtual ~DXADecoder();
|
2006-06-28 14:06:54 +00:00
|
|
|
|
2011-02-07 17:54:16 +00:00
|
|
|
bool loadStream(Common::SeekableReadStream *stream);
|
2010-05-18 14:17:24 +00:00
|
|
|
void close();
|
2010-07-21 18:17:51 +00:00
|
|
|
|
2010-05-18 14:17:24 +00:00
|
|
|
bool isVideoLoaded() const { return _fileStream != 0; }
|
|
|
|
uint16 getWidth() const { return _width; }
|
|
|
|
uint16 getHeight() const { return _height; }
|
|
|
|
uint32 getFrameCount() const { return _frameCount; }
|
2011-01-23 19:08:09 +00:00
|
|
|
const Graphics::Surface *decodeNextFrame();
|
|
|
|
Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); }
|
2010-12-16 01:41:11 +00:00
|
|
|
const byte *getPalette() { _dirtyPalette = false; return _palette; }
|
2010-05-18 14:17:24 +00:00
|
|
|
bool hasDirtyPalette() const { return _dirtyPalette; }
|
2006-06-28 14:06:54 +00:00
|
|
|
|
2009-05-20 10:43:18 +00:00
|
|
|
/**
|
|
|
|
* Get the sound chunk tag of the loaded DXA file
|
|
|
|
*/
|
|
|
|
uint32 getSoundTag() { return _soundTag; }
|
|
|
|
|
2010-05-18 14:17:24 +00:00
|
|
|
protected:
|
|
|
|
Common::Rational getFrameRate() const { return _frameRate; }
|
|
|
|
|
|
|
|
Common::SeekableReadStream *_fileStream;
|
|
|
|
|
2009-01-07 21:19:00 +00:00
|
|
|
private:
|
2006-06-28 14:06:54 +00:00
|
|
|
void decodeZlib(byte *data, int size, int totalSize);
|
2007-07-12 18:21:46 +00:00
|
|
|
void decode12(int size);
|
|
|
|
void decode13(int size);
|
2008-12-15 13:10:08 +00:00
|
|
|
|
2009-01-07 21:19:00 +00:00
|
|
|
enum ScaleMode {
|
|
|
|
S_NONE,
|
|
|
|
S_INTERLACED,
|
|
|
|
S_DOUBLE
|
|
|
|
};
|
2009-01-06 17:44:41 +00:00
|
|
|
|
2010-05-18 14:17:24 +00:00
|
|
|
Graphics::Surface *_surface;
|
|
|
|
byte _palette[256 * 3];
|
|
|
|
bool _dirtyPalette;
|
|
|
|
|
2009-01-06 17:44:41 +00:00
|
|
|
byte *_frameBuffer1;
|
|
|
|
byte *_frameBuffer2;
|
|
|
|
byte *_scaledBuffer;
|
|
|
|
byte *_inBuffer;
|
|
|
|
uint32 _inBufferSize;
|
|
|
|
byte *_decompBuffer;
|
|
|
|
uint32 _decompBufferSize;
|
2009-01-07 21:19:00 +00:00
|
|
|
uint16 _curHeight;
|
2009-01-06 17:44:41 +00:00
|
|
|
uint32 _frameSize;
|
|
|
|
ScaleMode _scaleMode;
|
2009-05-20 10:43:18 +00:00
|
|
|
uint32 _soundTag;
|
2010-05-18 14:17:24 +00:00
|
|
|
uint16 _width, _height;
|
|
|
|
uint32 _frameRate;
|
|
|
|
uint32 _frameCount;
|
2006-06-28 14:06:54 +00:00
|
|
|
};
|
2007-07-12 18:21:46 +00:00
|
|
|
|
2011-01-23 19:08:09 +00:00
|
|
|
} // End of namespace Video
|
2006-06-28 14:06:54 +00:00
|
|
|
|
|
|
|
#endif
|