From 6b94a5333ee1fe39f6fe6ecc76db5f73bb0a8e7f Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 11 Nov 2005 18:17:22 +0000 Subject: 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... --- ChangeLog | 8 ++++++++ ext/faad/gstfaad.c | 30 ++++++++++++++++++++++++++---- 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 + + * 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 Reviewed by: Tim-Philipp Müller 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 #include #include + +/* 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; -- cgit v1.2.1