PageRenderTime 37ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/engines/sci/video/seq_decoder.h

http://github.com/scummvm/scummvm
C Header | 90 lines | 50 code | 16 blank | 24 comment | 0 complexity | 241a9103cce8b1e7f25653484c542ea2 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, GPL-2.0
  1. /* ScummVM - Graphic Adventure Engine
  2. *
  3. * ScummVM is the legal property of its developers, whose names
  4. * are too numerous to list here. Please refer to the COPYRIGHT
  5. * file distributed with this source distribution.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  20. *
  21. */
  22. #ifndef SCI_VIDEO_SEQ_DECODER_H
  23. #define SCI_VIDEO_SEQ_DECODER_H
  24. #include "common/rational.h"
  25. #include "graphics/pixelformat.h"
  26. #include "video/video_decoder.h"
  27. namespace Common {
  28. class SeekableReadStream;
  29. }
  30. namespace Graphics {
  31. struct Surface;
  32. }
  33. namespace Sci {
  34. /**
  35. * Implementation of the Sierra SEQ decoder, used in KQ6 DOS floppy/CD and GK1 DOS
  36. */
  37. class SEQDecoder : public Video::VideoDecoder {
  38. public:
  39. SEQDecoder(uint frameDelay);
  40. ~SEQDecoder() override;
  41. bool loadStream(Common::SeekableReadStream *stream) override;
  42. private:
  43. class SEQVideoTrack : public FixedRateVideoTrack {
  44. public:
  45. SEQVideoTrack(Common::SeekableReadStream *stream, uint frameDelay);
  46. ~SEQVideoTrack() override;
  47. uint16 getWidth() const override { return SEQ_SCREEN_WIDTH; }
  48. uint16 getHeight() const override { return SEQ_SCREEN_HEIGHT; }
  49. Graphics::PixelFormat getPixelFormat() const override { return Graphics::PixelFormat::createFormatCLUT8(); }
  50. int getCurFrame() const override { return _curFrame; }
  51. int getFrameCount() const override { return _frameCount; }
  52. const Graphics::Surface *decodeNextFrame() override;
  53. const byte *getPalette() const override;
  54. bool hasDirtyPalette() const override { return _dirtyPalette; }
  55. protected:
  56. Common::Rational getFrameRate() const override { return Common::Rational(60, _frameDelay); }
  57. private:
  58. enum {
  59. SEQ_SCREEN_WIDTH = 320,
  60. SEQ_SCREEN_HEIGHT = 200
  61. };
  62. void readPaletteChunk(uint16 chunkSize);
  63. bool decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey);
  64. Common::SeekableReadStream *_fileStream;
  65. int _curFrame, _frameCount;
  66. byte _palette[256 * 3];
  67. mutable bool _dirtyPalette;
  68. Graphics::Surface *_surface;
  69. uint _frameDelay;
  70. };
  71. uint _frameDelay;
  72. };
  73. } // End of namespace Sci
  74. #endif