summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorpl <pl@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-05 20:15:25 +0000
committerpl <pl@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-05 20:15:25 +0000
commit67b1c950adeae2787e269c5511e8499d4bb4faba (patch)
tree1b6650192ab5ef1275e8900a8d04133aa990d504 /libao2
parent7c4a359fd3287781d19141e0739c8ccde9732991 (diff)
downloadmpv-67b1c950adeae2787e269c5511e8499d4bb4faba.tar.bz2
mpv-67b1c950adeae2787e269c5511e8499d4bb4faba.tar.xz
proper bsd fix & preventive fix for other archs w/o INT_MAX
(INT_MAX is 0x7fffffff in the freebsd headers I have) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4944 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r--libao2/pl_volnorm.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/libao2/pl_volnorm.c b/libao2/pl_volnorm.c
index 8c9373fc30..569e861aff 100644
--- a/libao2/pl_volnorm.c
+++ b/libao2/pl_volnorm.c
@@ -23,12 +23,6 @@
#include "audio_plugin_internal.h"
#include "afmt.h"
-#ifdef __FreeBSD__
-#include "machine/limits.h"
-#define INT16_MAX INT_MAX
-#define INT16_MIN INT_MIN
-#endif
-
static ao_info_t info = {
"Volume normalizer",
"volnorm",
@@ -53,11 +47,15 @@ static float lastavg;
#define SMOOTH_MUL 0.06
#define SMOOTH_LASTAVG 0.06
+// Some limits
+#define MIN_S16 -32768
+#define MAX_S16 32767
+
// ideal average level
-#define MID_S16 (INT16_MAX * 0.25)
+#define MID_S16 (MAX_S16 * 0.25)
// silence level
-#define SIL_S16 (INT16_MAX * 0.02)
+#define SIL_S16 (MAX_S16 * 0.02)
// local data
static struct {
@@ -151,7 +149,7 @@ static int play(){
// Scale & clamp the samples
for (i=0; i < len ; ++i) {
tmp = data[i] * mul;
- CLAMP(tmp, INT16_MIN, INT16_MAX);
+ CLAMP(tmp, MIN_S16, MAX_S16);
data[i] = tmp;
}