aboutsummaryrefslogtreecommitdiff
path: root/video/theora_decoder.cpp
diff options
context:
space:
mode:
authorCameron Cawley2018-08-01 20:10:55 +0100
committerEugene Sandulenko2018-08-03 14:52:09 +0200
commit5cf3b75deb345b6e76699a208dd94d4cfcb4ea12 (patch)
tree95c54d85f11e06f4affa6f3c249186489cde2516 /video/theora_decoder.cpp
parent2649c429dbf30e1035fbc2d59a70e390b30327b2 (diff)
downloadscummvm-rg350-5cf3b75deb345b6e76699a208dd94d4cfcb4ea12.tar.gz
scummvm-rg350-5cf3b75deb345b6e76699a208dd94d4cfcb4ea12.tar.bz2
scummvm-rg350-5cf3b75deb345b6e76699a208dd94d4cfcb4ea12.zip
VIDEO: Fix Theora playback when building with Tremor
Diffstat (limited to 'video/theora_decoder.cpp')
-rw-r--r--video/theora_decoder.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/video/theora_decoder.cpp b/video/theora_decoder.cpp
index 7ed9738ea9..f00bd485f9 100644
--- a/video/theora_decoder.cpp
+++ b/video/theora_decoder.cpp
@@ -356,9 +356,11 @@ Audio::AudioStream *TheoraDecoder::VorbisAudioTrack::getAudioStream() const {
#define AUDIOFD_FRAGSIZE 10240
+#ifndef USE_TREMOR
static double rint(double v) {
return floor(v + 0.5);
}
+#endif
bool TheoraDecoder::VorbisAudioTrack::decodeSamples() {
#ifdef USE_TREMOR
@@ -383,7 +385,11 @@ bool TheoraDecoder::VorbisAudioTrack::decodeSamples() {
for (i = 0; i < ret && i < maxsamples; i++) {
for (int j = 0; j < channels; j++) {
+#ifdef USE_TREMOR
+ int val = CLIP(pcm[j][i] >> 9, -32768, 32767);
+#else
int val = CLIP((int)rint(pcm[j][i] * 32767.f), -32768, 32767);
+#endif
_audioBuffer[count++] = val;
}
}