[xiph-commits] r12501 - in trunk/speex: include/speex libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Wed Feb 21 05:46:36 PST 2007
Author: jm
Date: 2007-02-21 05:46:27 -0800 (Wed, 21 Feb 2007)
New Revision: 12501
Modified:
trunk/speex/include/speex/speex_resampler.h
trunk/speex/libspeex/resample.c
Log:
Preventing symbol clashes in case the resampler is copied
outside of Speex, but we end up linking with Speex anyway.
This is ugly!
Modified: trunk/speex/include/speex/speex_resampler.h
===================================================================
--- trunk/speex/include/speex/speex_resampler.h 2007-02-21 08:42:27 UTC (rev 12500)
+++ trunk/speex/include/speex/speex_resampler.h 2007-02-21 13:46:27 UTC (rev 12501)
@@ -41,23 +41,56 @@
#ifdef 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 */
+#ifndef RANDOM_PREFIX
+#error Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes
+#endif
+
+#define speex_resampler_init RANDOM_PREFIX ## _resampler_init
+#define speex_resampler_init_frac RANDOM_PREFIX ## _resampler_init_frac
+#define speex_resampler_destroy RANDOM_PREFIX ## _resampler_destroy
+#define speex_resampler_process_float RANDOM_PREFIX ## _resampler_process_float
+#define speex_resampler_process_int RANDOM_PREFIX ## _resampler_process_int
+#define speex_resampler_process_interleaved_float RANDOM_PREFIX ## _resampler_process_interleaved_float
+#define speex_resampler_process_interleaved_int RANDOM_PREFIX ## _resampler_process_interleaved_int
+#define speex_resampler_set_rate RANDOM_PREFIX ## _resampler_set_rate
+#define speex_resampler_get_rate RANDOM_PREFIX ## _resampler_get_rate
+#define speex_resampler_set_rate_frac RANDOM_PREFIX ## _resampler_set_rate_frac
+#define speex_resampler_get_ratio RANDOM_PREFIX ## _resampler_get_ratio
+#define speex_resampler_set_quality RANDOM_PREFIX ## _resampler_set_quality
+#define speex_resampler_get_quality RANDOM_PREFIX ## _resampler_get_quality
+#define speex_resampler_set_input_stride RANDOM_PREFIX ## _resampler_set_input_stride
+#define speex_resampler_get_input_stride RANDOM_PREFIX ## _resampler_get_input_stride
+#define speex_resample_set_output_stride RANDOM_PREFIX ## _resample_set_output_stride
+#define speex_resample_get_output_stride RANDOM_PREFIX ## _resample_get_output_stride
+#define speex_resampler_skip_zeros RANDOM_PREFIX ## _resampler_skip_zeros
+#define speex_resampler_reset_mem RANDOM_PREFIX ## _resampler_reset_mem
+
#define spx_int16_t short
+
#ifdef FIXED_POINT
#define spx_word16_t short
#define spx_word32_t int
-#else
+
+#else /* FIXED_POINT */
+
#define spx_word16_t float
#define spx_word32_t float
#define MULT16_16(a,b) ((a)*(b))
#define MULT16_32_Q15(a,b) ((a)*(b))
#define PSHR32(a,b) (a)
-#endif
+#endif /* FIXED_POINT */
-#else
+#else /* OUTSIDE_SPEEX */
#include "speex/speex_types.h"
-#endif
+#endif /* OUTSIDE_SPEEX */
#ifdef __cplusplus
extern "C" {
Modified: trunk/speex/libspeex/resample.c
===================================================================
--- trunk/speex/libspeex/resample.c 2007-02-21 08:42:27 UTC (rev 12500)
+++ trunk/speex/libspeex/resample.c 2007-02-21 13:46:27 UTC (rev 12501)
@@ -59,12 +59,13 @@
void *speex_alloc (int size) {return calloc(size,1);}
void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);}
void speex_free (void *ptr) {free(ptr);}
+#include "speex_resampler.h"
#else
+#include "speex/speex_resampler.h"
#include "misc.h"
#endif
#include <math.h>
-#include "speex/speex_resampler.h"
#ifndef M_PI
#define M_PI 3.14159263
More information about the commits
mailing list