summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2007-11-21 10:18:56 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2007-11-21 10:18:56 +0000
commit82cde22e4ddcc42043b353f62304ba642ab2d4b7 (patch)
tree3bf9fc289c56b96c5a327d3e0fa127e3f87acd78 /gst
parent9fd560ffcae003bff7f522146db4aa880a379677 (diff)
downloadgst-plugins-bad-82cde22e4ddcc42043b353f62304ba642ab2d4b7.tar.gz
gst-plugins-bad-82cde22e4ddcc42043b353f62304ba642ab2d4b7.tar.bz2
gst-plugins-bad-82cde22e4ddcc42043b353f62304ba642ab2d4b7.zip
gst/speexresample/README: Add README explaining where the resampling code was taken from and which changes were done.
Original commit message from CVS: * gst/speexresample/README: Add README explaining where the resampling code was taken from and which changes were done. * gst/speexresample/resample.c: (speex_alloc), (speex_realloc), (speex_free): Use g_malloc() and friends instead of malloc() to achieve higher portability and define the functions inline. * gst/speexresample/speex_resampler.h: Add back some useless preprocessor stuff to keep the diff between our version and the one from the Speex SVN repository lower.
Diffstat (limited to 'gst')
-rw-r--r--gst/speexresample/README80
-rw-r--r--gst/speexresample/resample.c14
-rw-r--r--gst/speexresample/speex_resampler.h5
3 files changed, 93 insertions, 6 deletions
diff --git a/gst/speexresample/README b/gst/speexresample/README
new file mode 100644
index 00000000..72c9d631
--- /dev/null
+++ b/gst/speexresample/README
@@ -0,0 +1,80 @@
+resample.c
+arch.h
+fixed_generic.h
+speex_resampler.h
+
+are taken from http://svn.xiph.org/trunk/speex/ revision 14208.
+
+The only changes are:
+
+--- speex/libspeex/arch.h 2007-11-21 11:05:46.000000000 +0100
++++ speexresample/arch.h 2007-11-20 05:41:09.000000000 +0100
+@@ -78,7 +78,9 @@
+ #include "speex/speex_types.h"
+ #endif
+
++#ifndef ABS
+ #define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */
++#endif
+ #define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */
+ #define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 16-bit value. */
+ #define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */
+
+--- speex/include/speex/speex_resampler.h 2007-11-21 11:05:44.000000000 +0100
++++ speexresample/speex_resampler.h 2007-11-21 11:10:02.000000000 +0100
+@@ -41,6 +41,8 @@
+
+ #ifdef OUTSIDE_SPEEX
+
++#include <glib.h>
++
+ /********* WARNING: MENTAL SANITY ENDS HERE *************/
+
+ /* If the resampler is defined outside of Speex, we change the symbol names so that
+@@ -75,10 +77,10 @@
+ #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
+-#define spx_uint16_t unsigned short
+-#define spx_uint32_t unsigned int
++#define spx_int16_t gint16
++#define spx_int32_t gint32
++#define spx_uint16_t guint16
++#define spx_uint32_t guint32
+
+ #else /* OUTSIDE_SPEEX */
+
+--- speex/libspeex/resample.c 2007-11-21 11:07:32.000000000 +0100
++++ speexresample/resample.c 2007-11-21 11:15:09.000000000 +0100
+@@ -62,20 +62,22 @@
+
+ #ifdef OUTSIDE_SPEEX
+ #include <stdlib.h>
+-static void *
++#include <glib.h>
++
++static inline void *
+ speex_alloc (int size)
+ {
+- return calloc (size, 1);
++ return g_malloc0 (size);
+ }
+-static void *
++static inline void *
+ speex_realloc (void *ptr, int size)
+ {
+- return realloc (ptr, size);
++ return g_realloc (ptr, size);
+ }
+-static void
++static inline void
+ speex_free (void *ptr)
+ {
+- free (ptr);
++ g_free (ptr);
+ }
+
+ #include "speex_resampler.h"
+
diff --git a/gst/speexresample/resample.c b/gst/speexresample/resample.c
index f3c97fdd..f01574f9 100644
--- a/gst/speexresample/resample.c
+++ b/gst/speexresample/resample.c
@@ -62,20 +62,22 @@
#ifdef OUTSIDE_SPEEX
#include <stdlib.h>
-static void *
+#include <glib.h>
+
+static inline void *
speex_alloc (int size)
{
- return calloc (size, 1);
+ return g_malloc0 (size);
}
-static void *
+static inline void *
speex_realloc (void *ptr, int size)
{
- return realloc (ptr, size);
+ return g_realloc (ptr, size);
}
-static void
+static inline void
speex_free (void *ptr)
{
- free (ptr);
+ g_free (ptr);
}
#include "speex_resampler.h"
diff --git a/gst/speexresample/speex_resampler.h b/gst/speexresample/speex_resampler.h
index 1dde54ac..7ca6efc0 100644
--- a/gst/speexresample/speex_resampler.h
+++ b/gst/speexresample/speex_resampler.h
@@ -48,6 +48,11 @@
/* 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 */
+#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)