aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2012-07-21 17:52:16 -0400
committerMatthew Hoops2012-07-21 17:52:16 -0400
commit067e02e90b7fbe3406cbc7b5b08d63ae281b360c (patch)
tree657e60d1fa3d948b504e05a8a93c774ce76c59f2
parent144b9ce9189260973994ca83b6e2b29126ef269a (diff)
downloadscummvm-rg350-067e02e90b7fbe3406cbc7b5b08d63ae281b360c.tar.gz
scummvm-rg350-067e02e90b7fbe3406cbc7b5b08d63ae281b360c.tar.bz2
scummvm-rg350-067e02e90b7fbe3406cbc7b5b08d63ae281b360c.zip
VIDEO: Add StreamFileAudioTrack wrapper
-rw-r--r--video/video_decoder.cpp15
-rw-r--r--video/video_decoder.h21
2 files changed, 36 insertions, 0 deletions
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index 3cce2dea02..4ac914927e 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -486,6 +486,21 @@ bool AdvancedVideoDecoder::SeekableAudioTrack::seek(const Audio::Timestamp &time
return stream->seek(time);
}
+AdvancedVideoDecoder::StreamFileAudioTrack::StreamFileAudioTrack() {
+ _stream = 0;
+}
+
+AdvancedVideoDecoder::StreamFileAudioTrack::~StreamFileAudioTrack() {
+ delete _stream;
+}
+
+bool AdvancedVideoDecoder::StreamFileAudioTrack::loadFromFile(const Common::String &baseName) {
+ // TODO: Make sure the stream isn't being played
+ delete _stream;
+ _stream = Audio::SeekableAudioStream::openStreamFile(baseName);
+ return _stream != 0;
+}
+
void AdvancedVideoDecoder::addTrack(Track *track) {
_tracks.push_back(track);
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 9496148de6..3e991ade66 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -610,6 +610,27 @@ protected:
};
/**
+ * A SeekableAudioTrack that constructs its SeekableAudioStream using
+ * SeekableAudioStream::openStreamFile()
+ */
+ class StreamFileAudioTrack : public SeekableAudioTrack {
+ public:
+ StreamFileAudioTrack();
+ ~StreamFileAudioTrack();
+
+ /**
+ * Load the track from a file with the given base name.
+ *
+ * @return true on success, false otherwise
+ */
+ bool loadFromFile(const Common::String &baseName);
+
+ protected:
+ Audio::SeekableAudioStream *_stream;
+ Audio::SeekableAudioStream *getSeekableAudioStream() const { return _stream; }
+ };
+
+ /**
* Decode enough data for the next frame and enough audio to last that long.
*
* This function is used by the default decodeNextFrame() function. A subclass