diff options
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; |