aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/fmv/theora_decoder.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2010-10-30 08:21:10 +0000
committerTorbjörn Andersson2010-10-30 08:21:10 +0000
commit09c678e3631567330123b5035f3798fbbd6e8e82 (patch)
tree7fbbe2ccc42f209588ea5581b19e5459c5fe6897 /engines/sword25/fmv/theora_decoder.cpp
parent919d79f091bece96d33a7f1fba4cdab6d6b65821 (diff)
downloadscummvm-rg350-09c678e3631567330123b5035f3798fbbd6e8e82.tar.gz
scummvm-rg350-09c678e3631567330123b5035f3798fbbd6e8e82.tar.bz2
scummvm-rg350-09c678e3631567330123b5035f3798fbbd6e8e82.zip
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
Diffstat (limited to 'engines/sword25/fmv/theora_decoder.cpp')
-rw-r--r--engines/sword25/fmv/theora_decoder.cpp9
1 files 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;