diff options
author | Paul Gilbert | 2017-06-25 20:48:12 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-06-25 20:48:12 -0400 |
commit | 680b6686145e2fff9a15b37e22093f9965817ce2 (patch) | |
tree | 471b1dc5da6f1ebcfac028514090e651c082b521 /video | |
parent | 6febe656f8c797ce00207c9812be8caf5edf782d (diff) | |
download | scummvm-rg350-680b6686145e2fff9a15b37e22093f9965817ce2.tar.gz scummvm-rg350-680b6686145e2fff9a15b37e22093f9965817ce2.tar.bz2 scummvm-rg350-680b6686145e2fff9a15b37e22093f9965817ce2.zip |
VIDEO: Fix transparency track seeking in AVIDecoder
Diffstat (limited to 'video')
-rw-r--r-- | video/avi_decoder.cpp | 11 | ||||
-rw-r--r-- | video/avi_decoder.h | 12 |
2 files changed, 18 insertions, 5 deletions
diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index ae30ec0636..9f97ffd5c8 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -717,10 +717,6 @@ bool AVIDecoder::seekIntern(const Audio::Timestamp &time) { // Update any secondary video track for transparencies if (_videoTracks.size() == 2) { - // Set it's frame number - AVIVideoTrack *videoTrack2 = static_cast<AVIVideoTrack *>(_videoTracks.back().track); - videoTrack2->setCurFrame((int)frame - 1); - // Find the index entry for the frame int indexFrame = frame; OldIndex *entry = nullptr; @@ -729,6 +725,10 @@ bool AVIDecoder::seekIntern(const Audio::Timestamp &time) { } while (!entry && indexFrame-- > 0); assert(entry); + // Set it's frame number + AVIVideoTrack *videoTrack2 = static_cast<AVIVideoTrack *>(_videoTracks.back().track); + videoTrack2->setCurFrame(indexFrame - 1); + // Read in the frame Common::SeekableReadStream *chunk = nullptr; _fileStream->seek(entry->offset + 8); @@ -746,6 +746,9 @@ bool AVIDecoder::seekIntern(const Audio::Timestamp &time) { handleNextPacket(status); } } + + videoTrack2->setCurFrame((int)frame - 1); + videoTrack2->setFrameRate(videoTrack->getFrameRate()); } // Set the video track's frame diff --git a/video/avi_decoder.h b/video/avi_decoder.h index cc5c2c4d42..541c73e068 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -229,9 +229,19 @@ protected: * Returns true if at the end of the video track */ virtual bool endOfTrack() const; - protected: + + /** + * Get track frame rate + */ Common::Rational getFrameRate() const { return Common::Rational(_vidsHeader.rate, _vidsHeader.scale); } + /** + * Force sets a new frame rate + */ + void setFrameRate(const Common::Rational &r) { + _vidsHeader.rate = r.getNumerator(); + _vidsHeader.scale = r.getDenominator(); + } private: AVIStreamHeader _vidsHeader; BitmapInfoHeader _bmInfo; |