b=1033140 make speex_resampler declarations consistent with OUTSIDE_SPEEX implementation r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 02 Jul 2014 20:22:45 +1200
changeset 192471 0f1cea1a1a952c84d2a5758dbf9efc3ee6fe5dfc
parent 192470 1370a39b329a0e845eff93d4cd0c0c7191cbfde6
child 192472 f6c7cc1c3337498c501e648b2f81b9846d9e7cf0
push id27086
push userttaubert@mozilla.com
push dateSun, 06 Jul 2014 16:11:25 +0000
treeherdermozilla-central@9f59e39f70a5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1033140
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
b=1033140 make speex_resampler declarations consistent with OUTSIDE_SPEEX implementation r=padenot Instead of defining OUTSIDE_SPEEX and RANDOM_PREFIX everywhere speex_resampler.h is included, it is easier to patch the header. Symbol names in gkmedias symbols.def are updated now that RANDOM_PREFIX is taking effect, and unused symbols are no longer exported.
layout/media/symbols.def.in
media/libspeex_resampler/outside-speex.patch
media/libspeex_resampler/src/moz.build
media/libspeex_resampler/src/speex_config_types.h
media/libspeex_resampler/src/speex_resampler.h
media/libspeex_resampler/src/speex_types.h
media/libspeex_resampler/update.sh
--- a/layout/media/symbols.def.in
+++ b/layout/media/symbols.def.in
@@ -105,39 +105,29 @@ vorbis_packet_blocksize
 vorbis_synthesis
 vorbis_synthesis_blockin
 vorbis_synthesis_headerin
 vorbis_synthesis_init
 vorbis_synthesis_pcmout
 vorbis_synthesis_read
 vorbis_synthesis_restart
 #endif
-speex_resampler_init
-speex_resampler_init_frac
-speex_resampler_destroy
-speex_resampler_process_float
-speex_resampler_process_int
-speex_resampler_process_interleaved_float
-speex_resampler_process_interleaved_int
-speex_resampler_set_rate
-speex_resampler_get_rate
-speex_resampler_set_rate_frac
-speex_resampler_get_ratio
-speex_resampler_set_quality
-speex_resampler_get_quality
-speex_resampler_set_input_stride
-speex_resampler_get_input_stride
-speex_resampler_set_output_stride
-speex_resampler_get_output_stride
-speex_resampler_get_input_latency
-speex_resampler_get_output_latency
-speex_resampler_skip_zeros
-speex_resampler_set_skip_frac_num
-speex_resampler_reset_mem
-speex_resampler_strerror
+moz_speex_resampler_init
+moz_speex_resampler_destroy
+moz_speex_resampler_process_float
+moz_speex_resampler_process_interleaved_float
+moz_speex_resampler_process_interleaved_int
+moz_speex_resampler_set_rate
+moz_speex_resampler_get_rate
+moz_speex_resampler_get_ratio
+moz_speex_resampler_get_input_latency
+moz_speex_resampler_get_output_latency
+moz_speex_resampler_skip_zeros
+moz_speex_resampler_set_skip_frac_num
+moz_speex_resampler_reset_mem
 cubeb_destroy
 cubeb_init
 cubeb_get_backend_id
 cubeb_get_max_channel_count
 cubeb_get_min_latency
 cubeb_get_preferred_sample_rate
 cubeb_stream_destroy
 cubeb_stream_get_position
new file mode 100644
--- /dev/null
+++ b/media/libspeex_resampler/outside-speex.patch
@@ -0,0 +1,30 @@
+diff --git a/media/libspeex_resampler/src/speex_resampler.h b/media/libspeex_resampler/src/speex_resampler.h
+--- a/media/libspeex_resampler/src/speex_resampler.h
++++ b/media/libspeex_resampler/src/speex_resampler.h
+@@ -34,24 +34,25 @@
+    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+    POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+ 
+ #ifndef SPEEX_RESAMPLER_H
+ #define SPEEX_RESAMPLER_H
+ 
+-#ifdef OUTSIDE_SPEEX
++#if 1 /* OUTSIDE_SPEEX */
+ 
+ /********* WARNING: MENTAL SANITY ENDS HERE *************/
+ 
+ /* If the resampler is defined outside of Speex, we change the symbol names so that 
+    there won't be any clash if linking with Speex later on. */
+ 
+ /* #define RANDOM_PREFIX your software name here */
++#define RANDOM_PREFIX moz_speex
+ #ifndef RANDOM_PREFIX
+ #error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
+ #endif
+ 
+ #define CAT_PREFIX2(a,b) a ## b
+ #define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
+       
+ #define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
--- a/media/libspeex_resampler/src/moz.build
+++ b/media/libspeex_resampler/src/moz.build
@@ -2,38 +2,33 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 LIBRARY_NAME = 'speex'
 
 EXPORTS.speex += [
-    'speex_config_types.h',
     'speex_resampler.h',
-    'speex_types.h',
 ]
 
 SOURCES += [
   'sse_detect.cpp',
 ]
 
 SOURCES += [
     'resample.c',
 ]
 
 MSVC_ENABLE_PGO = True
 
 FINAL_LIBRARY = 'gkmedias'
 
 # We don't compile the full speex codec, only the resampler.
 DEFINES['OUTSIDE_SPEEX'] = True
-# Speex wants a random prefix when building in another program, to avoid name
-# clashes
-DEFINES['RANDOM_PREFIX'] = 'speex'
 # We don't use -fvisibility=hidden
 DEFINES['SPX_RESAMPLE_EXPORT'] = ''
 
 if CONFIG['OS_TARGET'] == 'Android':
     DEFINES['FIXED_POINT'] = True
 else:
     DEFINES['FLOATING_POINT'] = True
 
