summaryrefslogtreecommitdiffstats
path: root/ext/faad/gstfaad.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/faad/gstfaad.c')
-rw-r--r--ext/faad/gstfaad.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c
index 97a17973..29b83191 100644
--- a/ext/faad/gstfaad.c
+++ b/ext/faad/gstfaad.c
@@ -24,7 +24,28 @@
#include <string.h>
#include <gst/audio/audio.h>
#include <gst/audio/multichannel.h>
+
+/* These are the correct types for these functions, as defined in the source.
+ * However, upstream FAAD is distributed with a broken header file that defined
+ * these wrongly (in a way which was broken on 64 bit systems).
+ * Upstream CVS still has the bug, but has also renamed all the public symbols
+ * for Better Corporate Branding (or whatever), so we're screwed there.
+ *
+ * We must call them using these definitions. Most distributions now have the
+ * corrected header file (they distribute a patch along with the source),
+ * but not all, hence this Truly Evil Hack. This hack will need updating if
+ * upstream ever releases something with the new API.
+ */
+#define faadDecInit faadDecInit_no_definition
+#define faadDecInit2 faadDecInit2_no_definition
#include "gstfaad.h"
+#undef faadDecInit
+#undef faadDecInit2
+
+extern long faadDecInit (faacDecHandle, uint8_t *, uint32_t,
+ uint32_t *, uint8_t *);
+extern int8_t faadDecInit2 (faacDecHandle, uint8_t *, uint32_t,
+ uint32_t *, uint8_t *);
GST_DEBUG_CATEGORY_STATIC (faad_debug);
#define GST_CAT_DEFAULT faad_debug
@@ -198,7 +219,7 @@ gst_faad_setcaps (GstPad * pad, GstCaps * caps)
faad->packetised = FALSE;
if ((value = gst_structure_get_value (str, "codec_data"))) {
- gulong samplerate;
+ guint samplerate;
guchar channels;
/* We have codec data, means packetised stream */
@@ -206,8 +227,9 @@ gst_faad_setcaps (GstPad * pad, GstCaps * caps)
buf = GST_BUFFER (gst_value_get_mini_object (value));
/* someone forgot that char can be unsigned when writing the API */
- if ((gint8) faacDecInit2 (faad->handle, GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf), &samplerate, &channels) < 0) {
+ if ((gint8) faadDecInit2 (faad->handle,
+ GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), &samplerate,
+ &channels) < 0) {
GST_DEBUG ("faacDecInit2() failed");
return FALSE;
}
@@ -762,7 +784,7 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
/* init if not already done during capsnego */
if (!faad->init) {
- gulong samplerate;
+ guint32 samplerate;
guchar channels;
glong init_res;