diff options
author | Matthew Hoops | 2012-07-21 14:39:03 -0400 |
---|---|---|
committer | Matthew Hoops | 2012-07-21 14:39:03 -0400 |
commit | 10341d2b5722fb39cba39356c8596d857319a1ba (patch) | |
tree | 1277b57ae5ecb4fac4fe75c9d76ca03417c527bc /video/video_decoder.h | |
parent | fb1edcd4fef7fd750b4af18745ca7b3151b56aae (diff) | |
download | scummvm-rg350-10341d2b5722fb39cba39356c8596d857319a1ba.tar.gz scummvm-rg350-10341d2b5722fb39cba39356c8596d857319a1ba.tar.bz2 scummvm-rg350-10341d2b5722fb39cba39356c8596d857319a1ba.zip |
VIDEO: Add getDuration() and getStartTime() functions to Track
The AdvancedVideoDecoder::getDuration() function now attempts to calculate duration based on the longest track.
Diffstat (limited to 'video/video_decoder.h')
-rw-r--r-- | video/video_decoder.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/video/video_decoder.h b/video/video_decoder.h index ede2872c6a..87d832eeb9 100644 --- a/video/video_decoder.h +++ b/video/video_decoder.h @@ -423,7 +423,7 @@ protected: /** * Seek to the given time. - * @param time The time to seek to. + * @param time The time to seek to, from the beginning of the video. * @return true on success, false otherwise. */ virtual bool seek(const Audio::Timestamp &time) { return false; } @@ -448,6 +448,19 @@ protected: */ bool isPaused() const { return _paused; } + /** + * Get the start time of the track (starting from the beginning of the + * movie). + */ + virtual Audio::Timestamp getStartTime() const; + + /** + * Get the duration of the track (starting from this track's start time). + * + * By default, this returns 0 for unknown. + */ + virtual Audio::Timestamp getDuration() const; + protected: /** * Function called by pause() for subclasses to implement. @@ -510,6 +523,18 @@ protected: }; /** + * A FixedRateVideoTrack and FixedLengthVideoTrack that implements the getDuration() + * function. + */ + class FixedDurationVideoTrack : public FixedRateVideoTrack, public FixedLengthVideoTrack { + public: + FixedDurationVideoTrack() {} + virtual ~FixedDurationVideoTrack() {} + + virtual Audio::Timestamp getDuration() const; + }; + + /** * An abstract representation of an audio track. */ class AudioTrack : public Track { @@ -575,6 +600,8 @@ protected: bool isSeekable() const { return true; } bool seek(const Audio::Timestamp &time); + Audio::Timestamp getDuration() const; + protected: Audio::AudioStream *getAudioStream() const; |