aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2012-07-21 17:30:06 -0400
committerMatthew Hoops2012-07-21 17:30:06 -0400
commitfc1163ac28aae1c7bc9f8f9d3877c6f368b4b19c (patch)
tree03ebf1052a153fe735cb6250d9064916442389d7
parent1d565a26610a174c16b58b569fe413f3acf9bd75 (diff)
downloadscummvm-rg350-fc1163ac28aae1c7bc9f8f9d3877c6f368b4b19c.tar.gz
scummvm-rg350-fc1163ac28aae1c7bc9f8f9d3877c6f368b4b19c.tar.bz2
scummvm-rg350-fc1163ac28aae1c7bc9f8f9d3877c6f368b4b19c.zip
VIDEO: Allow for disabling of automatic audio sync in AdvancedVideoDecoder
-rw-r--r--video/video_decoder.cpp12
-rw-r--r--video/video_decoder.h7
2 files changed, 14 insertions, 5 deletions
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index 07fd225dcf..3312b2530d 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -194,12 +194,14 @@ uint32 AdvancedVideoDecoder::getTime() const {
if (isPaused())
return _pauseStartTime - _startTime;
- for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) {
- if ((*it)->getTrackType() == Track::kTrackTypeAudio) {
- uint32 time = ((const AudioTrack *)*it)->getRunningTime();
+ if (useAudioSync()) {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) {
+ if ((*it)->getTrackType() == Track::kTrackTypeAudio) {
+ uint32 time = ((const AudioTrack *)*it)->getRunningTime();
- if (time != 0)
- return time + _audioStartOffset.msecs();
+ if (time != 0)
+ return time + _audioStartOffset.msecs();
+ }
}
}
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 87d832eeb9..9496148de6 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -625,6 +625,13 @@ protected:
*/
void addTrack(Track *track);
+ /**
+ * Whether or not getTime() will sync with a playing audio track.
+ *
+ * A subclass should override this to disable this feature.
+ */
+ virtual bool useAudioSync() const { return true; }
+
private:
// Tracks owned by this AdvancedVideoDecoder
typedef Common::List<Track *> TrackList;