From cdd463a37afe43b76b565a9dd405ebb57d930ca8 Mon Sep 17 00:00:00 2001 From: sluicebox <22204938+sluicebox@users.noreply.github.com> Date: Sat, 13 Nov 2021 04:07:47 -0600 Subject: [PATCH] VIDEO: Fix QuickTime decoding when color depth is 32 Color depths greater than 32 have grayscale bit 0x20 set, but the decoder incorrectly treats 32 as grayscale and and clears the bit, leaving the color depth as zero and causing codecs to fail. Confirmed correct behavior in the ffmpeg code that the decoder was based off. The decoder was introduced with the Mohawk engine in 2009,so presumably no Mohawk movies had color depth 32. Fixes videos in the Director game Virtual Cocktail Bar --- video/qt_decoder.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp index 48e7c130bc4..5022054753a 100644 --- a/video/qt_decoder.cpp +++ b/video/qt_decoder.cpp @@ -201,6 +201,8 @@ Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readSampleDesc(Common::Qu _fd->readByte(); } } + + entry->_bitsPerSample &= 0x1f; // clear grayscale bit } return entry; @@ -272,7 +274,7 @@ QuickTimeDecoder::VideoSampleDesc::~VideoSampleDesc() { } void QuickTimeDecoder::VideoSampleDesc::initCodec() { - _videoCodec = Image::createQuickTimeCodec(_codecTag, _parentTrack->width, _parentTrack->height, _bitsPerSample & 0x1f); + _videoCodec = Image::createQuickTimeCodec(_codecTag, _parentTrack->width, _parentTrack->height, _bitsPerSample); } QuickTimeDecoder::AudioTrackHandler::AudioTrackHandler(QuickTimeDecoder *decoder, QuickTimeAudioTrack *audioTrack) :