1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libsoundtouch/moz-libsoundtouch.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,159 @@ 1.4 +diff -u /src/cpu_detect_x86.cpp /src/cpu_detect_x86.cpp 1.5 +--- /src/cpu_detect_x86.cpp 1.6 ++++ /src/cpu_detect_x86.cpp 1.7 +@@ -44,9 +44,8 @@ 1.8 + 1.9 + 1.10 + #if defined(SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS) 1.11 +- 1.12 +- #if defined(__GNUC__) && defined(__i386__) 1.13 +- // gcc 1.14 ++ #if defined(__GNUC__) && defined(HAVE_CPUID_H) 1.15 ++ // gcc and clang 1.16 + #include "cpuid.h" 1.17 + #elif defined(_M_IX86) 1.18 + // windows non-gcc 1.19 +@@ -97,18 +96,7 @@ 1.20 + 1.21 + uint res = 0; 1.22 + 1.23 +-#if defined(__GNUC__) 1.24 +- // GCC version of cpuid. Requires GCC 4.3.0 or later for __cpuid intrinsic support. 1.25 +- uint eax, ebx, ecx, edx; // unsigned int is the standard type. uint is defined by the compiler and not guaranteed to be portable. 1.26 +- 1.27 +- // Check if no cpuid support. 1.28 +- if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) return 0; // always disable extensions. 1.29 +- 1.30 +- if (edx & bit_MMX) res = res | SUPPORT_MMX; 1.31 +- if (edx & bit_SSE) res = res | SUPPORT_SSE; 1.32 +- if (edx & bit_SSE2) res = res | SUPPORT_SSE2; 1.33 +- 1.34 +-#else 1.35 ++#if !defined(__GNUC__) 1.36 + // Window / VS version of cpuid. Notice that Visual Studio 2005 or later required 1.37 + // for __cpuid intrinsic support. 1.38 + int reg[4] = {-1}; 1.39 +@@ -121,7 +109,19 @@ 1.40 + if ((unsigned int)reg[3] & bit_MMX) res = res | SUPPORT_MMX; 1.41 + if ((unsigned int)reg[3] & bit_SSE) res = res | SUPPORT_SSE; 1.42 + if ((unsigned int)reg[3] & bit_SSE2) res = res | SUPPORT_SSE2; 1.43 ++#elif defined(HAVE_CPUID_H) 1.44 ++ // GCC version of cpuid. Requires GCC 4.3.0 or later for __cpuid intrinsic support. 1.45 ++ uint eax, ebx, ecx, edx; // unsigned int is the standard type. uint is defined by the compiler and not guaranteed to be portable. 1.46 ++ 1.47 ++ // Check if no cpuid support. 1.48 ++ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) return 0; // always disable extensions. 1.49 + 1.50 ++ if (edx & bit_MMX) res = res | SUPPORT_MMX; 1.51 ++ if (edx & bit_SSE) res = res | SUPPORT_SSE; 1.52 ++ if (edx & bit_SSE2) res = res | SUPPORT_SSE2; 1.53 ++#else 1.54 ++ // Compatible with GCC but no cpuid.h. 1.55 ++ return 0; 1.56 + #endif 1.57 + 1.58 + return res & ~_dwDisabledISA; 1.59 +diff -u /src/STTypes.h /src/STTypes.h 1.60 +--- /src/STTypes.h 1.61 ++++ /src/STTypes.h 1.62 +@@ -54,12 +54,17 @@ 1.63 + #define SOUNDTOUCH_ALIGN_POINTER_16(x) ( ( (ulongptr)(x) + 15 ) & ~(ulongptr)15 ) 1.64 + 1.65 + 1.66 +-#if (defined(__GNUC__) && !defined(ANDROID)) 1.67 +- // In GCC, include soundtouch_config.h made by config scritps. 1.68 +- // Skip this in Android compilation that uses GCC but without configure scripts. 1.69 +- #include "soundtouch_config.h" 1.70 +-#endif 1.71 ++#include "soundtouch_config.h" 1.72 + 1.73 ++#ifdef WIN32 1.74 ++#ifdef BUILDING_SOUNDTOUCH 1.75 ++#define EXPORT __declspec(dllexport) 1.76 ++#else 1.77 ++#define EXPORT __declspec(dllimport) 1.78 ++#endif 1.79 ++#else 1.80 ++#define EXPORT 1.81 ++#endif 1.82 + 1.83 + namespace soundtouch 1.84 + { 1.85 +@@ -164,7 +169,7 @@ 1.86 + }; 1.87 + 1.88 + // define ST_NO_EXCEPTION_HANDLING switch to disable throwing std exceptions: 1.89 +-// #define ST_NO_EXCEPTION_HANDLING 1 1.90 ++#define ST_NO_EXCEPTION_HANDLING 1 1.91 + #ifdef ST_NO_EXCEPTION_HANDLING 1.92 + // Exceptions disabled. Throw asserts instead if enabled. 1.93 + #include <assert.h> 1.94 +diff -u /src/SoundTouch.h /src/SoundTouch.h 1.95 +--- /src/SoundTouch.h 1.96 ++++ /src/SoundTouch.h 1.97 +@@ -141,7 +141,7 @@ 1.98 + /// tempo/pitch/rate/samplerate settings. 1.99 + #define SETTING_NOMINAL_OUTPUT_SEQUENCE 7 1.100 + 1.101 +-class SoundTouch : public FIFOProcessor 1.102 ++class EXPORT SoundTouch : public FIFOProcessor 1.103 + { 1.104 + private: 1.105 + /// Rate transposer class instance 1.106 +diff -u /src/FIRFilter.cpp /src/FIRFilter.cpp 1.107 +--- /src/FIRFilter.cpp 1.108 ++++ /src/FIRFilter.cpp 1.109 +@@ -46,6 +46,11 @@ 1.110 + #include "FIRFilter.h" 1.111 + #include "cpu_detect.h" 1.112 + 1.113 ++#ifdef _MSC_VER 1.114 ++#include <malloc.h> 1.115 ++#define alloca _alloca 1.116 ++#endif 1.117 ++ 1.118 + using namespace soundtouch; 1.119 + 1.120 + /***************************************************************************** 1.121 +@@ -291,9 +296,11 @@ 1.122 + 1.123 + FIRFilter * FIRFilter::newInstance() 1.124 + { 1.125 ++#if defined(SOUNDTOUCH_ALLOW_MMX) || defined(SOUNDTOUCH_ALLOW_SSE) 1.126 + uint uExtensions; 1.127 + 1.128 + uExtensions = detectCPUextensions(); 1.129 ++#endif 1.130 + 1.131 + // Check if MMX/SSE instruction set extensions supported by CPU 1.132 + 1.133 +diff -u /src/TDStretch.cpp /src/TDStretch.cpp 1.134 +--- /src/TDStretch.cpp 1.135 ++++ /src/TDStretch.cpp 1.136 +@@ -624,9 +624,11 @@ 1.137 + 1.138 + TDStretch * TDStretch::newInstance() 1.139 + { 1.140 ++#if defined(SOUNDTOUCH_ALLOW_MMX) || defined(SOUNDTOUCH_ALLOW_SSE) 1.141 + uint uExtensions; 1.142 + 1.143 + uExtensions = detectCPUextensions(); 1.144 ++#endif 1.145 + 1.146 + // Check if MMX/SSE instruction set extensions supported by CPU 1.147 + 1.148 +diff -u /src/SoundTouch.cpp /src/SoundTouch.cpp 1.149 +--- /src/SoundTouch.cpp 1.150 ++++ /src/SoundTouch.cpp 1.151 +@@ -80,6 +80,11 @@ 1.152 + #include "RateTransposer.h" 1.153 + #include "cpu_detect.h" 1.154 + 1.155 ++#ifdef _MSC_VER 1.156 ++#include <malloc.h> 1.157 ++#define alloca _alloca 1.158 ++#endif 1.159 ++ 1.160 + using namespace soundtouch; 1.161 + 1.162 + /// test if two floating point numbers are equal