1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
diff --git a/lib/rbcodec/codecs/libopus/celt/float_cast.h b/lib/rbcodec/codecs/libopus/celt/float_cast.h
index 36a13fc..5ded291 100644
--- a/lib/rbcodec/codecs/libopus/celt/float_cast.h
+++ b/lib/rbcodec/codecs/libopus/celt/float_cast.h
@@ -90,14 +90,14 @@
 #include <math.h>
 #define float2int(x) lrint(x)
 
-#elif (_MSC_VER >= 1400) && (defined (WIN64) || defined (_WIN64))
+#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN64) || defined (_WIN64))
         #include <xmmintrin.h>
 
         __inline long int float2int(float value)
         {
                 return _mm_cvtss_si32(_mm_load_ss(&value));
         }
-#elif (_MSC_VER >= 1400) && (defined (WIN32) || defined (_WIN32))
+#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN32) || defined (_WIN32))
         #include <math.h>
 
         /*      Win32 doesn't seem to have these functions.
@@ -127,6 +127,7 @@
         #define float2int(flt) ((int)(floor(.5+flt)))
 #endif
 
+#ifndef DISABLE_FLOAT_API
 static inline opus_int16 FLOAT2INT16(float x)
 {
    x = x*CELT_SIG_SCALE;
@@ -134,5 +135,6 @@ static inline opus_int16 FLOAT2INT16(float x)
    x = MIN32(x, 32767);
    return (opus_int16)float2int(x);
 }
+#endif /* DISABLE_FLOAT_API */
 
 #endif /* FLOAT_CAST_H */
diff --git a/lib/rbcodec/codecs/libopus/libopus.make b/lib/rbcodec/codecs/libopus/libopus.make
index 1df52db..2b5b0cf 100644
--- a/lib/rbcodec/codecs/libopus/libopus.make
+++ b/lib/rbcodec/codecs/libopus/libopus.make
@@ -14,6 +14,7 @@ OPUSLIB_OBJ := $(call c2obj, $(OPUSLIB_SRC))
 
 # codec specific compilation flags
 $(OPUSLIB) : CODECFLAGS += -DHAVE_CONFIG_H \
+   -DDISABLE_FLOAT_API \
    -I$(RBCODECLIB_DIR)/codecs/libopus \
    -I$(RBCODECLIB_DIR)/codecs/libopus/celt \
    -I$(RBCODECLIB_DIR)/codecs/libopus/silk \
diff --git a/lib/rbcodec/codecs/libopus/opus_defines.h b/lib/rbcodec/codecs/libopus/opus_defines.h
index a16bd64..b2a559d 100644
--- a/lib/rbcodec/codecs/libopus/opus_defines.h
+++ b/lib/rbcodec/codecs/libopus/opus_defines.h
@@ -87,7 +87,7 @@ extern "C" {
 #if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
 # if OPUS_GNUC_PREREQ(3,0)
 #  define OPUS_RESTRICT __restrict__
-# elif (_MSC_VER >= 1400)
+# elif (defined(_MSC_VER) && _MSC_VER >= 1400)
 #  define OPUS_RESTRICT __restrict
 # else
 #  define OPUS_RESTRICT