AGS: Skip videos with unsupported video tracks rather than erroring

This commit is contained in:
Paul Gilbert 2021-09-22 21:23:13 -07:00
parent c924c3e84e
commit d9ed62041d
4 changed files with 12 additions and 7 deletions

View file

@ -48,9 +48,6 @@ void scrPlayVideo(const char *name, int skip, int flags) {
return; return;
if (_G(debug_flags) & DBG_NOVIDEO) if (_G(debug_flags) & DBG_NOVIDEO)
return; return;
// FIXME: Stargate Adventure videos used unsupported ix00 & ix01 audio tracks
if (::AGS::g_vm->getGameId() == "stargateadv")
return;
if ((flags < 10) && (_GP(usetup).audio_backend == 0)) { if ((flags < 10) && (_GP(usetup).audio_backend == 0)) {
// if game audio is disabled in Setup, then don't // if game audio is disabled in Setup, then don't

View file

@ -64,9 +64,7 @@ static bool play_video(Video::VideoDecoder *decoder, const char *name, int skip,
AGS::Shared::ScummVMReadStream *stream = new AGS::Shared::ScummVMReadStream(video_stream.get(), DisposeAfterUse::NO); AGS::Shared::ScummVMReadStream *stream = new AGS::Shared::ScummVMReadStream(video_stream.get(), DisposeAfterUse::NO);
if (!decoder->loadStream(stream)) { if (!decoder->loadStream(stream)) {
delete stream; warning("Unable to decode video '%s'", name);
if (showError)
Display("Unable to decode video '%s'", name);
return false; return false;
} }

View file

@ -347,7 +347,11 @@ void AVIDecoder::handleStreamHeader(uint32 size) {
} }
} }
addTrack(new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette)); AVIVideoTrack *track = new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette);
if (track->isValid())
addTrack(track);
else
delete track;
} else if (sHeader.streamType == ID_AUDS) { } else if (sHeader.streamType == ID_AUDS) {
PCMWaveFormat wvInfo; PCMWaveFormat wvInfo;
wvInfo.tag = _fileStream->readUint16LE(); wvInfo.tag = _fileStream->readUint16LE();
@ -443,6 +447,11 @@ bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) {
while (_fileStream->pos() < fileSize && parseNextChunk()) while (_fileStream->pos() < fileSize && parseNextChunk())
; ;
if (_decodedHeader) {
// Ensure there's at least a supported video track
_decodedHeader = findNextVideoTrack() != nullptr;
}
if (!_decodedHeader) { if (!_decodedHeader) {
warning("Failed to parse AVI header"); warning("Failed to parse AVI header");
close(); close();

View file

@ -225,6 +225,7 @@ protected:
void useInitialPalette(); void useInitialPalette();
bool canDither() const; bool canDither() const;
void setDither(const byte *palette); void setDither(const byte *palette);
bool isValid() const { return _videoCodec != nullptr; }
bool isTruemotion1() const; bool isTruemotion1() const;
void forceDimensions(uint16 width, uint16 height); void forceDimensions(uint16 width, uint16 height);