ScummVM API documentation
paco_decoder.h
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 modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef VIDEO_PACODECODER_H
23#define VIDEO_PACODECODER_H
24
25#include "audio/audiostream.h"
26#include "common/list.h"
27#include "common/rect.h"
28#include "graphics/palette.h"
29#include "video/video_decoder.h"
30
31namespace Common {
32class SeekableReadStream;
33class SafeSeekableSubReadStream;
34}
35
36namespace Graphics {
37struct PixelFormat;
38struct Surface;
39} // namespace Graphics
40
41namespace Video {
42
49class PacoDecoder : public VideoDecoder {
50public:
52 virtual ~PacoDecoder();
53 void close() override;
54
55 bool loadStream(Common::SeekableReadStream *stream) override;
56
57 const Common::List<Common::Rect> *getDirtyRects() const;
58 void clearDirtyRects();
59 void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
60 const byte *getPalette();
61 void readNextPacket() override;
62
63
64protected:
66 public:
68 uint16 frameRate, uint16 frameCount, uint16 width, uint16 height);
70
71 bool endOfTrack() const override;
72 bool isRewindable() const override { return false; }
73
74 uint16 getWidth() const override;
75 uint16 getHeight() const override;
77 int getCurFrame() const override { return _curFrame; }
78 int getFrameCount() const override { return _frameCount; }
80 virtual void handleFrame(Common::SeekableReadStream *fileStream, uint32 chunkSize, int curFrame);
81 virtual void handleEOC() { _curFrame += 1; };
82 void handlePalette(Common::SeekableReadStream *fileStream);
83 const byte *getPalette() const override;
84 bool hasDirtyPalette() const override { return _dirtyPalette; }
85
86 const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
87 void clearDirtyRects() { _dirtyRects.clear(); }
88 void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
89 Common::Rational getFrameRate() const override { return Common::Rational(_frameRate, 1); }
90
91 protected:
92 Graphics::Surface *_surface;
93 Graphics::Palette _palette;
94
95 mutable bool _dirtyPalette;
96
97 int _curFrame;
98 uint32 _frameCount;
99 uint16 _frameRate;
100
101 Common::List<Common::Rect> _dirtyRects;
102 };
103
104 class PacoAudioTrack : public AudioTrack {
105 public:
106 PacoAudioTrack(int samplingRate);
108 void queueSound(Common::SeekableReadStream *fileStream, uint32 chunkSize);
109 bool needsAudio() const;
110
111 protected:
112 Audio::AudioStream *getAudioStream() const override { return _packetStream; }
113
114 private:
116 int _samplingRate;
117 };
118
119private:
120 PacoVideoTrack *_videoTrack;
121 PacoAudioTrack *_audioTrack;
122 Common::SeekableReadStream *_fileStream;
125 int _curFrame = 0;
126 int _frameSizes[65536]; // can be done differently?
127 int getAudioSamplingRate();
128};
129
130} // End of namespace Video
131
132#endif
Definition: audiostream.h:50
Definition: audiostream.h:471
void clear()
Definition: list.h:245
Definition: rational.h:40
Definition: substream.h:104
Definition: stream.h:745
Simple class for handling a palette data.
Definition: palette.h:61
Definition: paco_decoder.h:104
Audio::AudioStream * getAudioStream() const override
Definition: paco_decoder.h:112
Definition: paco_decoder.h:65
int getFrameCount() const override
Definition: paco_decoder.h:78
Common::Rational getFrameRate() const override
Definition: paco_decoder.h:89
uint16 getWidth() const override
bool isRewindable() const override
Definition: paco_decoder.h:72
Graphics::PixelFormat getPixelFormat() const override
const byte * getPalette() const override
int getCurFrame() const override
Definition: paco_decoder.h:77
uint16 getHeight() const override
bool endOfTrack() const override
bool hasDirtyPalette() const override
Definition: paco_decoder.h:84
const Graphics::Surface * decodeNextFrame() override
Definition: paco_decoder.h:49
void close() override
bool loadStream(Common::SeekableReadStream *stream) override
void readNextPacket() override
Definition: video_decoder.h:759
Definition: video_decoder.h:734
Definition: video_decoder.h:53
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: pixelformat.h:138
Definition: surface.h:67