VIDEO: Fix Theora playback when building with Tremor

This commit is contained in:
Cameron Cawley 2018-08-01 20:10:55 +01:00 committed by Eugene Sandulenko
parent 2649c429db
commit 5cf3b75deb
2 changed files with 7 additions and 1 deletions

2
configure vendored
View file

@ -4205,7 +4205,7 @@ echo "$_png"
# Check for Theora Decoder # Check for Theora Decoder
# #
echocheck "libtheoradec >= 1.0" echocheck "libtheoradec >= 1.0"
if test "$_vorbis" = no ; then if test "$_vorbis" = no && test "$_tremor" = no ; then
echo "skipping. no vorbis" echo "skipping. no vorbis"
_theoradec=notsupported _theoradec=notsupported
fi fi

View file

@ -356,9 +356,11 @@ Audio::AudioStream *TheoraDecoder::VorbisAudioTrack::getAudioStream() const {
#define AUDIOFD_FRAGSIZE 10240 #define AUDIOFD_FRAGSIZE 10240
#ifndef USE_TREMOR
static double rint(double v) { static double rint(double v) {
return floor(v + 0.5); return floor(v + 0.5);
} }
#endif
bool TheoraDecoder::VorbisAudioTrack::decodeSamples() { bool TheoraDecoder::VorbisAudioTrack::decodeSamples() {
#ifdef USE_TREMOR #ifdef USE_TREMOR
@ -383,7 +385,11 @@ bool TheoraDecoder::VorbisAudioTrack::decodeSamples() {
for (i = 0; i < ret && i < maxsamples; i++) { for (i = 0; i < ret && i < maxsamples; i++) {
for (int j = 0; j < channels; j++) { 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); int val = CLIP((int)rint(pcm[j][i] * 32767.f), -32768, 32767);
#endif
_audioBuffer[count++] = val; _audioBuffer[count++] = val;
} }
} }