[Scummvm-cvs-logs] scummvm master -> 6e9390feb8166d5f9d6c6fdfe00a336b4f71de4c

clone2727 clone2727 at gmail.com
Wed Aug 7 04:31:54 CEST 2013


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:
6e9390feb8 VIDEO: Don't allow VideoDecoder::seek() to be overridden


Commit: 6e9390feb8166d5f9d6c6fdfe00a336b4f71de4c
    https://github.com/scummvm/scummvm/commit/6e9390feb8166d5f9d6c6fdfe00a336b4f71de4c
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2013-08-06T19:26:15-07:00

Commit Message:
VIDEO: Don't allow VideoDecoder::seek() to be overridden

A new seekIntern() that performs the actual seeking is to be overriden instead. Having the caller override seek() and then call VideoDecoder::seek() kind of defeated the purpose of stopping/starting the audio.

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



diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index 5df8110..a512a49 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -336,9 +336,9 @@ bool VideoDecoder::seek(const Audio::Timestamp &time) {
 	if (isPlaying())
 		stopAudio();
 
-	for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
-		if (!(*it)->seek(time))
-			return false;
+	// Do the actual seeking
+	if (!seekIntern(time))
+		return false;
 
 	_lastTimeChange = time;
 
@@ -471,6 +471,14 @@ Audio::Timestamp VideoDecoder::getDuration() const {
 	return maxDuration;
 }
 
+bool VideoDecoder::seekIntern(const Audio::Timestamp &time) {
+	for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+		if (!(*it)->seek(time))
+			return false;
+
+	return true;
+}
+
 VideoDecoder::Track::Track() {
 	_paused = false;
 }
diff --git a/video/video_decoder.h b/video/video_decoder.h
index d0a6e08..7811734 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -168,14 +168,15 @@ public:
 	/**
 	 * Seek to a given time in the video.
 	 *
-	 * If the video is playing, it will continue to play. The default
-	 * implementation will seek each track and must still be called
-	 * from any other implementation.
+	 * If the video is playing, it will continue to play. This calls
+	 * seekIntern(), which can be overriden. By default, seekIntern()
+	 * will call Track::seek() on all tracks with the time passed to
+	 * this function.
 	 *
 	 * @param time The time to seek to
 	 * @return true on success, false otherwise
 	 */
-	virtual bool seek(const Audio::Timestamp &time);
+	bool seek(const Audio::Timestamp &time);
 
 	/**
 	 * Seek to a given frame.
@@ -820,6 +821,15 @@ protected:
 	 */
 	TrackListIterator getTrackListEnd() { return _tracks.end(); }
 
+	/**
+	 * The internal seek function that does the actual seeking.
+	 *
+	 * @see seek()
+	 *
+	 * @return true on success, false otherwise
+	 */
+	virtual bool seekIntern(const Audio::Timestamp &time);
+
 private:
 	// Tracks owned by this VideoDecoder
 	TrackList _tracks;






More information about the Scummvm-git-logs mailing list