From 84e0b3a167fb282fb7e29614a9806f665af844c2 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 24 Jul 2012 13:23:45 -0400 Subject: VIDEO: Add helper functions to easily add an external audio track --- video/video_decoder.cpp | 11 +++++++++++ video/video_decoder.h | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp index 97f8eec7bb..1461f5dc3d 100644 --- a/video/video_decoder.cpp +++ b/video/video_decoder.cpp @@ -521,6 +521,17 @@ void AdvancedVideoDecoder::addTrack(Track *track) { track->start(); } +bool AdvancedVideoDecoder::addStreamFileTrack(const Common::String &baseName) { + StreamFileAudioTrack *track = new StreamFileAudioTrack(); + + bool result = track->loadFromFile(baseName); + + if (result) + addTrack(track); + + return result; +} + AdvancedVideoDecoder::Track *AdvancedVideoDecoder::getTrack(uint track) { if (track > _tracks.size()) return 0; diff --git a/video/video_decoder.h b/video/video_decoder.h index efc8f7a37d..616d6c4f96 100644 --- a/video/video_decoder.h +++ b/video/video_decoder.h @@ -365,6 +365,11 @@ public: */ virtual Audio::Timestamp getDuration() const; + /** + * Add an audio track from a stream file. + */ + bool addStreamFileTrack(const Common::String &baseName); + // Future API //void setRate(const Common::Rational &rate); //Common::Rational getRate() const; -- cgit v1.2.3