aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorPaul Gilbert2016-12-29 16:54:13 -0500
committerPaul Gilbert2016-12-29 16:54:13 -0500
commit2e8c80cf58e03ad735a5b147f11d31f07e49e33a (patch)
tree58ea01976fe591b857f3215aecf235e5bf4cfce7 /video
parent766acba8ed5580692e11c89aa0eab6b2391d4c44 (diff)
downloadscummvm-rg350-2e8c80cf58e03ad735a5b147f11d31f07e49e33a.tar.gz
scummvm-rg350-2e8c80cf58e03ad735a5b147f11d31f07e49e33a.tar.bz2
scummvm-rg350-2e8c80cf58e03ad735a5b147f11d31f07e49e33a.zip
VIDEO: Add support for AVI 2-track videos with missing track 2 indexes
Diffstat (limited to 'video')
-rw-r--r--video/avi_decoder.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
index fc73cfaeac..c2c485c1eb 100644
--- a/video/avi_decoder.cpp
+++ b/video/avi_decoder.cpp
@@ -721,18 +721,31 @@ bool AVIDecoder::seekIntern(const Audio::Timestamp &time) {
AVIVideoTrack *videoTrack2 = static_cast<AVIVideoTrack *>(_videoTracks.back().track);
videoTrack2->setCurFrame((int)frame - 1);
- // Find the index entry for the frame and read it in
- OldIndex *entry = _indexEntries.find(_videoTracks.back().index, frame);
+ // Find the index entry for the frame
+ int indexFrame = frame;
+ OldIndex *entry = nullptr;
+ do {
+ entry = _indexEntries.find(_videoTracks.back().index, indexFrame);
+ } while (!entry && --indexFrame >= 0);
assert(entry);
+ // Read in the frame
Common::SeekableReadStream *chunk = nullptr;
_fileStream->seek(entry->offset + 8);
_videoTracks.back().chunkSearchOffset = entry->offset;
if (entry->size != 0)
chunk = _fileStream->readStream(entry->size);
-
videoTrack2->decodeFrame(chunk);
+
+ if (indexFrame < frame) {
+ TrackStatus &status = _videoTracks.back();
+ while (indexFrame++ < frame) {
+ // There was no index entry for the desired frame, so an earlier one was decoded.
+ // We now have to sequentially decode frames until we get to the desired frame
+ handleNextPacket(status);
+ }
+ }
}
// Set the video track's frame