[xiph-commits] r12825 - in trunk/speex: include/speex libspeex

jm at svn.xiph.org jm at svn.xiph.org
Sun Apr 1 06:39:41 PDT 2007


Author: jm
Date: 2007-04-01 06:39:37 -0700 (Sun, 01 Apr 2007)
New Revision: 12825

Modified:
   trunk/speex/include/speex/speex_resampler.h
   trunk/speex/libspeex/resample.c
Log:
Making sure there's no exported symbol with a speex_ prefix when compiling
with OUTSIDE_SPEEX. Also error code to string conversion.


Modified: trunk/speex/include/speex/speex_resampler.h
===================================================================
--- trunk/speex/include/speex/speex_resampler.h	2007-04-01 12:24:50 UTC (rev 12824)
+++ trunk/speex/include/speex/speex_resampler.h	2007-04-01 13:39:37 UTC (rev 12825)
@@ -69,10 +69,11 @@
 #define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
 #define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
 #define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
-#define speex_resample_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resample_set_output_stride)
-#define speex_resample_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resample_get_output_stride)
+#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
+#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
 #define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
 #define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
+#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
 
 #define spx_int16_t short
 #define spx_int32_t int
@@ -289,14 +290,14 @@
  * @param st Resampler state
  * @param stride Output stride
  */
-void speex_resample_set_output_stride(SpeexResamplerState *st, 
+void speex_resampler_set_output_stride(SpeexResamplerState *st, 
                                       spx_uint32_t stride);
 
 /** Get the output stride.
  * @param st Resampler state copied
  * @param stride Output stride
  */
-void speex_resample_get_output_stride(SpeexResamplerState *st, 
+void speex_resampler_get_output_stride(SpeexResamplerState *st, 
                                       spx_uint32_t *stride);
 
 /** Make sure that the first samples to go out of the resamplers don't have 
@@ -314,6 +315,12 @@
  */
 int speex_resampler_reset_mem(SpeexResamplerState *st);
 
+/** Returns the English meaning for an error code
+ * @param err Error code
+ * @return English string
+ */
+const char *speex_resampler_strerror(int err);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/speex/libspeex/resample.c
===================================================================
--- trunk/speex/libspeex/resample.c	2007-04-01 12:24:50 UTC (rev 12824)
+++ trunk/speex/libspeex/resample.c	2007-04-01 13:39:37 UTC (rev 12825)
@@ -56,9 +56,9 @@
 
 #ifdef OUTSIDE_SPEEX
 #include <stdlib.h>
-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);}
+static void *speex_alloc (int size) {return calloc(size,1);}
+static void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);}
+static void speex_free (void *ptr) {free(ptr);}
 #include "speex_resampler.h"
 #include "arch.h"
 #else /* OUTSIDE_SPEEX */
@@ -1042,3 +1042,21 @@
    return RESAMPLER_ERR_SUCCESS;
 }
 
+const char *speex_resampler_strerror(int err)
+{
+   switch (err)
+   {
+      case RESAMPLER_ERR_SUCCESS:
+         return "Success.";
+      case RESAMPLER_ERR_ALLOC_FAILED:
+         return "Memory allocation failed.";
+      case RESAMPLER_ERR_BAD_STATE:
+         return "Bad resampler state.";
+      case RESAMPLER_ERR_INVALID_ARG:
+         return "Invalid argument.";
+      case RESAMPLER_ERR_PTR_OVERLAP:
+         return "Input and output buffers overlap.";
+      default:
+         return "Unknown error. Bad error code or strange version mismatch.";
+   }
+}



More information about the commits mailing list