VIDEO: Allow for disabling of automatic audio sync in AdvancedVideoDecoder

This commit is contained in:
Matthew Hoops 2012-07-21 17:30:06 -04:00
parent 1d565a2661
commit fc1163ac28
2 changed files with 14 additions and 5 deletions

View File

@ -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();
}
}
}

View File

@ -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;