diff --git a/configure.ac b/configure.ac
index 539443e..dc4bfa9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -765,9 +765,30 @@ AG_GST_CHECK_FEATURE(FAAD, [AAC decoder plug-in], faad, [
       AC_MSG_RESULT(no)
     ])
   fi
+  if test $HAVE_FAAD = "yes"; then
+     AC_MSG_CHECKING([Checking for FAAD >= 2.7])
+     AC_TRY_RUN([
+     #include <string.h>
+     #include <faad.h>
+
+     int main (int argc, char *argv[])
+     {
+       if (!(strcmp(FAAD2_VERSION, "2.7")))
+         return 0;
+       return 1;
+     }
+     ], [
+       AC_DEFINE(HAVE_FAAD_27, 1, [Define if faad2 >= 2.7])
+       AC_MSG_RESULT(yes)
+     ], [
+       AC_MSG_RESULT(no)
+     ]
+    )
+  fi
   AS_SCRUB_INCLUDE(FAAD_CFLAGS)
   AC_SUBST(FAAD_LIBS)
   AC_SUBST(FAAD_IS_NEAAC)
+  AC_SUBST(HAVE_FAAD_27)
 ])
 
 dnl *** fbdev ***
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c
index 4248fc6..2d49b6d 100644
--- a/ext/faad/gstfaad.c
+++ b/ext/faad/gstfaad.c
@@ -42,26 +42,33 @@
  * Note: The prototypes don't need to be defined conditionaly, as the cpp will
  * do that for us.
  */
-#ifdef FAAD_IS_NEAAC
-#define NeAACDecInit NeAACDecInit_no_definition
-#define NeAACDecInit2 NeAACDecInit2_no_definition
-#else
-#define faacDecInit faacDecInit_no_definition
-#define faacDecInit2 faacDecInit2_no_definition
-#endif
+#ifndef HAVE_FAAD_27
+ #ifdef FAAD_IS_NEAAC
+  #define NeAACDecInit NeAACDecInit_no_definition
+  #define NeAACDecInit2 NeAACDecInit2_no_definition
+ #else
+  #define faacDecInit faacDecInit_no_definition
+  #define faacDecInit2 faacDecInit2_no_definition
+ #endif
+#endif /* HAVE_FAAD_27 */
+
 #include "gstfaad.h"
-#ifdef FAAD_IS_NEAAC
-#undef NeAACDecInit
-#undef NeAACDecInit2
-#else
-#undef faacDecInit
-#undef faacDecInit2
-#endif
+
+#ifndef HAVE_FAAD_27
+ #ifdef FAAD_IS_NEAAC
+  #undef NeAACDecInit
+  #undef NeAACDecInit2
+ #else
+  #undef faacDecInit
+  #undef faacDecInit2
+ #endif
 
 extern long faacDecInit (faacDecHandle, guint8 *, guint32, guint32 *, guint8 *);
 extern gint8 faacDecInit2 (faacDecHandle, guint8 *, guint32,
     guint32 *, guint8 *);
 
+#endif /* HAVE_FAAD_27 */
+
 GST_DEBUG_CATEGORY_STATIC (faad_debug);
 #define GST_CAT_DEFAULT faad_debug
 
@@ -302,7 +309,11 @@ gst_faad_setcaps (GstPad * pad, GstCaps * caps)
   faad->packetised = FALSE;
 
   if ((value = gst_structure_get_value (str, "codec_data"))) {
+#ifdef HAVE_FAAD_27
+    gulong samplerate;
+#else
     guint32 samplerate;
+#endif
     guint8 channels;
     guint8 *cdata;
     guint csize;
@@ -1284,7 +1295,11 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
 
   /* init if not already done during capsnego */
   if (!faad->init) {
+#ifdef HAVE_FAAD_27
+    gulong rate;
+#else
     guint32 rate;
+#endif
     guint8 ch;
 
     GST_DEBUG_OBJECT (faad, "initialising ...");
