Fixes #158382. Make speex plugin compatible with both 1.0 and 1.1.
authorThomas Vander Stichele <thomas@apestaart.org>
Thu, 23 Dec 2004 14:45:25 +0000 (14:45 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Thu, 23 Dec 2004 14:45:25 +0000 (14:45 +0000)
Original commit message from CVS:

* configure.ac:
* ext/speex/gstspeexdec.h:
* ext/speex/gstspeexenc.h:
Fixes #158382.  Make speex plugin compatible with both 1.0 and 1.1.
Fix detection code in configure.ac

ChangeLog
configure.ac
ext/speex/gstspeexdec.h
ext/speex/gstspeexenc.h

index f3f1ce8634151d1cb8b71b85dfb60b73f5bd1f96..bb732618d7e624be9c8a7bdebc7f1e82d3e08a76 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-12-23  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * configure.ac:
+       * ext/speex/gstspeexdec.h:
+       * ext/speex/gstspeexenc.h:
+         Fixes #158382.  Make speex plugin compatible with both 1.0 and 1.1.
+         Fix detection code in configure.ac
+
 2004-12-23  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * gst/matroska/matroska-demux.c:
index 97064bbea20f6025bad05cb7be9e0a44cb7713a5..00f996524dbc3a55014a1385114b1511fc1bd0dc 100644 (file)
@@ -1575,10 +1575,10 @@ GST_CHECK_FEATURE(SPEEX, [speex plug-in], speex, [
     AC_SUBST(SPEEX_CFLAGS)
     AC_SUBST(SPEEX_LIBS)
   ], [
-    GST_CHECK_LIBHEADER(SPEEX, speex, speex_bits_init, , speex.h, [
-      AC_CHECK_HEADER(speex_jitter.h, [
+    GST_CHECK_LIBHEADER(SPEEX, speex, speex_bits_init, , speex/speex.h, [
+      AC_CHECK_HEADER(speex/speex_jitter.h, [
         dnl speex 1.1.x :
-        GST_CHECK_LIBHEADER(SPEEX, speex, speex_encode_int, , speex.h, [
+        GST_CHECK_LIBHEADER(SPEEX, speex, speex_encode_int, , speex/speex.h, [
           dnl speex 1.1.5 or + :
           HAVE_SPEEX="yes"
           SPEEX_LIBS="-lspeex"
@@ -1595,9 +1595,14 @@ GST_CHECK_FEATURE(SPEEX, [speex plug-in], speex, [
             SPEEX_LIBS="-lspeex"
             AC_SUBST(SPEEX_CFLAGS)
             AC_SUBST(SPEEX_LIBS)
+
+            AC_DEFINE_UNQUOTED(SPEEX_1_0, 1,
+              [defined if speex 1.0.x API detected])
         ],[
             HAVE_SPEEX="no"
             AC_MSG_NOTICE(You need at least 1.0.4 to compile the speex plugin)
+        ], [
+#include <speex/speex.h>
         ])
       ])
     ])
index f0cd61c08dcfd90697746207504d18a2c728efcf..f60a679e9db1a5052ab69872b1207494a4803e19 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef __GST_SPEEXDEC_H__
 #define __GST_SPEEXDEC_H__
 
-
 #include <gst/gst.h>
 #include <speex/speex.h>
 #include <speex/speex_callbacks.h>
@@ -32,7 +31,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-
 #define GST_TYPE_SPEEXDEC \
   (gst_speex_dec_get_type())
 #define GST_SPEEXDEC(obj) \
@@ -50,25 +48,30 @@ typedef struct _GstSpeexDecClass GstSpeexDecClass;
 #define DEC_MAX_FRAME_SIZE 2000
 
 struct _GstSpeexDec {
-  GstElement element;
+  GstElement           element;
 
   /* pads */
-  GstPad *sinkpad,*srcpad;
-
-  void                 *state;
-  SpeexStereoState stereo;
-  const SpeexMode * mode;
-  SpeexHeader  *header;
-  SpeexCallback  callback;
-  SpeexBits      bits;
-     
-  gfloat         output[DEC_MAX_FRAME_SIZE];
-
-  gboolean      enh;
-  
-  gint          frame_size;
-  guint64       samples_out;
-  guint64       packetno;
+  GstPad               *sinkpad,
+                       *srcpad;
+
+  void                 *state;
+  SpeexStereoState     stereo;
+#ifdef SPEEX_1_0
+  SpeexMode            *mode;
+#else
+  const SpeexMode      *mode;
+#endif
+  SpeexHeader          *header;
+  SpeexCallback                callback;
+  SpeexBits            bits;
+
+  gfloat               output[DEC_MAX_FRAME_SIZE];
+
+  gboolean             enh;
+
+  gint                 frame_size;
+  guint64              samples_out;
+  guint64              packetno;
 };
 
 struct _GstSpeexDecClass {
index 0c002031087ea69710850758fe3dc6fe05c11271..8f01811d886cdd733b79df94b60c3d627d9ebe4f 100644 (file)
@@ -59,54 +59,58 @@ typedef struct _GstSpeexEnc GstSpeexEnc;
 typedef struct _GstSpeexEncClass GstSpeexEncClass;
 
 struct _GstSpeexEnc {
-  GstElement   element;
+  GstElement           element;
 
   /* pads */
-  GstPad       *sinkpad,
-               *srcpad;
+  GstPad               *sinkpad,
+                       *srcpad;
 
-  gint          packet_count;
-  gint          n_packets;
+  gint                 packet_count;
+  gint                 n_packets;
 
-  SpeexBits     bits;
-  SpeexHeader   header;
-  const SpeexMode      *speex_mode;
-  void                 *state;
-  GstSpeexMode  mode;
-  GstAdapter    *adapter;
+  SpeexBits            bits;
+  SpeexHeader          header;
+#if SPEEX_1_0
+  SpeexMode            *speex_mode;
+#else
+  const SpeexMode      *speex_mode;
+#endif
+  void                 *state;
+  GstSpeexMode         mode;
+  GstAdapter           *adapter;
 
-  gfloat        quality;
-  gint                  bitrate;
-  gboolean      vbr;
-  gint          abr;
-  gboolean      vad;
-  gboolean      dtx;
-  gint          complexity;
-  gint                  nframes;
+  gfloat               quality;
+  gint                 bitrate;
+  gboolean             vbr;
+  gint                 abr;
+  gboolean             vad;
+  gboolean             dtx;
+  gint                 complexity;
+  gint                 nframes;
 
-  gint                  lookahead;
+  gint                 lookahead;
 
-  gint           channels;
-  gint           rate;
+  gint                 channels;
+  gint                 rate;
 
-  gboolean      setup;
-  gboolean       header_sent;
-  gboolean      eos;
+  gboolean             setup;
+  gboolean             header_sent;
+  gboolean             eos;
 
-  guint64        samples_in;
-  guint64        bytes_out;
+  guint64              samples_in;
+  guint64              bytes_out;
 
-  GstTagList    *tags;
+  GstTagList           *tags;
 
-  gchar         *last_message;
+  gchar                        *last_message;
 
-  gint          frame_size;
-  guint64       frameno;
+  gint                 frame_size;
+  guint64              frameno;
 
-  gchar                *comments;
-  gint          comment_len;
+  gchar                        *comments;
+  gint                 comment_len;
 
-  gfloat        input[MAX_FRAME_SIZE];
+  gfloat               input[MAX_FRAME_SIZE];
 };
 
 struct _GstSpeexEncClass {