aboutsummaryrefslogtreecommitdiff
path: root/graphics/video
diff options
context:
space:
mode:
authorMatthew Hoops2010-11-11 17:05:33 +0000
committerMatthew Hoops2010-11-11 17:05:33 +0000
commit8e274749ed4fb92673a9314286b91229e6bcee7b (patch)
treeb4cc2277064c2f09208213fee03b0fff22911713 /graphics/video
parent876e38ca92cf51dc60bf2240b2c4a09d61ee9b77 (diff)
downloadscummvm-rg350-8e274749ed4fb92673a9314286b91229e6bcee7b.tar.gz
scummvm-rg350-8e274749ed4fb92673a9314286b91229e6bcee7b.tar.bz2
scummvm-rg350-8e274749ed4fb92673a9314286b91229e6bcee7b.zip
VIDEO: Add support for DK3 in videos; fix sample rate location
svn-id: r54205
Diffstat (limited to 'graphics/video')
-rw-r--r--graphics/video/avi_decoder.cpp15
-rw-r--r--graphics/video/avi_decoder.h1
2 files changed, 8 insertions, 8 deletions
diff --git a/graphics/video/avi_decoder.cpp b/graphics/video/avi_decoder.cpp
index 40cb424ffc..a7c8157a89 100644
--- a/graphics/video/avi_decoder.cpp
+++ b/graphics/video/avi_decoder.cpp
@@ -34,6 +34,7 @@
#include "graphics/video/avi_decoder.h"
// Audio Codecs
+#include "sound/decoders/adpcm.h"
#include "sound/decoders/raw.h"
// Video Codecs
@@ -269,8 +270,8 @@ bool AviDecoder::load(Common::SeekableReadStream *stream) {
debug (0, "Frames = %d, Dimensions = %d x %d", _header.totalFrames, _header.width, _header.height);
debug (0, "Frame Rate = %d", _vidsHeader.rate / _vidsHeader.scale);
- if ((_audsHeader.scale != 0) && (_header.flags & AVIF_ISINTERLEAVED))
- debug (0, "Sound Rate = %d", AUDIO_RATE);
+ if (_wvInfo.samplesPerSec != 0)
+ debug (0, "Sound Rate = %d", _wvInfo.samplesPerSec);
debug (0, "Video Codec = \'%s\'", tag2str(_vidsHeader.streamHandler));
if (!_videoCodec)
@@ -422,10 +423,8 @@ PixelFormat AviDecoder::getPixelFormat() const {
}
Audio::QueuingAudioStream *AviDecoder::createAudioStream() {
- if (_wvInfo.tag == kWaveFormatPCM)
- return Audio::makeQueuingAudioStream(AUDIO_RATE, _wvInfo.channels == 2);
- else if (_wvInfo.tag == kWaveFormatDK3)
- warning("Unsupported DK3 IMA ADPCM sound");
+ if (_wvInfo.tag == kWaveFormatPCM || _wvInfo.tag == kWaveFormatDK3)
+ return Audio::makeQueuingAudioStream(_wvInfo.samplesPerSec, _wvInfo.channels == 2);
else if (_wvInfo.tag != kWaveFormatNone) // No sound
warning("Unsupported AVI audio format %d", _wvInfo.tag);
@@ -451,7 +450,9 @@ void AviDecoder::queueAudioBuffer(uint32 chunkSize) {
if (_wvInfo.channels == 2)
flags |= Audio::FLAG_STEREO;
- _audStream->queueAudioStream(Audio::makeRawStream(stream, AUDIO_RATE, flags, DisposeAfterUse::YES), DisposeAfterUse::YES);
+ _audStream->queueAudioStream(Audio::makeRawStream(stream, _wvInfo.samplesPerSec, flags, DisposeAfterUse::YES), DisposeAfterUse::YES);
+ } else if (_wvInfo.tag == kWaveFormatDK3) {
+ _audStream->queueAudioStream(Audio::makeADPCMStream(stream, DisposeAfterUse::YES, chunkSize, Audio::kADPCMDK3, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign), DisposeAfterUse::YES);
}
}
diff --git a/graphics/video/avi_decoder.h b/graphics/video/avi_decoder.h
index 507917f0e8..91c6f8edd3 100644
--- a/graphics/video/avi_decoder.h
+++ b/graphics/video/avi_decoder.h
@@ -34,7 +34,6 @@
namespace Graphics {
#define UNKNOWN_HEADER(a) error("Unknown header found -- \'%s\'", tag2str(a))
-#define AUDIO_RATE (_audsHeader.rate / _audsHeader.scale)
// IDs used throughout the AVI files
// that will be handled by this player