shithub: aacdec

Download patch

ref: 4ce32dbcf13fb7b6f3869706afaf6911577e48e0
parent: fb2e3a60f5bd0aded7e420fc619081146040651d
author: gcp <gcp>
date: Thu Sep 2 11:49:29 EDT 2004

Bugfixes for PS AAC streaming

--- a/libfaad/ps_dec.h
+++ b/libfaad/ps_dec.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through [email protected].
 **
-** $Id: ps_dec.h,v 1.6 2004/07/31 15:48:56 menno Exp $
+** $Id: ps_dec.h,v 1.8 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __PS_DEC_H__
@@ -83,6 +83,9 @@
     /* ps data was correctly read */
     uint8_t ps_data_available;
 
+    /* a header has been read */
+    uint8_t header_read;
+
     /* hybrid filterbank parameters */
     void *hyb;
     uint8_t use34hybrid_bands;
@@ -129,7 +132,7 @@
 } ps_info;
 
 /* ps_syntax.c */
-uint16_t ps_data(ps_info *ps, bitfile *ld);
+uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header);
 
 /* ps_dec.c */
 ps_info *ps_init(uint8_t sr_index);
--- a/libfaad/ps_syntax.c
+++ b/libfaad/ps_syntax.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through [email protected].
 **
-** $Id: ps_syntax.c,v 1.4 2004/07/31 15:48:56 menno Exp $
+** $Id: ps_syntax.c,v 1.6 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -322,15 +322,21 @@
 static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff);
 
 
-uint16_t ps_data(ps_info *ps, bitfile *ld)
+uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header)
 {
     uint8_t tmp, n;
     uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
 
+    *header = 0;
+
     /* check for new PS header */
     if (faad_get1bit(ld
         DEBUGVAR(1,1000,"ps_data(): enable_ps_header")))
     {
+        *header = 1;
+
+        ps->header_read = 1;
+
         ps->use34hybrid_bands = 0;
 
         /* Inter-channel Intensity Difference (IID) parameters enabled */
@@ -371,6 +377,10 @@
         ps->enable_ext = (uint8_t)faad_get1bit(ld
             DEBUGVAR(1,1005,"ps_data(): enable_ext"));
     }
+
+    /* we are here, but no header has been read yet */
+    if (ps->header_read == 0)
+        return 1;
 
     ps->frame_class = (uint8_t)faad_get1bit(ld
         DEBUGVAR(1,1006,"ps_data(): frame_class"));