deleted file mode 100644
--- a/media/libspeex_resampler/src/speex_config_types.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __SPEEX_TYPES_H__
-#define __SPEEX_TYPES_H__
-
-/* these are filled in by configure */
-typedef int16_t spx_int16_t;
-typedef uint16_t spx_uint16_t;
-typedef int32_t spx_int32_t;
-typedef uint32_t spx_uint32_t;
-
-#endif
-
--- a/media/libspeex_resampler/src/speex_resampler.h
+++ b/media/libspeex_resampler/src/speex_resampler.h
@@ -34,24 +34,25 @@
    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
 */
 
 
 #ifndef SPEEX_RESAMPLER_H
 #define SPEEX_RESAMPLER_H
 
-#ifdef OUTSIDE_SPEEX
+#if 1 /* OUTSIDE_SPEEX */
 
 /********* WARNING: MENTAL SANITY ENDS HERE *************/
 
 /* If the resampler is defined outside of Speex, we change the symbol names so that 
    there won't be any clash if linking with Speex later on. */
 
 /* #define RANDOM_PREFIX your software name here */
+#define RANDOM_PREFIX moz_speex
 #ifndef RANDOM_PREFIX
 #error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
 #endif
 
 #define CAT_PREFIX2(a,b) a ## b
 #define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
       
 #define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
deleted file mode 100644
--- a/media/libspeex_resampler/src/speex_types.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* speex_types.h taken from libogg */
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the Xiph.Org Foundation http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $
-
- ********************************************************************/
-/**
-   @file speex_types.h
-   @brief Speex types
-*/
-#ifndef _SPEEX_TYPES_H
-#define _SPEEX_TYPES_H
-
-#if defined(_WIN32) 
-
-#  if defined(__CYGWIN__)
-#    include <_G_config.h>
-     typedef _G_int32_t spx_int32_t;
-     typedef _G_uint32_t spx_uint32_t;
-     typedef _G_int16_t spx_int16_t;
-     typedef _G_uint16_t spx_uint16_t;
-#  elif defined(__MINGW32__)
-     typedef short spx_int16_t;
-     typedef unsigned short spx_uint16_t;
-     typedef int spx_int32_t;
-     typedef unsigned int spx_uint32_t;
-#  elif defined(__MWERKS__)
-     typedef int spx_int32_t;
-     typedef unsigned int spx_uint32_t;
-     typedef short spx_int16_t;
-     typedef unsigned short spx_uint16_t;
-#  else
-     /* MSVC/Borland */
-     typedef __int32 spx_int32_t;
-     typedef unsigned __int32 spx_uint32_t;
-     typedef __int16 spx_int16_t;
-     typedef unsigned __int16 spx_uint16_t;
-#  endif
-
-#elif defined(__MACOS__)
-
-#  include <sys/types.h>
-   typedef SInt16 spx_int16_t;
-   typedef UInt16 spx_uint16_t;
-   typedef SInt32 spx_int32_t;
-   typedef UInt32 spx_uint32_t;
-
-#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
-
-#  include <sys/types.h>
-   typedef int16_t spx_int16_t;
-   typedef u_int16_t spx_uint16_t;
-   typedef int32_t spx_int32_t;
-   typedef u_int32_t spx_uint32_t;
-
-#elif defined(__BEOS__)
-
-   /* Be */
-#  include <inttypes.h>
-   typedef int16_t spx_int16_t;
-   typedef u_int16_t spx_uint16_t;
-   typedef int32_t spx_int32_t;
-   typedef u_int32_t spx_uint32_t;
-
-#elif defined (__EMX__)
-
-   /* OS/2 GCC */
-   typedef short spx_int16_t;
-   typedef unsigned short spx_uint16_t;
-   typedef int spx_int32_t;
-   typedef unsigned int spx_uint32_t;
-
-#elif defined (DJGPP)
-
-   /* DJGPP */
-   typedef short spx_int16_t;
-   typedef int spx_int32_t;
-   typedef unsigned int spx_uint32_t;
-
-#elif defined(R5900)
-
-   /* PS2 EE */
-   typedef int spx_int32_t;
-   typedef unsigned spx_uint32_t;
-   typedef short spx_int16_t;
-
-#elif defined(__SYMBIAN32__)
-
-   /* Symbian GCC */
-   typedef signed short spx_int16_t;
-   typedef unsigned short spx_uint16_t;
-   typedef signed int spx_int32_t;
-   typedef unsigned int spx_uint32_t;
-
-#elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
-
-   typedef short spx_int16_t;
-   typedef unsigned short spx_uint16_t;
-   typedef long spx_int32_t;
-   typedef unsigned long spx_uint32_t;
-
-#elif defined(CONFIG_TI_C6X)
-
-   typedef short spx_int16_t;
-   typedef unsigned short spx_uint16_t;
-   typedef int spx_int32_t;
-   typedef unsigned int spx_uint32_t;
-
-#else
-
-# ifdef _BUILD_SPEEX
-#  include "include/speex/speex_config_types.h"
-#else
-#  include <speex/speex_config_types.h>
-#endif
-
-#endif
-
-#endif  /* _SPEEX_TYPES_H */
--- a/media/libspeex_resampler/update.sh
+++ b/media/libspeex_resampler/update.sh
@@ -13,11 +13,12 @@ cp $1/src/resample.c src
 cp $1/src/resample_sse.h src
 cp $1/src/arch.h src
 cp $1/src/stack_alloc.h src
 cp $1/src/speex_resampler.h src
 cp $1/AUTHORS .
 cp $1/COPYING .
 
 # apply outstanding local patches
+patch -p1 < outside-speex.patch
 patch -p1 < sse-detect-runtime.patch
 patch -p3 < reset.patch
 patch -p3 < set-skip-frac.patch