aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2012-09-05 11:27:01 -0400
committerMatthew Hoops2012-09-05 11:27:01 -0400
commit058b9b9aca066c886ceb4e454a5541be70c27cb6 (patch)
treed20bd04f69c0b97f38a09361fd6d9a5b14f2cfb1
parent220e945d6746ce22c655b2893f7ce0c001d811a6 (diff)
downloadscummvm-rg350-058b9b9aca066c886ceb4e454a5541be70c27cb6.tar.gz
scummvm-rg350-058b9b9aca066c886ceb4e454a5541be70c27cb6.tar.bz2
scummvm-rg350-058b9b9aca066c886ceb4e454a5541be70c27cb6.zip
VIDEO: Restrict setEndTime()'s affects to videos that are playing
-rw-r--r--video/video_decoder.cpp4
-rw-r--r--video/video_decoder.h3
2 files changed, 5 insertions, 2 deletions
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index e79043629c..c9d3d22070 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -250,7 +250,7 @@ uint32 VideoDecoder::getTimeToNextFrame() const {
bool VideoDecoder::endOfVideo() const {
for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
- if (!(*it)->endOfTrack() && ((*it)->getTrackType() != Track::kTrackTypeVideo || !_endTimeSet || ((VideoTrack *)*it)->getNextFrameStartTime() < (uint)_endTime.msecs()))
+ if (!(*it)->endOfTrack() && (!isPlaying() || (*it)->getTrackType() != Track::kTrackTypeVideo || !_endTimeSet || ((VideoTrack *)*it)->getNextFrameStartTime() < (uint)_endTime.msecs()))
return false;
return true;
@@ -674,7 +674,7 @@ bool VideoDecoder::hasFramesLeft() const {
// 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()))
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo && !(*it)->endOfTrack() && (!isPlaying() || !_endTimeSet || ((VideoTrack *)*it)->getNextFrameStartTime() < (uint)_endTime.msecs()))
return true;
return false;
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 7ccf49a0af..daf78c227a 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -180,6 +180,9 @@ public:
/**
* Set the time for this video to end at. At this time in the video,
* all audio will stop and endOfVideo() will return true.
+ *
+ * While the setting is stored even if a video is not playing,
+ * endOfVideo() is only affected when the video is playing.
*/
void setEndTime(const Audio::Timestamp &endTime);