ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

dxa_decoder.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef VIDEO_DXA_DECODER_H
00024 #define VIDEO_DXA_DECODER_H
00025 
00026 #include "common/rational.h"
00027 #include "graphics/pixelformat.h"
00028 #include "video/video_decoder.h"
00029 
00030 namespace Common {
00031 class SeekableReadStream;
00032 }
00033 
00034 namespace Video {
00035 
00044 class DXADecoder : public VideoDecoder {
00045 public:
00046     DXADecoder();
00047     virtual ~DXADecoder();
00048 
00049     bool loadStream(Common::SeekableReadStream *stream);
00050 
00051 protected:
00055     virtual void readSoundData(Common::SeekableReadStream *stream);
00056 
00057 private:
00058     class DXAVideoTrack : public FixedRateVideoTrack {
00059     public:
00060         DXAVideoTrack(Common::SeekableReadStream *stream);
00061         ~DXAVideoTrack();
00062 
00063         bool isRewindable() const { return true; }
00064         bool rewind();
00065 
00066         uint16 getWidth() const { return _width; }
00067         uint16 getHeight() const { return _height; }
00068         Graphics::PixelFormat getPixelFormat() const;
00069         int getCurFrame() const { return _curFrame; }
00070         int getFrameCount() const { return _frameCount; }
00071         const Graphics::Surface *decodeNextFrame();
00072         const byte *getPalette() const { _dirtyPalette = false; return _palette; }
00073         bool hasDirtyPalette() const { return _dirtyPalette; }
00074 
00075         void setFrameStartPos();
00076 
00077     protected:
00078         Common::Rational getFrameRate() const { return _frameRate; }
00079 
00080     private:
00081         void decodeZlib(byte *data, int size, int totalSize);
00082         void decode12(int size);
00083         void decode13(int size);
00084 
00085         enum ScaleMode {
00086             S_NONE,
00087             S_INTERLACED,
00088             S_DOUBLE
00089         };
00090 
00091         Common::SeekableReadStream *_fileStream;
00092         Graphics::Surface *_surface;
00093 
00094         byte *_frameBuffer1;
00095         byte *_frameBuffer2;
00096         byte *_scaledBuffer;
00097         byte *_inBuffer;
00098         uint32 _inBufferSize;
00099         byte *_decompBuffer;
00100         uint32 _decompBufferSize;
00101         uint16 _curHeight;
00102         uint32 _frameSize;
00103         ScaleMode _scaleMode;
00104         uint16 _width, _height;
00105         uint32 _frameRate;
00106         uint32 _frameCount;
00107         byte _palette[256 * 3];
00108         mutable bool _dirtyPalette;
00109         int _curFrame;
00110         uint32 _frameStartOffset;
00111     };
00112 };
00113 
00114 } // End of namespace Video
00115 
00116 #endif


Generated on Sat May 25 2019 05:00:43 for ResidualVM by doxygen 1.7.1
curved edge   curved edge