$OpenBSD: patch-src_libfaad_xine_faad_decoder_c,v 1.2 2008/01/15 00:36:46 jakemsr Exp $
--- src/libfaad/xine_faad_decoder.c.orig	Tue Jan  1 08:30:08 2008
+++ src/libfaad/xine_faad_decoder.c	Wed Jan  9 01:50:22 2008
@@ -31,16 +31,21 @@
 #define LOG
 */
 
+#include <faad.h>
+
 #include "xine_internal.h"
 #include "audio_out.h"
 #include "buffer.h"
 #include "xineutils.h"
+
+#if 0
 #include "common.h"
 #include "structs.h"
 #include "decoder.h"
 #include "syntax.h"
 
 #define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
+#endif
 
 typedef struct {
   audio_decoder_class_t   decoder_class;
@@ -52,26 +57,26 @@ typedef struct faad_decoder_s {
   xine_stream_t    *stream;
   
   /* faad2 stuff */
-  NeAACDecHandle           faac_dec;
-  NeAACDecConfigurationPtr faac_cfg;
-  NeAACDecFrameInfo        faac_finfo;
+  faacDecHandle           faac_dec;
+  faacDecConfigurationPtr faac_cfg;
+  faacDecFrameInfo        faac_finfo;
   int                     faac_failed;
  
   int              raw_mode;
   
-  unsigned char   *buf;
-  int              size;
+  uint8_t         *buf;
+  uint32_t         size;
   int              rec_audio_src_size;
   int              max_audio_src_size;
   int              pts;
   
-  unsigned char   *dec_config;
-  int              dec_config_size;
+  uint8_t         *dec_config;
+  uint32_t         dec_config_size;
   
   uint32_t         rate;
   int              bits_per_sample; 
-  unsigned char    num_channels; 
-  int              sbr;
+  uint8_t          num_channels; 
+  uint8_t          sbr;
   uint32_t         ao_cap_mode; 
    
   int              output_open;
@@ -122,33 +127,33 @@ static void faad_meta_info_set ( faad_decoder_t *this 
 static int faad_open_dec( faad_decoder_t *this ) {
   int used;
 
-  this->faac_dec = NeAACDecOpen();
+  this->faac_dec = faacDecOpen();
   if( !this->faac_dec ) {
     xprintf( this->stream->xine, XINE_VERBOSITY_LOG,
-             _("libfaad: libfaad NeAACDecOpen() failed.\n"));
+             _("libfaad: libfaad faacDecOpen() failed.\n"));
     this->faac_failed++;
   } else {
     if( this->dec_config ) {
-      used = NeAACDecInit2(this->faac_dec, this->dec_config, this->dec_config_size,
+      used = faacDecInit2(this->faac_dec, this->dec_config, this->dec_config_size,
                           &this->rate, &this->num_channels);
       
       if( used < 0 ) {
         xprintf( this->stream->xine, XINE_VERBOSITY_LOG,
-                _("libfaad: libfaad NeAACDecInit2 failed.\n"));
+                _("libfaad: libfaad faacDecInit2 failed.\n"));
         this->faac_failed++;
       } else
-        lprintf( "NeAACDecInit2 returned rate=%"PRId32" channels=%d\n",
+        lprintf( "faacDecInit2 returned rate=%"PRId32" channels=%d\n",
                  this->rate, this->num_channels );
     } else {
-      used = NeAACDecInit(this->faac_dec, this->buf, this->size,
+      used = faacDecInit(this->faac_dec, this->buf, this->size,
                         &this->rate, &this->num_channels);
         
       if( used < 0 ) {
         xprintf ( this->stream->xine, XINE_VERBOSITY_LOG,
-                  _("libfaad: libfaad NeAACDecInit failed.\n"));
+                  _("libfaad: libfaad faacDecInit failed.\n"));
         this->faac_failed++;
       } else {
-        lprintf( "NeAACDecInit() returned rate=%"PRId32" channels=%d (used=%d)\n",
+        lprintf( "faacDecInit() returned rate=%"PRId32" channels=%d (used=%d)\n",
                  this->rate, this->num_channels, used);
                       
         this->size -= used;
@@ -162,7 +167,7 @@ static int faad_open_dec( faad_decoder_t *this ) {
   
   if( this->faac_failed ) {
     if( this->faac_dec ) {
-      NeAACDecClose( this->faac_dec );
+      faacDecClose( this->faac_dec );
       this->faac_dec = NULL;
     }
     _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0);
@@ -186,9 +191,9 @@ static int faad_open_output( faad_decoder_t *this ) {
         this->ao_cap_mode = AO_CAP_MODE_5_1CHANNEL;
         break;
       } else {
-        this->faac_cfg = NeAACDecGetCurrentConfiguration(this->faac_dec);
+        this->faac_cfg = faacDecGetCurrentConfiguration(this->faac_dec);
         this->faac_cfg->downMatrix = 1;
-        NeAACDecSetConfiguration(this->faac_dec, this->faac_cfg);
+        faacDecSetConfiguration(this->faac_dec, this->faac_cfg);
         this->num_channels = 2;
       }
     case 2:
@@ -211,7 +216,7 @@ static void faad_decode_audio ( faad_decoder_t *this, 
   uint8_t *sample_buffer;
   uint8_t *inbuf;
   audio_buffer_t *audio_buffer;
-  int sample_size = this->size;
+  uint32_t sample_size = this->size;
     
   if( !this->faac_dec )
     return;
@@ -220,12 +225,12 @@ static void faad_decode_audio ( faad_decoder_t *this, 
   while( (!this->raw_mode && end_frame && this->size >= 10) ||
          (this->raw_mode && this->size >= this->rec_audio_src_size) ) {
       
-    sample_buffer = NeAACDecDecode(this->faac_dec, 
+    sample_buffer = faacDecDecode(this->faac_dec, 
                                   &this->faac_finfo, inbuf, sample_size);
  
     if( !sample_buffer ) {
       xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
-              "libfaad: %s\n", NeAACDecGetErrorMessage(this->faac_finfo.error));
+              "libfaad: %s\n", faacDecGetErrorMessage(this->faac_finfo.error));
       used = 1;    
     } else {
       used = this->faac_finfo.bytesconsumed;
@@ -405,7 +410,7 @@ static void faad_dispose (audio_decoder_t *this_gen) {
   this->dec_config_size = 0;
   
   if( this->faac_dec )
-    NeAACDecClose(this->faac_dec);
+    faacDecClose(this->faac_dec);
   this->faac_dec = NULL;
   this->faac_failed = 0;
 
