summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Smith <msmith@xiph.org>2005-11-11 18:17:22 +0000
committerMichael Smith <msmith@xiph.org>2005-11-11 18:17:22 +0000
commit6b94a5333ee1fe39f6fe6ecc76db5f73bb0a8e7f (patch)
tree15e0f7411aec6317e5b6429795c692d88f20b59c
parent9c8c1bac44723a161299ae9a7d6c7164da8701d1 (diff)
downloadgst-plugins-bad-6b94a5333ee1fe39f6fe6ecc76db5f73bb0a8e7f.tar.gz
gst-plugins-bad-6b94a5333ee1fe39f6fe6ecc76db5f73bb0a8e7f.tar.bz2
gst-plugins-bad-6b94a5333ee1fe39f6fe6ecc76db5f73bb0a8e7f.zip
ext/faad/gstfaad.c: Call functions with the correct API. Unfortunately, unless your distribution patches upstream, th...
Original commit message from CVS: * ext/faad/gstfaad.c: (gst_faad_setcaps), (gst_faad_chain): Call functions with the correct API. Unfortunately, unless your distribution patches upstream, the public header file for FAAD doesn't actually declare the API accurately. So, some nastiness ensues...
-rw-r--r--ChangeLog8
-rw-r--r--ext/faad/gstfaad.c30
2 files changed, 34 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3409bc70..8bd6484a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-11-11 Michael Smith <msmith@fluendo.com>
+
+ * ext/faad/gstfaad.c: (gst_faad_setcaps), (gst_faad_chain):
+ Call functions with the correct API. Unfortunately, unless your
+ distribution patches upstream, the public header file for FAAD
+ doesn't actually declare the API accurately. So, some nastiness
+ ensues...
+
2005-11-10 Daniel Amelang <daniel dot amelang at gmail dot com>
Reviewed by: Tim-Philipp Müller <tim at centricular dot net>
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;