aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorMatthew Hoops2012-07-22 14:11:11 -0400
committerMatthew Hoops2012-07-22 14:11:11 -0400
commit7654b2036268bb56f3b08b88858f2a9e4862b056 (patch)
treed7a734ec0076d3dd771cd52f78993a2da159c96e /video
parent29541dc5f4dd492f7443463f709a5c6396dab9d8 (diff)
downloadscummvm-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
Diffstat (limited to 'video')
-rw-r--r--video/video_decoder.cpp4
-rw-r--r--video/video_decoder.h30
2 files changed, 7 insertions, 27 deletions
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 {