aboutsummaryrefslogtreecommitdiff
path: root/graphics/video/video_player.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2010-05-17 21:59:05 +0000
committerMatthew Hoops2010-05-17 21:59:05 +0000
commitc7fa1074fbc55e9e519f9c7e08dea9603af22e61 (patch)
tree502ce42530df3ea513eebf7096dfc72bf05a3dd7 /graphics/video/video_player.cpp
parentea84abf5880f0af2642dd3de08a6d9c6f7f88426 (diff)
downloadscummvm-rg350-c7fa1074fbc55e9e519f9c7e08dea9603af22e61.tar.gz
scummvm-rg350-c7fa1074fbc55e9e519f9c7e08dea9603af22e61.tar.bz2
scummvm-rg350-c7fa1074fbc55e9e519f9c7e08dea9603af22e61.zip
Change VideoDecoder::getCurFrame() to mean the last frame drawn instead of the next frame to draw. This is patch 1 from patch #2963496 (VideoDecoder Rewrite).
svn-id: r49063
Diffstat (limited to 'graphics/video/video_player.cpp')
-rw-r--r--graphics/video/video_player.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/graphics/video/video_player.cpp b/graphics/video/video_player.cpp
index ed96ac5fc5..a8676ed594 100644
--- a/graphics/video/video_player.cpp
+++ b/graphics/video/video_player.cpp
@@ -39,6 +39,7 @@ namespace Graphics {
VideoDecoder::VideoDecoder() : _fileStream(0) {
_curFrameBlack = 0;
_curFrameWhite = 255;
+ _videoInfo.currentFrame = -1;
}
VideoDecoder::~VideoDecoder() {
@@ -56,13 +57,11 @@ int VideoDecoder::getHeight() {
return _videoInfo.height;
}
-int32 VideoDecoder::getCurFrame() {
- if (!_fileStream)
- return -1;
+int32 VideoDecoder::getCurFrame() const {
return _videoInfo.currentFrame;
}
-int32 VideoDecoder::getFrameCount() {
+int32 VideoDecoder::getFrameCount() const {
if (!_fileStream)
return 0;
return _videoInfo.frameCount;
@@ -152,6 +151,10 @@ void VideoDecoder::setPalette(byte *pal) {
g_system->setPalette(videoPalette, 0, 256);
}
+bool VideoDecoder::endOfVideo() const {
+ return !isVideoLoaded() || getCurFrame() >= (int32)getFrameCount() - 1;
+}
+
/*
* VideoPlayer
@@ -192,7 +195,7 @@ bool VideoPlayer::playVideo(Common::List<Common::Event> &stopEvents) {
int frameX = (g_system->getWidth() - _decoder->getWidth()) / 2;
int frameY = (g_system->getHeight() - _decoder->getHeight()) / 2;
- while (_decoder->getCurFrame() < _decoder->getFrameCount() && !_skipVideo) {
+ while (!_decoder->endOfVideo() && !_skipVideo) {
processVideoEvents(stopEvents);
uint32 startTime = 0;