bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { close(); uint32 riffTag = stream->readUint32BE(); if (riffTag != ID_RIFF) { warning("Failed to find RIFF header"); return false; } int32 fileSize = stream->readUint32LE(); uint32 riffType = stream->readUint32BE(); if (riffType != ID_AVI) { warning("RIFF not an AVI file"); return false; } _fileStream = stream; // Go through all chunks in the file while (_fileStream->pos() < fileSize && parseNextChunk()) ; if (!_decodedHeader) { warning("Failed to parse AVI header"); close(); return false; } if (!_foundMovieList) { warning("Failed to find 'MOVI' list"); close(); return false; } // Create the status entries uint32 index = 0; for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++, index++) { TrackStatus status; status.track = *it; status.index = index; status.chunkSearchOffset = _movieListStart; if ((*it)->getTrackType() == Track::kTrackTypeVideo) _videoTracks.push_back(status); else _audioTracks.push_back(status); } if (_videoTracks.size() != 1) { close(); return false; } // Check if this is a special Duck Truemotion video checkTruemotion1(); return true; }
bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { close(); uint32 riffTag = stream->readUint32BE(); if (riffTag != ID_RIFF) { warning("Failed to find RIFF header"); return false; } /* uint32 fileSize = */ stream->readUint32LE(); uint32 riffType = stream->readUint32BE(); if (riffType != ID_AVI) { warning("RIFF not an AVI file"); return false; } _fileStream = stream; // Go through all chunks in the file while (parseNextChunk()) ; if (!_decodedHeader) { warning("Failed to parse AVI header"); close(); return false; } if (!_foundMovieList) { warning("Failed to find 'MOVI' list"); close(); return false; } // Seek back to the start of the MOVI list _fileStream->seek(_movieListStart); // Check if this is a special Duck Truemotion video checkTruemotion1(); return true; }
bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { close(); uint32 riffTag = stream->readUint32BE(); if (riffTag != ID_RIFF) { warning("Failed to find RIFF header"); return false; } int32 fileSize = stream->readUint32LE(); uint32 riffType = stream->readUint32BE(); if (riffType != ID_AVI) { warning("RIFF not an AVI file"); return false; } _fileStream = stream; // Go through all chunks in the file while (_fileStream->pos() < fileSize && parseNextChunk()) ; if (!_decodedHeader) { warning("Failed to parse AVI header"); close(); return false; } if (!_foundMovieList) { warning("Failed to find 'MOVI' list"); close(); return false; } // Create the status entries uint32 index = 0; for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++, index++) { TrackStatus status; status.track = *it; status.index = index; status.chunkSearchOffset = _movieListStart; if ((*it)->getTrackType() == Track::kTrackTypeAudio) { _audioTracks.push_back(status); } else if (_videoTracks.empty()) { _videoTracks.push_back(status); } else { // Secondary video track. For now we assume it will always be a // transparency information track status.chunkSearchOffset = getVideoTrackOffset(index); assert(!_transparencyTrack.track); assert(status.chunkSearchOffset != 0); // Copy the track status information into the transparency track field _transparencyTrack = status; } } // If there is a transparency track, remove it from the video decoder's track list. // This is to stop it being included in calls like getFrameCount if (_transparencyTrack.track) eraseTrack(_transparencyTrack.track); // Check if this is a special Duck Truemotion video checkTruemotion1(); return true; }