aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2013-06-07 22:11:28 +0300
committerrichiesams2013-08-15 15:09:30 -0500
commit62043e949d396e0d86515d963fa32b792ab9ec01 (patch)
treedab2dd1227718c0020daacea0c26906b4434417a
parent7e8e9bf3d1e718758298b8fb5ccc6a0f296d5b9c (diff)
downloadscummvm-rg350-62043e949d396e0d86515d963fa32b792ab9ec01.tar.gz
scummvm-rg350-62043e949d396e0d86515d963fa32b792ab9ec01.tar.bz2
scummvm-rg350-62043e949d396e0d86515d963fa32b792ab9ec01.zip
VIDEO: Add an over-ridable wrapper for the AVI audio track handler
Reimplementation of 7a49802c01b0c39be4e86335689db8f3359fde68 This is based on a suggestion made by clone2727, so the original idea belongs to him. Engines can now override the common AVI audio track handler with a custom one. This is needed for the Z-Engine AVI videos, since they use a custom audio decoder that is only used in the two Z-Engine games, and has its own fake AVI audio format (17). This clashes with the MS IMA ADPCM format, and therefore shouldn't pollute the common AVI video decoder code. The addition of this over-ridable method allows the Z-Engine to add its own custom AVI decoder while avoiding code duplication.
-rw-r--r--video/avi_decoder.cpp6
-rw-r--r--video/avi_decoder.h7
2 files changed, 9 insertions, 4 deletions
diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
index 92a60fcccf..ff41099e69 100644
--- a/video/avi_decoder.cpp
+++ b/video/avi_decoder.cpp
@@ -93,6 +93,10 @@ AVIDecoder::~AVIDecoder() {
close();
}
+AVIDecoder::AVIAudioTrack *AVIDecoder::createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo) {
+ return new AVIAudioTrack(sHeader, wvInfo, _soundType);
+}
+
void AVIDecoder::initCommon() {
_decodedHeader = false;
_foundMovieList = false;
@@ -268,7 +272,7 @@ void AVIDecoder::handleStreamHeader(uint32 size) {
if (wvInfo.channels == 2)
sHeader.sampleSize /= 2;
- addTrack(new AVIAudioTrack(sHeader, wvInfo, _soundType));
+ addTrack(createAudioTrack(sHeader, wvInfo));
}
// Ensure that we're at the end of the chunk
diff --git a/video/avi_decoder.h b/video/avi_decoder.h
index 5d52c7c797..f7259bf030 100644
--- a/video/avi_decoder.h
+++ b/video/avi_decoder.h
@@ -69,7 +69,6 @@ public:
protected:
void readNextPacket();
-private:
struct BitmapInfoHeader {
uint32 size;
uint32 width;
@@ -192,13 +191,12 @@ private:
AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType);
~AVIAudioTrack();
- void queueSound(Common::SeekableReadStream *stream);
+ virtual void queueSound(Common::SeekableReadStream *stream);
Audio::Mixer::SoundType getSoundType() const { return _soundType; }
protected:
Audio::AudioStream *getAudioStream() const;
- private:
// Audio Codecs
enum {
kWaveFormatNone = 0,
@@ -233,6 +231,9 @@ private:
void handleStreamHeader(uint32 size);
uint16 getStreamType(uint32 tag) const { return tag & 0xFFFF; }
byte getStreamIndex(uint32 tag) const;
+
+public:
+ virtual AVIAudioTrack *createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo);
};
} // End of namespace Video