diff options
author | Matthew Hoops | 2012-07-22 14:11:11 -0400 |
---|---|---|
committer | Matthew Hoops | 2012-07-22 14:11:11 -0400 |
commit | 7654b2036268bb56f3b08b88858f2a9e4862b056 (patch) | |
tree | d7a734ec0076d3dd771cd52f78993a2da159c96e | |
parent | 29541dc5f4dd492f7443463f709a5c6396dab9d8 (diff) | |
download | scummvm-rg350-7654b2036268bb56f3b08b88858f2a9e4862b056.tar.gz scummvm-rg350-7654b2036268bb56f3b08b88858f2a9e4862b056.tar.bz2 scummvm-rg350-7654b2036268bb56f3b08b88858f2a9e4862b056.zip |
VIDEO: Merge the three Fixed* VideoTrack classes
Avoids diamond inheritance, which makes it impossible to downcast without rtti
-rw-r--r-- | engines/sci/video/seq_decoder.h | 2 | ||||
-rw-r--r-- | video/video_decoder.cpp | 4 | ||||
-rw-r--r-- | video/video_decoder.h | 30 |
3 files changed, 8 insertions, 28 deletions
diff --git a/engines/sci/video/seq_decoder.h b/engines/sci/video/seq_decoder.h index 75d7ce6c3d..82254990d6 100644 --- a/engines/sci/video/seq_decoder.h +++ b/engines/sci/video/seq_decoder.h @@ -48,7 +48,7 @@ public: bool loadStream(Common::SeekableReadStream *stream); private: - class SEQVideoTrack : public FixedDurationVideoTrack { + class SEQVideoTrack : public FixedRateVideoTrack { public: SEQVideoTrack(Common::SeekableReadStream *stream, uint frameDelay); ~SEQVideoTrack(); diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp index b2fcdda04c..ad176da73b 100644 --- a/video/video_decoder.cpp +++ b/video/video_decoder.cpp @@ -400,11 +400,11 @@ uint32 AdvancedVideoDecoder::FixedRateVideoTrack::getNextFrameStartTime() const return time.toInt(); } -bool AdvancedVideoDecoder::FixedLengthVideoTrack::endOfTrack() const { +bool AdvancedVideoDecoder::FixedRateVideoTrack::endOfTrack() const { return getCurFrame() >= (getFrameCount() - 1); } -Audio::Timestamp AdvancedVideoDecoder::FixedDurationVideoTrack::getDuration() const { +Audio::Timestamp AdvancedVideoDecoder::FixedRateVideoTrack::getDuration() const { // Since Audio::Timestamp doesn't support a fractional frame rate, we're currently // just converting to milliseconds. Common::Rational time = getFrameCount() * 1000; diff --git a/video/video_decoder.h b/video/video_decoder.h index 2a5eebfc60..efc8f7a37d 100644 --- a/video/video_decoder.h +++ b/video/video_decoder.h @@ -499,13 +499,17 @@ protected: /** * A VideoTrack that is played at a constant rate. + * + * If the frame count is unknown, you must override endOfTrack(). */ - class FixedRateVideoTrack : public virtual VideoTrack { + class FixedRateVideoTrack : public VideoTrack { public: FixedRateVideoTrack() {} virtual ~FixedRateVideoTrack() {} + virtual bool endOfTrack() const; uint32 getNextFrameStartTime() const; + virtual Audio::Timestamp getDuration() const; protected: /** @@ -515,30 +519,6 @@ protected: }; /** - * A VideoTrack with a known frame count that can be reliably - * used to figure out if the track has finished. - */ - class FixedLengthVideoTrack : public virtual VideoTrack { - public: - FixedLengthVideoTrack() {} - virtual ~FixedLengthVideoTrack() {} - - bool endOfTrack() const; - }; - - /** - * 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 { |