1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/VorbisUtils.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,27 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef VORBISUTILS_H_ 1.11 +#define VORBISUTILS_H_ 1.12 + 1.13 +#ifdef MOZ_SAMPLE_TYPE_S16 1.14 +#include <ogg/os_types.h> 1.15 +typedef ogg_int32_t VorbisPCMValue; 1.16 + 1.17 +#define MOZ_CLIP_TO_15(x) ((x)<-32768?-32768:(x)<=32767?(x):32767) 1.18 +// Convert the output of vorbis_synthesis_pcmout to a AudioDataValue 1.19 +#define MOZ_CONVERT_VORBIS_SAMPLE(x) \ 1.20 + (static_cast<AudioDataValue>(MOZ_CLIP_TO_15((x)>>9))) 1.21 + 1.22 +#else /* MOZ_SAMPLE_TYPE_FLOAT32 */ 1.23 + 1.24 +typedef float VorbisPCMValue; 1.25 + 1.26 +#define MOZ_CONVERT_VORBIS_SAMPLE(x) (x) 1.27 + 1.28 +#endif 1.29 + 1.30 +#endif /* VORBISUTILS_H_ */