From a1639c3d2d040917483c7bfca9dbe2a3dd35c57f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 26 Apr 2007 08:11:09 +0000 Subject: [PATCH] From Brad Colbert, "Added a new method to ImageStream called getLength that is used to return the length of the stream. Implemented the virtual methods in QuicktimeImageStream, (getLength, getReferenceTime, setTimeMultiplier), to return valid value for each. " --- include/osg/ImageStream | 2 ++ .../quicktime/QuicktimeImageStream.h | 28 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/include/osg/ImageStream b/include/osg/ImageStream index cb8df82b0..4ae14822a 100644 --- a/include/osg/ImageStream +++ b/include/osg/ImageStream @@ -67,6 +67,8 @@ class OSG_EXPORT ImageStream : public Image LoopingMode getLoopingMode() const { return _loopingMode; } + virtual double getLength() const { return 0.0; } + virtual void setReferenceTime(double) {} virtual double getReferenceTime() const { return 0.0; } diff --git a/src/osgPlugins/quicktime/QuicktimeImageStream.h b/src/osgPlugins/quicktime/QuicktimeImageStream.h index 6f5b913ee..e0e036c64 100644 --- a/src/osgPlugins/quicktime/QuicktimeImageStream.h +++ b/src/osgPlugins/quicktime/QuicktimeImageStream.h @@ -87,7 +87,10 @@ public: virtual void quit(bool wiatForThreadToExit); /// Get total length in seconds. - inline float getLength() const { return _len; } + virtual double getLength() const + { + return double(_len); + } /// jumps to a specific position void jumpTo(float pos) { @@ -106,6 +109,29 @@ public: /// starts the thread virtual void run(); + /// Go to a specific position in the stream. + virtual void setReferenceTime(double time) + { + jumpTo(float(time)); + } + /// Return the current position in the stream. + virtual double getReferenceTime() const + { + return double(getCurrentTime()); + } + + // Set the time multiplier if you want to speed up, + // slow down, or go normal speed. + virtual void setTimeMultiplier(double multiplier) + { + setMovieRate(float(multiplier)); + } + virtual double getTimeMultiplier() + { + return 0.0; + } + + protected: /// destructor virtual ~QuicktimeImageStream();