ScummVM API documentation
3do_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 SHERLOCK_SCALPEL_3DO_MOVIE_DECODER_H
23#define SHERLOCK_SCALPEL_3DO_MOVIE_DECODER_H
24
25#include "common/rect.h"
26#include "video/video_decoder.h"
27#include "audio/decoders/3do.h"
28
29namespace Audio {
30class QueuingAudioStream;
31}
32
33namespace Common {
34class SeekableReadStream;
35}
36
37namespace Image {
38class Codec;
39}
40
41namespace Video {
42
51public:
53 ~ThreeDOMovieDecoder() override;
54
55 bool loadStream(Common::SeekableReadStream *stream) override;
56 void close() override;
57
58protected:
59 void readNextPacket() override;
60 bool supportsAudioTrackSwitching() const override { return true; }
61 AudioTrack *getAudioTrack(int index) override;
62
63private:
64 int32 _streamVideoOffset; /* current stream offset for video decoding */
65 int32 _streamAudioOffset; /* current stream offset for audio decoding */
66
67private:
68 class StreamVideoTrack : public VideoTrack {
69 public:
70 StreamVideoTrack(uint32 width, uint32 height, uint32 codecTag, uint32 frameCount);
71 ~StreamVideoTrack() override;
72
73 bool endOfTrack() const override;
74
75 uint16 getWidth() const override { return _width; }
76 uint16 getHeight() const override { return _height; }
78 bool setOutputPixelFormat(const Graphics::PixelFormat &format) override;
79 int getCurFrame() const override { return _curFrame; }
80 int getFrameCount() const override { return _frameCount; }
81 void setNextFrameStartTime(uint32 nextFrameStartTime) { _nextFrameStartTime = nextFrameStartTime; }
82 uint32 getNextFrameStartTime() const override { return _nextFrameStartTime; }
83 const Graphics::Surface *decodeNextFrame() override { return _surface; }
84
85 void decodeFrame(Common::SeekableReadStream *stream, uint32 videoTimeStamp);
86
87 private:
88 const Graphics::Surface *_surface;
89
90 int _curFrame;
91 uint32 _frameCount;
92 uint32 _nextFrameStartTime;
93
94 Image::Codec *_codec;
95 uint16 _width, _height;
96 };
97
98 class StreamAudioTrack : public AudioTrack {
99 public:
100 StreamAudioTrack(uint32 codecTag, uint32 sampleRate, uint32 channels, Audio::Mixer::SoundType soundType, uint32 trackId);
101 ~StreamAudioTrack() override;
102
103 void queueAudio(Common::SeekableReadStream *stream, uint32 size);
104
105 bool matchesId(uint trackId);
106
107 protected:
108 Audio::AudioStream *getAudioStream() const override;
109
110 private:
111 Audio::QueuingAudioStream *_audioStream;
112 uint32 _totalAudioQueued; /* total amount of milliseconds of audio, that we queued up already */
113
114 public:
115 uint32 getTotalAudioQueued() const { return _totalAudioQueued; }
116
117 private:
118 int16 decodeSample(uint8 dataNibble);
119
120 uint32 _codecTag;
121 uint16 _sampleRate;
122 bool _stereo;
123 uint32 _trackId;
124
125 Audio::audio_3DO_ADP4_PersistentSpace _ADP4_PersistentSpace;
126 Audio::audio_3DO_SDX2_PersistentSpace _SDX2_PersistentSpace;
127 };
128
130 StreamVideoTrack *_videoTrack;
132};
133
134} // End of namespace Sherlock
135
136#endif
Definition: audiostream.h:50
SoundType
Definition: mixer.h:73
Definition: audiostream.h:370
Definition: stream.h:745
Definition: codec.h:57
Definition: 3do_decoder.h:50
bool supportsAudioTrackSwitching() const override
Definition: 3do_decoder.h:60
bool loadStream(Common::SeekableReadStream *stream) override
void readNextPacket() override
AudioTrack * getAudioTrack(int index) override
Definition: video_decoder.h:759
Definition: video_decoder.h:616
Definition: video_decoder.h:53
Graphics::PixelFormat getPixelFormat() const
virtual uint16 getHeight() const
bool setOutputPixelFormat(const Graphics::PixelFormat &format)
virtual const Graphics::Surface * decodeNextFrame()
int getCurFrame() const
uint32 getFrameCount() const
virtual uint16 getWidth() const
Definition: system.h:39
Definition: algorithm.h:29
Definition: pixelformat.h:138
Definition: surface.h:67