aboutsummaryrefslogtreecommitdiff
path: root/video/video_decoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'video/video_decoder.cpp')
-rw-r--r--video/video_decoder.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index 1461f5dc3d..355c94abb1 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -256,12 +256,18 @@ bool AdvancedVideoDecoder::rewind() {
_needsRewind = false;
- // TODO: Pause status
+ // Stop all tracks so they can be rewound
+ if (_isPlaying)
+ stopAllTracks();
for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
if (!(*it)->rewind())
return false;
+ // Now that we've rewound, start all tracks again
+ if (_isPlaying)
+ startAllTracks();
+
_audioStartOffset = 0;
_startTime = g_system->getMillis();
return true;
@@ -284,12 +290,18 @@ bool AdvancedVideoDecoder::seek(const Audio::Timestamp &time) {
_needsRewind = false;
- // TODO: Pause status
+ // Stop all tracks so they can be seeked
+ if (_isPlaying)
+ stopAllTracks();
for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
if (!(*it)->seek(time))
return false;
+ // Now that we've seeked, start all tracks again
+ if (_isPlaying)
+ startAllTracks();
+
_audioStartOffset = time;
_startTime = g_system->getMillis() - time.msecs();
return true;
@@ -307,8 +319,7 @@ void AdvancedVideoDecoder::start() {
if (_needsRewind)
rewind();
- for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
- (*it)->start();
+ startAllTracks();
}
void AdvancedVideoDecoder::stop() {
@@ -321,8 +332,7 @@ void AdvancedVideoDecoder::stop() {
_palette = 0;
_dirtyPalette = false;
- for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
- (*it)->stop();
+ stopAllTracks();
// Also reset the pause state.
_pauseLevel = 0;
@@ -584,6 +594,16 @@ const AdvancedVideoDecoder::VideoTrack *AdvancedVideoDecoder::findNextVideoTrack
return bestTrack;
}
+void AdvancedVideoDecoder::startAllTracks() {
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ (*it)->start();
+}
+
+void AdvancedVideoDecoder::stopAllTracks() {
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ (*it)->stop();
+}
+
//////////////////////////////////////////////
///////////////// DEPRECATED /////////////////
//////////////////////////////////////////////