From 09c678e3631567330123b5035f3798fbbd6e8e82 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 30 Oct 2010 08:21:10 +0000 Subject: SWORD25: Fix hanging cutscene video Even though our video player does not (yet) support audio, we need to adjust the values of _audiobufFill and _audiobufReady as if it did, or it will never realize it has reached the end of the cutscene. Also fixes what looks like a typo in audio data clipping. svn-id: r53938 --- engines/sword25/fmv/theora_decoder.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp index 8d30aa07ea..02e18b8fba 100644 --- a/engines/sword25/fmv/theora_decoder.cpp +++ b/engines/sword25/fmv/theora_decoder.cpp @@ -345,7 +345,7 @@ Graphics::Surface *TheoraDecoder::decodeNextFrame() { int maxsamples = (AUDIOFD_FRAGSIZE - _audiobufFill) / 2 / _vorbisInfo.channels; for (i = 0; i < ret && i < maxsamples; i++) for (j = 0; j < _vorbisInfo.channels; j++) { - int val = CLIP((int)rint(pcm[j][i] * 32767.f), -32768, 32768); + int val = CLIP((int)rint(pcm[j][i] * 32767.f), -32768, 32767); _audiobuf[count++] = val; } @@ -411,12 +411,15 @@ Graphics::Surface *TheoraDecoder::decodeNextFrame() { } // If playback has begun, top audio buffer off immediately. + if (_stateFlag && _audiobufReady) { /* FIXME: This is currently crashing - if (_stateFlag) { _audStream->queueBuffer((byte *)_audiobuf, AUDIOFD_FRAGSIZE, DisposeAfterUse::NO, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO); - } */ + _audiobufFill = 0; + _audiobufReady = false; + } + // are we at or past time for this video frame? if (_stateFlag && _videobufReady) { th_ycbcr_buffer yuv; -- cgit v1.2.3