shithub: aacenc

Download patch

ref: 8189c79dd7fee27441f015e18e3c77cfaa0bbaca
parent: 052a960225446958113fe211f647598e6aa60a68
author: eraser <eraser>
date: Fri Sep 21 08:40:02 EDT 2001

added raw output format support

--- 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.16 2001/09/07 11:26:04 menno Exp $
+ * $Id: faac.h,v 1.17 2001/09/21 12:39:01 eraser Exp $
  */
 
 #ifndef FAACLIB_H
@@ -37,8 +37,8 @@
   #endif
 #endif
 
-#define FAACENC_VERSION 1.9
-#define FAACENC_VERSIONB 1 /* If 1 this version is still in beta */
+#define FAACENC_VERSION 1.5
+#define FAACENC_VERSIONB 0 /* If 1 this version is still in beta */
 
 /* MPEG ID's */
 #define MPEG2 1
@@ -52,50 +52,58 @@
 
 typedef struct faacEncConfiguration
 {
-    /* MPEG version, 2 or 4 */
-    unsigned int mpegVersion;
+	/* MPEG version, 2 or 4 */
+	unsigned int mpegVersion;
 
-    /* AAC object type */
-    unsigned int aacObjectType;
+	/* AAC object type */
+	unsigned int aacObjectType;
 
-    /* Allow mid/side coding */
-    unsigned int allowMidside;
+	/* Allow mid/side coding */
+	unsigned int allowMidside;
 
-    /* Use one of the channels as LFE channel */
-    unsigned int useLfe;
+	/* Use one of the channels as LFE channel */
+	unsigned int useLfe;
 
-    /* Use Temporal Noise Shaping */
-    unsigned int useTns;
+	/* Use Temporal Noise Shaping */
+	unsigned int useTns;
 
-    /* bitrate / channel of AAC file */
-    unsigned long bitRate;
+	/* bitrate / channel of AAC file */
+	unsigned long bitRate;
 
-    /* AAC file frequency bandwidth */
-    unsigned int bandWidth;
+	/* AAC file frequency bandwidth */
+	unsigned int bandWidth;
 
+	/*
+		Bitstream output format, meaning:
+		0 - Raw
+		1 - ADTS
+		/AV
+	*/
+	unsigned int outputFormat;
+
 } faacEncConfiguration, *faacEncConfigurationPtr;
 
 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);
 
 faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate,
-                                  unsigned int numChannels,
-                                  unsigned long *inputSamples,
-                                  unsigned long *maxOutputBytes);
+								  unsigned int numChannels,
+								  unsigned long *inputSamples,
+								  unsigned long *maxOutputBytes);
 
+int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder,
+										  unsigned char** ppBuffer,
+										  unsigned long* pSizeOfDecoderSpecificInfo);
+
 int FAACAPI faacEncEncode(faacEncHandle hEncoder,
-                          short *inputBuffer,
-                          unsigned int samplesInput,
-                          void *outputBuffer,
-                          unsigned int bufferSize
-                          );
+						  short *inputBuffer,
+						  unsigned int samplesInput,
+						  void *outputBuffer,
+						  unsigned int bufferSize
+						  );
 
 int FAACAPI faacEncClose(faacEncHandle hEncoder);
 
--- a/libfaac/bitstream.c
+++ b/libfaac/bitstream.c
@@ -24,7 +24,7 @@
 Copyright (c) 1997.
 **********************************************************************/
 /*
- * $Id: bitstream.c,v 1.20 2001/09/04 18:39:35 menno Exp $
+ * $Id: bitstream.c,v 1.21 2001/09/21 12:40:02 eraser Exp $
  */
 
 #include <stdlib.h>
@@ -48,7 +48,11 @@
 
     CountBitstream(hEncoder, coderInfo, channelInfo, bitStream, numChannel);
 
-    bits += WriteADTSHeader(hEncoder, bitStream, 1);
+	if(hEncoder->config.outputFormat == 1){
+		bits += WriteADTSHeader(hEncoder, bitStream, 1);
+	}else{
+		bits = 0; // compilier will remove it, byt anyone will see that current size of bitstream is 0
+	}
 
     for (channel = 0; channel < numChannel; channel++) {
 
@@ -127,7 +131,13 @@
     int bits = 0;
     int bitsLeftAfterFill, numFillBits;
 
-    bits += WriteADTSHeader(hEncoder, bitStream, 0);
+
+	if(hEncoder->config.outputFormat == 1){
+		bits += WriteADTSHeader(hEncoder, bitStream, 0);
+	}else{
+		bits = 0; // compilier will remove it, byt anyone will see that current size of bitstream is 0
+	}
+
 
     for (channel = 0; channel < numChannel; channel++) {
 
--- 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.25 2001/09/09 16:03:16 menno Exp $
+ * $Id: frame.c,v 1.26 2001/09/21 12:40:02 eraser Exp $
  */
 
 /*
@@ -30,6 +30,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 
 #include "frame.h"
 #include "coder.h"
@@ -102,7 +103,10 @@
     hEncoder->config.aacObjectType = config->aacObjectType;
     hEncoder->config.mpegVersion = config->mpegVersion;
     hEncoder->config.bandWidth = config->bandWidth;
+	hEncoder->config.outputFormat = config->outputFormat;
 
+	assert((hEncoder->config.outputFormat == 0) || (hEncoder->config.outputFormat == 1));
+
     /* No SSR supported for now */
     if (hEncoder->config.aacObjectType == SSR)
         return 0;
@@ -157,6 +161,13 @@
     hEncoder->config.useTns = 0;
     hEncoder->config.bitRate = 64000; /* default bitrate / channel */
     hEncoder->config.bandWidth = 18000; /* default bandwidth */
+
+	/*
+		by default we have to be compatible with all previous software
+		which assumes that we will generate ADTS
+		/AV
+	*/
+	hEncoder->config.outputFormat = 1;
 
     /* find correct sampling rate depending parameters */
     hEncoder->srInfo = &srInfo[hEncoder->sampleRateIdx];
--- 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.14 2001/09/09 16:03:16 menno Exp $
+ * $Id: frame.h,v 1.15 2001/09/21 12:40:02 eraser Exp $
  */
 
 #ifndef FRAME_H
@@ -66,6 +66,14 @@
 
     /* AAC file frequency bandwidth */
     unsigned int bandWidth;
+
+	/*
+		Bitstream output format, meaning:
+		0 - Raw
+		1 - ADTS
+		/AV
+	*/
+	unsigned int outputFormat;
 
 } faacEncConfiguration, *faacEncConfigurationPtr;