shithub: aacenc

Download patch

ref: 6a0f3c931e3a04b11086258bb4e58e2c0358727b
parent: affe02d4f6e4d5685b379f65010df6bb921e9c8d
author: menno <menno>
date: Fri Sep 7 07:26:04 EDT 2001

Added creating of DecoderSpecificInfo

--- a/include/faac.h
+++ b/include/faac.h
@@ -16,7 +16,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: faac.h,v 1.15 2001/06/09 14:33:40 menno Exp $
+ * $Id: faac.h,v 1.16 2001/09/07 11:26:04 menno Exp $
  */
 
 #ifndef FAACLIB_H
@@ -77,6 +77,10 @@
 
 typedef void *faacEncHandle;
 
+
+int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder,
+                                          unsigned char** ppBuffer,
+                                          unsigned long* pSizeOfDecoderSpecificInfo);
 
 faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration(faacEncHandle hEncoder);
 int FAACAPI faacEncSetConfiguration (faacEncHandle hEncoder, faacEncConfigurationPtr config);
--- a/libfaac/frame.c
+++ b/libfaac/frame.c
@@ -16,7 +16,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: frame.c,v 1.23 2001/07/08 09:43:51 menno Exp $
+ * $Id: frame.c,v 1.24 2001/09/07 11:26:04 menno Exp $
  */
 
 /*
@@ -44,6 +44,46 @@
 #include "tns.h"
 #include "ltp.h"
 #include "backpred.h"
+
+
+int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder,unsigned char** ppBuffer,unsigned long* pSizeOfDecoderSpecificInfo)
+{
+    BitStream* pBitStream = NULL;
+
+    if((hEncoder == NULL) || (ppBuffer == NULL) || (pSizeOfDecoderSpecificInfo == NULL)) {
+        return -1;
+    }
+    
+    if(hEncoder->config.mpegVersion == MPEG2){
+        return -2; /* not supported */
+    }
+
+    *pSizeOfDecoderSpecificInfo = 2;
+    *ppBuffer = malloc(2);
+
+    if(*ppBuffer != NULL){
+
+        memset(*ppBuffer,0,*pSizeOfDecoderSpecificInfo);
+        pBitStream = OpenBitStream(*pSizeOfDecoderSpecificInfo, *ppBuffer);
+        PutBit(pBitStream, hEncoder->config.aacObjectType + 1, 5);
+
+        /*
+        temporary fix,
+        when object type defines will be changed to values defined by ISO 14496-3
+        "+ 1" shall be removed
+
+        /AV
+        */
+
+        PutBit(pBitStream, hEncoder->sampleRateIdx, 4);
+        PutBit(pBitStream, hEncoder->numChannels, 4);
+        CloseBitStream(pBitStream);
+
+        return 0;
+    } else {
+        return -3;
+    }
+}
 
 
 faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration(faacEncHandle hEncoder)
--- a/libfaac/frame.h
+++ b/libfaac/frame.h
@@ -16,7 +16,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: frame.h,v 1.12 2001/06/08 18:01:09 menno Exp $
+ * $Id: frame.h,v 1.13 2001/09/07 11:26:04 menno Exp $
  */
 
 #ifndef FRAME_H
@@ -114,6 +114,10 @@
     faacEncConfiguration config;
 
 } faacEncStruct, *faacEncHandle;
+
+int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder,
+                                          unsigned char** ppBuffer,
+                                          unsigned long* pSizeOfDecoderSpecificInfo);
 
 faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration(faacEncHandle hEncoder);
 int FAACAPI faacEncSetConfiguration (faacEncHandle hEncoder, faacEncConfigurationPtr config);