[Scummvm-cvs-logs] scummvm master -> ddffd74094768fe7c992c568d484de06f389b7a0
clone2727
clone2727 at gmail.com
Sat Sep 1 03:58:49 CEST 2012
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ddffd74094 VIDEO: Improve setEndTime()
Commit: ddffd74094768fe7c992c568d484de06f389b7a0
https://github.com/scummvm/scummvm/commit/ddffd74094768fe7c992c568d484de06f389b7a0
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-08-31T18:47:52-07:00
Commit Message:
VIDEO: Improve setEndTime()
endOfVideo() and needsUpdate() are now more accurate
Changed paths:
video/video_decoder.cpp
video/video_decoder.h
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index 559880a..e790436 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -87,7 +87,7 @@ bool VideoDecoder::loadFile(const Common::String &filename) {
}
bool VideoDecoder::needsUpdate() const {
- return !endOfVideo() && getTimeToNextFrame() == 0;
+ return hasFramesLeft() && getTimeToNextFrame() == 0;
}
void VideoDecoder::pauseVideo(bool pause) {
@@ -249,18 +249,8 @@ uint32 VideoDecoder::getTimeToNextFrame() const {
}
bool VideoDecoder::endOfVideo() const {
- if (!isVideoLoaded())
- return true;
-
- if (_endTimeSet) {
- const VideoTrack *track = findNextVideoTrack();
-
- if (track && track->getNextFrameStartTime() >= (uint)_endTime.msecs())
- return true;
- }
-
for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
- if (!(*it)->endOfTrack())
+ if (!(*it)->endOfTrack() && ((*it)->getTrackType() != Track::kTrackTypeVideo || !_endTimeSet || ((VideoTrack *)*it)->getNextFrameStartTime() < (uint)_endTime.msecs()))
return false;
return true;
@@ -679,4 +669,15 @@ void VideoDecoder::startAudioLimit(const Audio::Timestamp &limit) {
((AudioTrack *)*it)->start(limit);
}
+bool VideoDecoder::hasFramesLeft() const {
+ // This is similar to endOfVideo(), except it doesn't take Audio into account (and returns true if not the end of the video)
+ // This is only used for needsUpdate() atm so that setEndTime() works properly
+ // And unlike endOfVideoTracks(), this takes into account _endTime
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo && !(*it)->endOfTrack() && (!_endTimeSet || ((VideoTrack *)*it)->getNextFrameStartTime() < (uint)_endTime.msecs()))
+ return true;
+
+ return false;
+}
+
} // End of namespace Video
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 5abe1d9..7ccf49a 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -777,6 +777,7 @@ private:
void stopAudio();
void startAudio();
void startAudioLimit(const Audio::Timestamp &limit);
+ bool hasFramesLeft() const;
int32 _startTime;
uint32 _pauseLevel;
More information about the Scummvm-git-logs
mailing list