[Scummvm-cvs-logs] scummvm master -> 8808393b3a3428df2946d7967e52aba084c8ffe5

clone2727 clone2727 at gmail.com
Wed Sep 12 02:07:22 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:
8808393b3a VIDEO: Do not close/rewind videos after a stop()


Commit: 8808393b3a3428df2946d7967e52aba084c8ffe5
    https://github.com/scummvm/scummvm/commit/8808393b3a3428df2946d7967e52aba084c8ffe5
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-09-11T14:38:33-07:00

Commit Message:
VIDEO: Do not close/rewind videos after a stop()

It makes more sense to do this more like a hard "pause" and let the caller stop()/rewind() if they want

Changed paths:
    video/video_decoder.cpp
    video/video_decoder.h



diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index c9d3d22..24287c4 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -35,7 +35,6 @@ namespace Video {
 
 VideoDecoder::VideoDecoder() {
 	_startTime = 0;
-	_needsRewind = false;
 	_dirtyPalette = false;
 	_palette = 0;
 	_isPlaying = false;
@@ -62,7 +61,6 @@ void VideoDecoder::close() {
 		delete *it;
 
 	_tracks.clear();
-	_needsRewind = false;
 	_dirtyPalette = false;
 	_palette = 0;
 	_startTime = 0;
@@ -271,8 +269,6 @@ bool VideoDecoder::rewind() {
 	if (!isRewindable())
 		return false;
 
-	_needsRewind = false;
-
 	// Stop all tracks so they can be rewound
 	if (isPlaying())
 		stopAudio();
@@ -306,8 +302,6 @@ bool VideoDecoder::seek(const Audio::Timestamp &time) {
 	if (!isSeekable())
 		return false;
 
-	_needsRewind = false;
-
 	// Stop all tracks so they can be seeked
 	if (isPlaying())
 		stopAudio();
@@ -337,10 +331,6 @@ void VideoDecoder::start() {
 	_isPlaying = true;
 	_startTime = g_system->getMillis();
 
-	// If someone previously called stop(), we'll rewind it.
-	if (_needsRewind)
-		rewind();
-
 	// Adjust start time if we've seeked to something besides zero time
 	if (_lastTimeChange.totalNumberOfFrames() != 0)
 		_startTime -= _lastTimeChange.msecs();
@@ -363,15 +353,8 @@ void VideoDecoder::stop() {
 	// Also reset the pause state.
 	_pauseLevel = 0;
 
-	// If this is a rewindable video, don't close it too. We'll just rewind() the video
-	// the next time someone calls start(). Otherwise, since it can't be rewound, we
-	// just close it.
-	if (isRewindable()) {
-		_lastTimeChange = getTime();
-		_needsRewind = true;
-	} else {
-		close();
-	}
+	// Keep the time marked down in case we start up again
+	_lastTimeChange = getTime();
 }
 
 Audio::Timestamp VideoDecoder::getDuration() const {
diff --git a/video/video_decoder.h b/video/video_decoder.h
index daf78c2..66980ab 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -102,16 +102,14 @@ public:
 	/**
 	 * Begin playback of the video.
 	 *
-	 * @note This has no effect is the video is already playing.
+	 * @note This has no effect if the video is already playing.
 	 */
 	void start();
 
 	/**
 	 * Stop playback of the video.
 	 *
-	 * @note This will close() the video if it is not rewindable.
-	 * @note If the video is rewindable, the video will be rewound on the
-	 * next start() call unless rewind() or seek() is called before then.
+	 * @note This has no effect if the video is not playing.
 	 */
 	void stop();
 
@@ -765,7 +763,7 @@ private:
 	TrackList _tracks;
 
 	// Current playback status
-	bool _isPlaying, _needsRewind, _needsUpdate;
+	bool _isPlaying, _needsUpdate;
 	Audio::Timestamp _lastTimeChange, _endTime;
 	bool _endTimeSet;
 






More information about the Scummvm-git-logs mailing list