diff options
-rw-r--r-- | video/video_decoder.cpp | 40 | ||||
-rw-r--r-- | video/video_decoder.h | 37 |
2 files changed, 7 insertions, 70 deletions
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp index 0108888613..a7d3789b65 100644 --- a/video/video_decoder.cpp +++ b/video/video_decoder.cpp @@ -34,7 +34,10 @@ namespace Video { VideoDecoder::VideoDecoder() { - reset(); + _startTime = 0; + _pauseLevel = 0; + _audioVolume = Audio::Mixer::kMaxChannelVolume; + _audioBalance = 0; } bool VideoDecoder::loadFile(const Common::String &filename) { @@ -74,7 +77,7 @@ void VideoDecoder::pauseVideo(bool pause) { pauseVideoIntern(true); } else if (_pauseLevel == 0) { pauseVideoIntern(false); - addPauseTime(g_system->getMillis() - _pauseStartTime); + _startTime += (g_system->getMillis() - _pauseStartTime); } } @@ -701,41 +704,8 @@ void AdvancedVideoDecoder::startAudioLimit(const Audio::Timestamp &limit) { ///////////////// DEPRECATED ///////////////// ////////////////////////////////////////////// -void VideoDecoder::reset() { - _curFrame = -1; - _startTime = 0; - _pauseLevel = 0; - _audioVolume = Audio::Mixer::kMaxChannelVolume; - _audioBalance = 0; -} - -bool VideoDecoder::endOfVideo() const { - return !isVideoLoaded() || (getCurFrame() >= (int32)getFrameCount() - 1); -} - void VideoDecoder::setSystemPalette() { g_system->getPaletteManager()->setPalette(getPalette(), 0, 256); } -uint32 FixedRateVideoDecoder::getTimeToNextFrame() const { - if (endOfVideo() || _curFrame < 0) - return 0; - - uint32 elapsedTime = getTime(); - uint32 nextFrameStartTime = getFrameBeginTime(_curFrame + 1); - - // If the time that the next frame should be shown has past - // the frame should be shown ASAP. - if (nextFrameStartTime <= elapsedTime) - return 0; - - return nextFrameStartTime - elapsedTime; -} - -uint32 FixedRateVideoDecoder::getFrameBeginTime(uint32 frame) const { - Common::Rational beginTime = frame * 1000; - beginTime /= getFrameRate(); - return beginTime.toInt(); -} - } // End of namespace Video diff --git a/video/video_decoder.h b/video/video_decoder.h index 7e89caee40..0135425bac 100644 --- a/video/video_decoder.h +++ b/video/video_decoder.h @@ -124,7 +124,7 @@ public: * Returns the current frame number of the video. * @return the last frame decoded by the video */ - virtual int32 getCurFrame() const { return _curFrame; } + virtual int32 getCurFrame() const = 0; /** * Returns the number of frames in the video. @@ -173,7 +173,7 @@ public: * Returns if the video has finished playing or not. * @return true if the video has finished playing or if none is loaded, false otherwise */ - virtual bool endOfVideo() const; + virtual bool endOfVideo() const = 0; /** * Pause or resume the video. This should stop/resume any audio playback @@ -229,12 +229,6 @@ public: protected: /** - * Resets _curFrame and _startTime. Should be called from every close() function. - * @note This function is now deprecated. There is no replacement. - */ - void reset(); - - /** * Actual implementation of pause by subclasses. See pause() * for details. * @note This function is now deprecated. There is no replacement. @@ -242,12 +236,6 @@ protected: virtual void pauseVideoIntern(bool pause) {} /** - * Add the time the video has been paused to maintain sync - * @note This function is now deprecated. There is no replacement. - */ - virtual void addPauseTime(uint32 ms) { _startTime += ms; } - - /** * Reset the pause start time (which should be called when seeking) */ void resetPauseStartTime(); @@ -264,7 +252,6 @@ protected: */ virtual void updateBalance() {} - int32 _curFrame; // This variable is now deprecated. int32 _startTime; // FIXME: These are protected until the new API takes over this one @@ -797,26 +784,6 @@ private: void startAudioLimit(const Audio::Timestamp &limit); }; -/** - * A VideoDecoder wrapper that implements getTimeToNextFrame() based on getFrameRate(). - * @note This class is now deprecated. Use AdvancedVideoDecoder instead. - */ -class FixedRateVideoDecoder : public virtual VideoDecoder { -public: - uint32 getTimeToNextFrame() const; - -protected: - /** - * Return the frame rate in frames per second. - * This returns a Rational because videos can have rates that are not integers and - * there are some videos with frame rates < 1. - */ - virtual Common::Rational getFrameRate() const = 0; - -private: - uint32 getFrameBeginTime(uint32 frame) const; -}; - } // End of namespace Video #endif |