aboutsummaryrefslogtreecommitdiff
path: root/graphics/video
diff options
context:
space:
mode:
authorSven Hesse2010-09-30 13:05:40 +0000
committerSven Hesse2010-09-30 13:05:40 +0000
commitce074116969869f9d79de2b08b771c623e6377e8 (patch)
treed3b83451a8ac3bbe3c84b0f61b29beb829f1885d /graphics/video
parent3c449e19ab6d8f42afba6476ff24bacd3cf32c3e (diff)
downloadscummvm-rg350-ce074116969869f9d79de2b08b771c623e6377e8.tar.gz
scummvm-rg350-ce074116969869f9d79de2b08b771c623e6377e8.tar.bz2
scummvm-rg350-ce074116969869f9d79de2b08b771c623e6377e8.zip
VIDEO: Allow for Indeo3'd VMDs
svn-id: r52954
Diffstat (limited to 'graphics/video')
-rw-r--r--graphics/video/coktel_decoder.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp
index b1cbad2820..10be09eb23 100644
--- a/graphics/video/coktel_decoder.cpp
+++ b/graphics/video/coktel_decoder.cpp
@@ -399,11 +399,11 @@ void CoktelDecoder::renderBlockWhole(const byte *src, Common::Rect &rect) {
rect.clip(_surface.w, _surface.h);
- byte *dst = (byte *)_surface.pixels + (rect.top * _surface.pitch) + rect.left;
+ byte *dst = (byte *)_surface.pixels + (rect.top * _surface.pitch) + rect.left * _surface.bytesPerPixel;
for (int i = 0; i < rect.height(); i++) {
- memcpy(dst, src, rect.width());
+ memcpy(dst, src, rect.width() * _surface.bytesPerPixel);
- src += srcRect.width();
+ src += srcRect.width() * _surface.bytesPerPixel;
dst += _surface.pitch;
}
}
@@ -1589,12 +1589,6 @@ bool VMDDecoder::load(Common::SeekableReadStream *stream) {
if (_version & 4)
_bytesPerPixel = handle + 1;
- if (_bytesPerPixel != 1) {
- warning("TODO: _bytesPerPixel = %d", _bytesPerPixel);
- close();
- return false;
- }
-
if (_bytesPerPixel > 3) {
warning("VMDDecoder::load(): Requested %d bytes per pixel (%d, %d, %d)",
_bytesPerPixel, headerLength, handle, _version);
@@ -1696,6 +1690,11 @@ bool VMDDecoder::assessVideoProperties() {
_bytesPerPixel = n;
}
+ if ((_bytesPerPixel > 1) && !_externalCodec) {
+ warning("VMDDecoder::assessVideoProperties(): TODO: Internal _bytesPerPixel == %d", _bytesPerPixel);
+ return false;
+ }
+
if (_hasVideo) {
if ((_frameDataSize == 0) || (_frameDataSize > 1048576))
_frameDataSize = _width * _height + 1000;
@@ -2087,9 +2086,19 @@ bool VMDDecoder::renderFrame(Common::Rect &rect) {
return false;
if (_externalCodec) {
- // TODO
- warning("_external codec");
- return false;
+ if (!_codec)
+ return false;
+
+ Common::MemoryReadStream frameStream(_frameData, _frameDataLen);
+ Surface *codecSurf = _codec->decodeImage(&frameStream);
+ if (!codecSurf)
+ return false;
+
+ rect = Common::Rect(_x, _y, _x + codecSurf->w, _y + codecSurf->h);
+ rect.clip(Common::Rect(_x, _y, _x + _width, _y + _height));
+
+ renderBlockWhole((const byte *) codecSurf->pixels, rect);
+ return true;
}
if (_blitMode > 0) {
@@ -2376,6 +2385,9 @@ byte *VMDDecoder::deADPCM(const byte *data, uint32 &size, int32 init, int32 inde
}
PixelFormat VMDDecoder::getPixelFormat() const {
+ if (_externalCodec && _codec)
+ return _codec->getPixelFormat();
+
return PixelFormat::createFormatCLUT8();
}