[Scummvm-git-logs] scummvm master -> af282b79fb0355b04674af7e595af27cc0e6cf3c

sev- noreply at scummvm.org
Sun Apr 9 11:03:37 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
af282b79fb VIDEO: Generic support for DXA videos with embedded audio


Commit: af282b79fb0355b04674af7e595af27cc0e6cf3c
    https://github.com/scummvm/scummvm/commit/af282b79fb0355b04674af7e595af27cc0e6cf3c
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-04-09T13:03:33+02:00

Commit Message:
VIDEO: Generic support for DXA videos with embedded audio

Changed paths:
    video/dxa_decoder.cpp
    video/video_decoder.cpp
    video/video_decoder.h


diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp
index ddcec71819f..9361c131fd4 100644
--- a/video/dxa_decoder.cpp
+++ b/video/dxa_decoder.cpp
@@ -29,6 +29,8 @@
 
 #include "video/dxa_decoder.h"
 
+#include "audio/decoders/wave.h"
+
 #include "common/compression/gzio.h"
 
 namespace Video {
@@ -60,8 +62,15 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) {
 }
 
 void DXADecoder::readSoundData(Common::SeekableReadStream *stream) {
-	// Skip over the tag by default
-	stream->readUint32BE();
+	uint32 tag = stream->readUint32BE();
+
+	if (tag == MKTAG('W','A','V','E')) {
+		uint32 size = stream->readUint32BE();
+
+		addStreamTrack(Audio::makeWAVStream(stream->readStream(size), DisposeAfterUse::YES));
+	} else if (tag != MKTAG('N','U','L','L')) {
+		stream->skip(-4);
+	}
 }
 
 DXADecoder::DXAVideoTrack::DXAVideoTrack(Common::SeekableReadStream *stream) {
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index b1209b52848..ebbc23599b5 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -741,6 +741,11 @@ VideoDecoder::StreamFileAudioTrack::StreamFileAudioTrack(Audio::Mixer::SoundType
 	_stream = 0;
 }
 
+VideoDecoder::StreamFileAudioTrack::StreamFileAudioTrack(Audio::SeekableAudioStream *stream, Audio::Mixer::SoundType soundType) :
+		SeekableAudioTrack(soundType) {
+	_stream = stream;
+}
+
 VideoDecoder::StreamFileAudioTrack::~StreamFileAudioTrack() {
 	delete _stream;
 }
@@ -790,6 +795,16 @@ void VideoDecoder::addTrack(Track *track, bool isExternal) {
 		((AudioTrack *)track)->start();
 }
 
+bool VideoDecoder::addStreamTrack(Audio::SeekableAudioStream *stream) {
+	// Only allow adding external tracks if a video is already loaded
+	if (!isVideoLoaded())
+		return false;
+
+	StreamFileAudioTrack *track = new StreamFileAudioTrack(stream, getSoundType());
+	addTrack(track, true);
+	return true;
+}
+
 bool VideoDecoder::addStreamFileTrack(const Common::String &baseName) {
 	// Only allow adding external tracks if a video is already loaded
 	if (!isVideoLoaded())
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 215a3eef6b0..379e7429f4f 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -444,6 +444,11 @@ public:
 	 */
 	void setSoundType(Audio::Mixer::SoundType soundType);
 
+	/**
+	 * Add an audio track from a stream.
+	 */
+	bool addStreamTrack(Audio::SeekableAudioStream *stream);
+
 	/**
 	 * Add an audio track from a stream file.
 	 *
@@ -815,6 +820,7 @@ protected:
 	class StreamFileAudioTrack : public SeekableAudioTrack {
 	public:
 		StreamFileAudioTrack(Audio::Mixer::SoundType soundType);
+		StreamFileAudioTrack(Audio::SeekableAudioStream *stream, Audio::Mixer::SoundType soundType);
 		~StreamFileAudioTrack();
 
 		/**




More information about the Scummvm-git-logs mailing list