aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2017-09-11 00:45:14 -0500
committerColin Snover2017-09-12 11:03:15 -0500
commit533bb5b257b7788b99b307381d96f8e54d9e9c75 (patch)
tree25bbe75c947ade42d81b32f23489dbba16ad102d /engines
parent2228ae255c176478225ae5ff271db323ee31b9cc (diff)
downloadscummvm-rg350-533bb5b257b7788b99b307381d96f8e54d9e9c75.tar.gz
scummvm-rg350-533bb5b257b7788b99b307381d96f8e54d9e9c75.tar.bz2
scummvm-rg350-533bb5b257b7788b99b307381d96f8e54d9e9c75.zip
SCI32: Improve chance of rendering non-8bpp AVIs
OpenGL backends don't always support the pixel format that is returned by the Indeo 3 decoder when playing the GK2A.AVI from the GK2 demo. If this happens, use the backend's preferred pixel format and convert in software. If a backend doesn't support any 16-bit or 32-bit format, the playback code will error out. This is probably fine, since there are not really any of those any more. Fixes Trac#9994.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/graphics/video32.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index c9c48eb9fd..301092bf4e 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -408,7 +408,22 @@ AVIPlayer::IOStatus AVIPlayer::init(const bool doublePixels) {
_drawRect.setHeight(height);
if (!startHQVideo() && _decoder->getPixelFormat().bytesPerPixel != 1) {
- g_sci->_gfxFrameout->setPixelFormat(_decoder->getPixelFormat());
+ const Common::List<Graphics::PixelFormat> outFormats = g_system->getSupportedFormats();
+ Graphics::PixelFormat inFormat = _decoder->getPixelFormat();
+ Graphics::PixelFormat bestFormat = outFormats.front();
+ Common::List<Graphics::PixelFormat>::const_iterator it;
+ for (it = outFormats.begin(); it != outFormats.end(); ++it) {
+ if (*it == inFormat) {
+ bestFormat = inFormat;
+ break;
+ }
+ }
+
+ if (bestFormat.bytesPerPixel != 2 && bestFormat.bytesPerPixel != 4) {
+ error("Failed to find any valid output pixel format");
+ }
+
+ g_sci->_gfxFrameout->setPixelFormat(bestFormat);
}
return kIOSuccess;