aboutsummaryrefslogtreecommitdiff
path: root/graphics/video/avi_decoder.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2010-11-11 04:53:52 +0000
committerMatthew Hoops2010-11-11 04:53:52 +0000
commit5e8e77a81450c7399dbd62ec83805af990d925a4 (patch)
tree4dc119fa05ac61b854107304de930ae4c9aaa787 /graphics/video/avi_decoder.cpp
parent3b66e53bbed7365607bb3804b990984646ad2376 (diff)
downloadscummvm-rg350-5e8e77a81450c7399dbd62ec83805af990d925a4.tar.gz
scummvm-rg350-5e8e77a81450c7399dbd62ec83805af990d925a4.tar.bz2
scummvm-rg350-5e8e77a81450c7399dbd62ec83805af990d925a4.zip
VIDEO: Add the TrueMotion 1 codec for Phantasmagoria 2
Based on the FFmpeg decoder. Only the 16bpp version has been implemented (and all that should be needed). The videos I have tried work fine with the codec. The audio does not yet play in these videos, but I hope to work on DK3 IMA ADPCM soon. svn-id: r54194
Diffstat (limited to 'graphics/video/avi_decoder.cpp')
-rw-r--r--graphics/video/avi_decoder.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/graphics/video/avi_decoder.cpp b/graphics/video/avi_decoder.cpp
index ceca89b8ee..713d57eb1e 100644
--- a/graphics/video/avi_decoder.cpp
+++ b/graphics/video/avi_decoder.cpp
@@ -36,9 +36,10 @@
// Codecs
#include "graphics/video/codecs/cinepak.h"
+#include "graphics/video/codecs/indeo3.h"
#include "graphics/video/codecs/msvideo1.h"
#include "graphics/video/codecs/msrle.h"
-#include "graphics/video/codecs/indeo3.h"
+#include "graphics/video/codecs/truemotion1.h"
namespace Graphics {
@@ -174,7 +175,8 @@ void AviDecoder::handleStreamHeader() {
if (_fileStream->readUint32BE() != ID_STRF)
error("Could not find STRF tag");
- /* uint32 strfSize = */ _fileStream->readUint32LE();
+ uint32 strfSize = _fileStream->readUint32LE();
+ uint32 startPos = _fileStream->pos();
if (sHeader.streamType == ID_VIDS) {
_vidsHeader = sHeader;
@@ -224,6 +226,9 @@ void AviDecoder::handleStreamHeader() {
if (_wvInfo.channels == 2)
_audsHeader.sampleSize /= 2;
}
+
+ // Ensure that we're at the end of the chunk
+ _fileStream->seek(startPos + strfSize);
}
bool AviDecoder::load(Common::SeekableReadStream *stream) {
@@ -349,7 +354,8 @@ Surface *AviDecoder::decodeNextFrame() {
if (_wvInfo.channels == 2)
flags |= Audio::FLAG_STEREO;
- _audStream->queueBuffer(data, chunkSize, DisposeAfterUse::YES, flags);
+ if (_audStream)
+ _audStream->queueBuffer(data, chunkSize, DisposeAfterUse::YES, flags);
_fileStream->skip(chunkSize & 1); // Alignment
} else if (getStreamType(nextTag) == 'dc' || getStreamType(nextTag) == 'id' ||
getStreamType(nextTag) == 'AM' || getStreamType(nextTag) == '32') {
@@ -410,6 +416,10 @@ Codec *AviDecoder::createCodec() {
case ID_IV32:
return new Indeo3Decoder(_bmInfo.width, _bmInfo.height);
#endif
+#ifdef GRAPHICS_TRUEMOTION1_H
+ case ID_DUCK:
+ return new TrueMotion1Decoder(_bmInfo.width, _bmInfo.height);
+#endif
default:
warning ("Unknown/Unhandled compression format \'%s\'", tag2str(_vidsHeader.streamHandler));
}
@@ -425,9 +435,10 @@ PixelFormat AviDecoder::getPixelFormat() const {
Audio::QueuingAudioStream *AviDecoder::createAudioStream() {
if (_wvInfo.tag == AVI_WAVE_FORMAT_PCM)
return Audio::makeQueuingAudioStream(AUDIO_RATE, _wvInfo.channels == 2);
-
- if (_wvInfo.tag != 0) // No sound
- warning ("Unsupported AVI audio format %d", _wvInfo.tag);
+ else if (_wvInfo.tag == 98)
+ warning("Unsupported DK3 IMA ADPCM sound");
+ else if (_wvInfo.tag != 0) // No sound
+ warning("Unsupported AVI audio format %d", _wvInfo.tag);
return NULL;
}