From fc1163ac28aae1c7bc9f8f9d3877c6f368b4b19c Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 21 Jul 2012 17:30:06 -0400 Subject: VIDEO: Allow for disabling of automatic audio sync in AdvancedVideoDecoder --- video/video_decoder.cpp | 12 +++++++----- video/video_decoder.h | 7 +++++++ 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'video') 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 TrackList; -- cgit v1.2.3