diff options
Diffstat (limited to 'engines/bladerunner/vqa_player.cpp')
-rw-r--r-- | engines/bladerunner/vqa_player.cpp | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp index f6eecc85ed..12baa26d76 100644 --- a/engines/bladerunner/vqa_player.cpp +++ b/engines/bladerunner/vqa_player.cpp @@ -108,42 +108,40 @@ int VQAPlayer::update() { return -3; } + if (now < _frameNextTime) { + return -1; + } + + int frame = _frameNext; + _decoder.readFrame(_frameNext, 0x2); + _decoder.decodeVideoFrame(); -// TODO: preload audio in better way - int audioPreloadFrames = 3; - - if (now >= _frameNextTime) { - int frame = _frameNext; - _decoder.readFrame(_frameNext, 0x2); - _decoder.decodeVideoFrame(); - - if (_hasAudio) { - if (!_audioStarted) { - for (int i = 0; i < audioPreloadFrames; i++) { - if (_frameNext + i < _frameEnd) { - _decoder.readFrame(_frameNext + i, 0x1); - queueAudioFrame(_decoder.decodeAudioFrame()); - } + int audioPreloadFrames = 14; + + if (_hasAudio) { + if (!_audioStarted) { + for (int i = 0; i < audioPreloadFrames; i++) { + if (_frameNext + i < _frameEnd) { + _decoder.readFrame(_frameNext + i, 0x1); + queueAudioFrame(_decoder.decodeAudioFrame()); } - _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, _audioStream); - _audioStarted = true; - } - if (_frameNext + audioPreloadFrames < _frameEnd) { - _decoder.readFrame(_frameNext + audioPreloadFrames, 0x1); - queueAudioFrame(_decoder.decodeAudioFrame()); } + _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, _audioStream); + _audioStarted = true; } - if (_frameNextTime == 0) { - _frameNextTime = now + 60000 / 15; - } else { - _frameNextTime += 60000 / 15; + if (_frameNext + audioPreloadFrames < _frameEnd) { + _decoder.readFrame(_frameNext + audioPreloadFrames, 0x1); + queueAudioFrame(_decoder.decodeAudioFrame()); } - - _frameNext++; - return frame; + } + if (_frameNextTime == 0) { + _frameNextTime = now + 60000 / 15; + } else { + _frameNextTime += 60000 / 15; } - return -1; + _frameNext++; + return frame; } void VQAPlayer::updateZBuffer(ZBuffer *zbuffer) { @@ -159,7 +157,9 @@ void VQAPlayer::updateLights(Lights *lights) { } bool VQAPlayer::setLoop(int loop, int repeatsCount, int loopSetMode, void (*callback)(void *, int, int), void *callbackData) { +#if 0 debug("VQAPlayer::setBeginAndEndFrameFromLoop(%i, %i, %i), streamLoaded = %i", loop, repeatsCount, loopSetMode, _s != nullptr); +#endif if (_s == nullptr) { _loopInitial = loop; _repeatsCountInitial = repeatsCount; @@ -178,7 +178,9 @@ bool VQAPlayer::setLoop(int loop, int repeatsCount, int loopSetMode, void (*call } bool VQAPlayer::setBeginAndEndFrame(int begin, int end, int repeatsCount, int loopSetMode, void (*callback)(void *, int, int), void *callbackData) { +#if 0 debug("VQAPlayer::setBeginAndEndFrame(%i, %i, %i, %i), streamLoaded = %i", begin, end, repeatsCount, loopSetMode, _s != nullptr); +#endif if (repeatsCount < 0) { repeatsCount = -1; |