[Scummvm-cvs-logs] SF.net SVN: scummvm:[51897] scummvm/trunk/graphics/video
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Sun Aug 8 02:56:29 CEST 2010
Revision: 51897
http://scummvm.svn.sourceforge.net/scummvm/?rev=51897&view=rev
Author: drmccoy
Date: 2010-08-08 00:56:29 +0000 (Sun, 08 Aug 2010)
Log Message:
-----------
VIDEO: Move the frame calculation out of seek()
Modified Paths:
--------------
scummvm/trunk/graphics/video/coktel_decoder.cpp
scummvm/trunk/graphics/video/coktel_decoder.h
Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp 2010-08-08 00:56:04 UTC (rev 51896)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp 2010-08-08 00:56:29 UTC (rev 51897)
@@ -47,6 +47,28 @@
CoktelDecoder::~CoktelDecoder() {
}
+bool CoktelDecoder::evaluateSeekFrame(int32 &frame, int whence) const {
+ if (!isVideoLoaded())
+ // Nothing to do
+ return false;
+
+ // Find the frame to which to seek
+ if (whence == SEEK_CUR)
+ frame += _curFrame;
+ else if (whence == SEEK_END)
+ frame = _frameCount - frame - 1;
+ else if (whence == SEEK_SET)
+ frame--;
+ else
+ return false;
+
+ if ((frame < -1) || (frame >= ((int32) _frameCount)))
+ // Out of range
+ return false;
+
+ return true;
+}
+
void CoktelDecoder::setSurfaceMemory(void *mem, uint16 width, uint16 height, uint8 bpp) {
freeSurface();
@@ -488,24 +510,9 @@
}
bool PreIMDDecoder::seek(int32 frame, int whence, bool restart) {
- if (!isVideoLoaded())
- // Nothing to do
+ if (!evaluateSeekFrame(frame, whence))
return false;
- // Find the frame to which to seek
- if (whence == SEEK_CUR)
- frame += _curFrame;
- else if (whence == SEEK_END)
- frame = _frameCount - frame - 1;
- else if (whence == SEEK_SET)
- frame--;
- else
- return false;
-
- if ((frame < -1) || (((uint32) frame) >= _frameCount))
- // Out of range
- return false;
-
if (frame == _curFrame)
// Nothing to do
return true;
@@ -693,24 +700,9 @@
}
bool IMDDecoder::seek(int32 frame, int whence, bool restart) {
- if (!isVideoLoaded())
- // Nothing to do
+ if (!evaluateSeekFrame(frame, whence))
return false;
- // Find the frame to which to seek
- if (whence == SEEK_CUR)
- frame += _curFrame;
- else if (whence == SEEK_END)
- frame = _frameCount - frame - 1;
- else if (whence == SEEK_SET)
- frame--;
- else
- return false;
-
- if ((frame < -1) || (frame >= ((int32) _frameCount)))
- // Out of range
- return false;
-
if (frame == _curFrame)
// Nothing to do
return true;
@@ -1325,24 +1317,9 @@
}
bool VMDDecoder::seek(int32 frame, int whence, bool restart) {
- if (!isVideoLoaded())
- // Nothing to do
+ if (!evaluateSeekFrame(frame, whence))
return false;
- // Find the frame to which to seek
- if (whence == SEEK_CUR)
- frame += _curFrame;
- else if (whence == SEEK_END)
- frame = _frameCount - frame - 1;
- else if (whence == SEEK_SET)
- frame--;
- else
- return false;
-
- if ((frame < -1) || (((uint32) frame) >= _frameCount))
- // Out of range
- return false;
-
if (frame == _curFrame)
// Nothing to do
return true;
Modified: scummvm/trunk/graphics/video/coktel_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.h 2010-08-08 00:56:04 UTC (rev 51896)
+++ scummvm/trunk/graphics/video/coktel_decoder.h 2010-08-08 00:56:29 UTC (rev 51897)
@@ -171,6 +171,8 @@
Audio::QueuingAudioStream *_audioStream;
Audio::SoundHandle _audioHandle;
+ bool evaluateSeekFrame(int32 &frame, int whence) const;
+
// Surface management
bool hasSurface();
void createSurface();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list