shithub: aacdec

Download patch

ref: 9027402e9c72bfd413bf9a94239ac331c25caf57
parent: 1a1e8a9df4c4f9ad3a038c8cba0b94f4e8609319
author: menno <menno>
date: Mon Jan 12 13:55:40 EST 2004

fix for DRM

--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: decoder.c,v 1.86 2004/01/10 18:52:47 menno Exp $
+** $Id: decoder.c,v 1.87 2004/01/12 18:55:40 menno Exp $
 **/
 
 #include "common.h"
@@ -876,9 +876,9 @@
             *prevbufstart++ = tabFlipbits[*pbufend--];
 
         /* Set SBR data */
-        faad_initbits(&ld_sbr, revbuffer, buffer_size);
         /* consider 8 bits from AAC-CRC */
-        count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed - 8);
+        count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed);
+        faad_initbits(&ld_sbr, revbuffer, count);
 
         hDecoder->sbr[0]->lcstereo_flag = hDecoder->lcstereo_flag;
 
--- a/libfaad/sbr_syntax.c
+++ b/libfaad/sbr_syntax.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_syntax.c,v 1.19 2004/01/10 18:52:47 menno Exp $
+** $Id: sbr_syntax.c,v 1.21 2004/01/13 14:24:10 menno Exp $
 **/
 
 #include "common.h"
@@ -174,18 +174,23 @@
         result = 1;
     }
 
-    num_sbr_bits = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits;
-    /* -4 does not apply, bs_extension_type is re-read in this function */
-    num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits;
-
-    while (num_align_bits > 7)
+#ifdef DRM
+    if (!sbr->Is_DRM_SBR)
+#endif
     {
-        faad_getbits(ld, 8
+        num_sbr_bits = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits;
+        /* -4 does not apply, bs_extension_type is re-read in this function */
+        num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits;
+
+        while (num_align_bits > 7)
+        {
+            faad_getbits(ld, 8
+                DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
+            num_align_bits -= 8;
+        }
+        faad_getbits(ld, num_align_bits
             DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
-        num_align_bits -= 8;
     }
-    faad_getbits(ld, num_align_bits
-        DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
 
     return result;
 }
@@ -675,6 +680,11 @@
 static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
                               uint8_t bs_extension_id, uint16_t num_bits_left)
 {
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+        return 0;
+#endif
+
     switch (bs_extension_id)
     {
 #ifdef PS_DEC
@@ -682,14 +692,9 @@
         return ps_data(&(sbr->ps), ld);
 #endif
     default:
-#ifdef DRM
-        if (!sbr->Is_DRM_SBR)
-#endif
-        {
-            sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
-                DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
-            return 6;
-        }
+        sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
+            DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
+        return 6;
     }
 }