diff libmpcodecs/ad_faad.c @ 9321:6fa743f3094b

libfaad2 v1.0, v1.1, v1.2 detection, and API change workaround in ad_faad.c based on patch by Andre Schulz <andre@0wnage.de>
author arpi
date Fri, 07 Feb 2003 21:04:35 +0000
parents 7ee8239bfcc0
children bae3e8c81ada
line wrap: on
line diff
--- a/libmpcodecs/ad_faad.c	Fri Feb 07 20:11:07 2003 +0000
+++ b/libmpcodecs/ad_faad.c	Fri Feb 07 21:04:35 2003 +0000
@@ -85,8 +85,13 @@
     sh->a_in_buffer_len = demux_read_data(sh->ds, sh->a_in_buffer, sh->a_in_buffer_size);
 
     /* init the codec */
+#if (FAADVERSION <= 11)
     faac_init = faacDecInit(faac_hdec, sh->a_in_buffer,
        &faac_samplerate, &faac_channels);
+#else
+    faac_init = faacDecInit(faac_hdec, sh->a_in_buffer,
+       sh->a_in_buffer_len, &faac_samplerate, &faac_channels);
+#endif
 
     sh->a_in_buffer_len -= (faac_init > 0)?faac_init:0; // how many bytes init consumed
     // XXX FIXME: shouldn't we memcpy() here in a_in_buffer ?? --A'rpi
@@ -164,7 +169,12 @@
   if(!sh->codecdata_len){
    // raw aac stream:
    do {
+#if (FAADVERSION <= 11)
     faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, sh->a_in_buffer+j);
+#else
+    faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, sh->a_in_buffer+j, sh->a_in_buffer_len);
+#endif
+	
     /* update buffer index after faacDecDecode */
     if(faac_finfo.bytesconsumed >= sh->a_in_buffer_len) {
       sh->a_in_buffer_len=0;
@@ -184,7 +194,11 @@
     unsigned char* bufptr=NULL;
     int buflen=ds_get_packet(sh->ds, &bufptr);
     if(buflen<=0) break;
+#if (FAADVERSION <= 11)
     faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, bufptr);
+#else
+    faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, bufptr, buflen);
+#endif
 //    printf("FAAC decoded %d of %d  (err: %d)  \n",faac_finfo.bytesconsumed,buflen,faac_finfo.error);
   }