aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--video/avi_decoder.cpp24
-rw-r--r--video/avi_decoder.h3
2 files changed, 22 insertions, 5 deletions
diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
index 32238eca4e..ff728a8437 100644
--- a/video/avi_decoder.cpp
+++ b/video/avi_decoder.cpp
@@ -91,7 +91,20 @@ static uint16 getStreamType(uint32 tag) {
return tag & 0xffff;
}
-AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
+AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _frameRateOverride(0), _soundType(soundType) {
+ initCommon();
+}
+
+AVIDecoder::AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType)
+ : _frameRateOverride(frameRateOverride), _soundType(soundType) {
+ initCommon();
+}
+
+AVIDecoder::~AVIDecoder() {
+ close();
+}
+
+void AVIDecoder::initCommon() {
_decodedHeader = false;
_foundMovieList = false;
_fileStream = 0;
@@ -99,10 +112,6 @@ AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType
memset(&_header, 0, sizeof(_header));
}
-AVIDecoder::~AVIDecoder() {
- close();
-}
-
void AVIDecoder::runHandle(uint32 tag) {
assert(_fileStream);
if (_fileStream->eos())
@@ -214,6 +223,11 @@ void AVIDecoder::handleStreamHeader() {
uint32 startPos = _fileStream->pos();
if (sHeader.streamType == ID_VIDS) {
+ if (_frameRateOverride != 0) {
+ sHeader.rate = _frameRateOverride.getNumerator();
+ sHeader.scale = _frameRateOverride.getDenominator();
+ }
+
BitmapInfoHeader bmInfo;
bmInfo.size = _fileStream->readUint32LE();
bmInfo.width = _fileStream->readUint32LE();
diff --git a/video/avi_decoder.h b/video/avi_decoder.h
index bc870eac33..1652614bd8 100644
--- a/video/avi_decoder.h
+++ b/video/avi_decoder.h
@@ -56,6 +56,7 @@ class Codec;
class AVIDecoder : public VideoDecoder {
public:
AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
+ AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
virtual ~AVIDecoder();
bool loadStream(Common::SeekableReadStream *stream);
@@ -222,6 +223,8 @@ private:
bool _decodedHeader, _foundMovieList;
Audio::Mixer::SoundType _soundType;
+ Common::Rational _frameRateOverride;
+ void initCommon();
void runHandle(uint32 tag);
void handleList();