[Mplayer-cvslog] CVS: main/libao2 pl_volnorm.c,1.2,1.3

pl pl at mplayer.dev.hu
Tue Mar 5 21:15:33 CET 2002


Update of /cvsroot/mplayer/main/libao2
In directory mplayer:/var/tmp.root/cvs-serv24469

Modified Files:
	pl_volnorm.c 
Log Message:
proper bsd fix & preventive fix for other archs w/o INT_MAX
(INT_MAX is 0x7fffffff in the freebsd headers I have)


Index: pl_volnorm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/pl_volnorm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pl_volnorm.c	5 Mar 2002 14:36:06 -0000	1.2
+++ pl_volnorm.c	5 Mar 2002 20:15:25 -0000	1.3
@@ -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 @@
 #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 @@
     // 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;
     }
 




More information about the MPlayer-cvslog mailing list