mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 06:39:17 +00:00
GRIM/SMUSH: Fix looping videos
This commit is contained in:
parent
88305a022e
commit
2472cc83a3
@ -323,10 +323,16 @@ void SmushDecoder::handleFRME(Common::SeekableReadStream *stream, uint32 size) {
|
||||
delete memStream;
|
||||
}
|
||||
|
||||
bool SmushDecoder::rewind() {
|
||||
return seekToFrame(0);
|
||||
}
|
||||
|
||||
bool SmushDecoder::seek(const Audio::Timestamp &time) { // FIXME: This will be off by a second or two right now.
|
||||
int32 wantedFrame = (uint32)((time.msecs() / 1000.0f) * _videoTrack->getFrameRate().toDouble());
|
||||
warning("Seek to time: %d, frame: %d", time.msecs(), wantedFrame);
|
||||
warning("Current frame: %d", _videoTrack->getCurFrame());
|
||||
if (wantedFrame != 0) {
|
||||
warning("Seek to time: %d, frame: %d", time.msecs(), wantedFrame);
|
||||
warning("Current frame: %d", _videoTrack->getCurFrame());
|
||||
}
|
||||
uint32 tag;
|
||||
int32 size;
|
||||
|
||||
@ -338,7 +344,7 @@ bool SmushDecoder::seek(const Audio::Timestamp &time) { // FIXME: This will be o
|
||||
_file->seek(_startPos, SEEK_SET);
|
||||
}
|
||||
|
||||
int curFrame = -1;
|
||||
int curFrame = 0;
|
||||
while (curFrame < wantedFrame) {
|
||||
tag = _file->readUint32BE();
|
||||
if (tag == MKTAG('A', 'N', 'N', 'O')) {
|
||||
@ -594,5 +600,4 @@ bool SmushDecoder::SmushAudioTrack::seek(const Audio::Timestamp &time) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // end of namespace Grim
|
||||
|
@ -46,7 +46,9 @@ public:
|
||||
int getX() const { return _videoTrack->_x; }
|
||||
int getY() const { return _videoTrack->_y; }
|
||||
void setLooping(bool l);
|
||||
bool isRewindable() const { return true; }
|
||||
bool isSeekable() const { return true; }
|
||||
bool rewind();
|
||||
bool seek(const Audio::Timestamp &time);
|
||||
bool loadStream(Common::SeekableReadStream *stream);
|
||||
protected:
|
||||
|
@ -65,6 +65,7 @@ void SmushPlayer::handleFrame() {
|
||||
return;
|
||||
} else {
|
||||
_smushDecoder->rewind(); // This doesnt handle if looping fails.
|
||||
_smushDecoder->start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user