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...
This commit is contained in:
Michael Smith 2005-11-11 18:17:22 +00:00
parent 9c8c1bac44
commit 6b94a5333e
2 changed files with 34 additions and 4 deletions

View file

@ -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>

View file

@ -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;