ref: b84dd4bf5d05c1f9b953da9a905a8fce7145d6bf
parent: 08f5deea621ea0dba25aa503e78c9bbd737f70c4
author: knik <knik>
date: Thu Mar 1 13:34:17 EST 2012
Build faac against the public API exposed in <faac.h> instead of the private API defined in "libfaac/frame.h".
--- 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.37 2012/02/23 13:11:27 knik Exp $
+ * $Id: faac.h,v 1.38 2012/03/01 18:34:17 knik Exp $
*/
#ifndef _FAAC_H_
@@ -26,9 +26,12 @@
extern "C" {
#endif /* __cplusplus */
-#ifndef FAACAPI
+
+#if !defined(FAACAPI) && defined(__GNUC__) && (__GNUC__ >= 4)
# if defined(_WIN32)
-# define FAACAPI __stdcall
+# define FAACAPI __stdcall __declspec(dllexport)
+# else
+# define FAACAPI __attribute__((visibility("default")))
# endif
#endif
#ifndef FAACAPI
--- a/libfaac/aacquant.c
+++ b/libfaac/aacquant.c
@@ -17,13 +17,13 @@
* 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: aacquant.c,v 1.32 2008/03/23 23:00:25 menno Exp $
+ * $Id: aacquant.c,v 1.33 2012/03/01 18:34:17 knik Exp $
*/
#include <math.h>
#include <stdlib.h>
-#include "frame.h"
+#include <faac.h>
#include "aacquant.h"
#include "coder.h"
#include "huffman.h"
--- a/libfaac/backpred.c
+++ b/libfaac/backpred.c
@@ -24,7 +24,7 @@
Copyright (c) 1997.
**********************************************************************/
/*
- * $Id: backpred.c,v 1.5 2001/09/04 18:39:35 menno Exp $
+ * $Id: backpred.c,v 1.6 2012/03/01 18:34:17 knik Exp $
*/
#include <math.h>
@@ -34,7 +34,7 @@
#include "backpred.h"
-void PredInit(faacEncHandle hEncoder)
+void PredInit(faacEncStruct* hEncoder)
{
unsigned int channel;
--- a/libfaac/backpred.h
+++ b/libfaac/backpred.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: backpred.h,v 1.5 2001/06/08 18:01:09 menno Exp $
+ * $Id: backpred.h,v 1.6 2012/03/01 18:34:17 knik Exp $
*/
#ifndef _AAC_BACK_H_INCLUDED
@@ -43,7 +43,7 @@
ChannelInfo *channelInfo,
int chanNum);
-void PredInit(faacEncHandle hEncoder);
+void PredInit(faacEncStruct* hEncoder);
void CopyPredInfo(CoderInfo *right, CoderInfo *left);
--- a/libfaac/bitstream.c
+++ b/libfaac/bitstream.c
@@ -24,7 +24,7 @@
Copyright (c) 1997.
**********************************************************************/
/*
- * $Id: bitstream.c,v 1.34 2007/06/05 18:59:47 menno Exp $
+ * $Id: bitstream.c,v 1.35 2012/03/01 18:34:17 knik Exp $
*/
#include <stdio.h>
@@ -37,12 +37,12 @@
#include "ltp.h"
#include "util.h"
-static int CountBitstream(faacEncHandle hEncoder,
+static int CountBitstream(faacEncStruct* hEncoder,
CoderInfo *coderInfo,
ChannelInfo *channelInfo,
BitStream *bitStream,
int numChannels);
-static int WriteADTSHeader(faacEncHandle hEncoder,
+static int WriteADTSHeader(faacEncStruct* hEncoder,
BitStream *bitStream,
int writeFlag);
static int WriteCPE(CoderInfo *coderInfoL,
@@ -152,7 +152,7 @@
}
-int WriteBitstream(faacEncHandle hEncoder,
+int WriteBitstream(faacEncStruct* hEncoder,
CoderInfo *coderInfo,
ChannelInfo *channelInfo,
BitStream *bitStream,
@@ -243,7 +243,7 @@
return bits;
}
-static int CountBitstream(faacEncHandle hEncoder,
+static int CountBitstream(faacEncStruct* hEncoder,
CoderInfo *coderInfo,
ChannelInfo *channelInfo,
BitStream *bitStream,
@@ -329,7 +329,7 @@
return bits;
}
-static int WriteADTSHeader(faacEncHandle hEncoder,
+static int WriteADTSHeader(faacEncStruct* hEncoder,
BitStream *bitStream,
int writeFlag)
{
--- a/libfaac/bitstream.h
+++ b/libfaac/bitstream.h
@@ -32,7 +32,7 @@
Copyright (c) 1996.
**********************************************************************/
/*
- * $Id: bitstream.h,v 1.14 2004/07/04 12:10:52 corrados Exp $
+ * $Id: bitstream.h,v 1.15 2012/03/01 18:34:17 knik Exp $
*/
#ifndef BITSTREAM_H
@@ -149,7 +149,7 @@
-int WriteBitstream(faacEncHandle hEncoder,
+int WriteBitstream(faacEncStruct* hEncoder,
CoderInfo *coderInfo,
ChannelInfo *channelInfo,
BitStream *bitStream,
--- a/libfaac/filtbank.c
+++ b/libfaac/filtbank.c
@@ -22,7 +22,7 @@
* *
****************************************************************************/
/*
- * $Id: filtbank.c,v 1.13 2005/02/02 07:51:12 sur Exp $
+ * $Id: filtbank.c,v 1.14 2012/03/01 18:34:17 knik Exp $
*/
/*
@@ -51,7 +51,7 @@
-void FilterBankInit(faacEncHandle hEncoder)
+void FilterBankInit(faacEncStruct* hEncoder)
{
unsigned int i, channel;
@@ -75,7 +75,7 @@
CalculateKBDWindow(hEncoder->kbd_window_short, 6, BLOCK_LEN_SHORT*2);
}
-void FilterBankEnd(faacEncHandle hEncoder)
+void FilterBankEnd(faacEncStruct* hEncoder)
{
unsigned int channel;
@@ -90,7 +90,7 @@
if (hEncoder->kbd_window_short) FreeMemory(hEncoder->kbd_window_short);
}
-void FilterBank(faacEncHandle hEncoder,
+void FilterBank(faacEncStruct* hEncoder,
CoderInfo *coderInfo,
double *p_in_data,
double *p_out_mdct,
@@ -202,7 +202,7 @@
if (transf_buf) FreeMemory(transf_buf);
}
-void IFilterBank(faacEncHandle hEncoder,
+void IFilterBank(faacEncStruct* hEncoder,
CoderInfo *coderInfo,
double *p_in_data,
double *p_out_data,
--- a/libfaac/filtbank.h
+++ b/libfaac/filtbank.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: filtbank.h,v 1.11 2005/02/02 07:51:49 sur Exp $
+ * $Id: filtbank.h,v 1.12 2012/03/01 18:34:17 knik Exp $
*/
#ifndef FILTBANK_H
@@ -41,11 +41,11 @@
#define SINE_WINDOW 0
#define KBD_WINDOW 1
-void FilterBankInit ( faacEncHandle hEncoder );
+void FilterBankInit ( faacEncStruct* hEncoder );
-void FilterBankEnd ( faacEncHandle hEncoder );
+void FilterBankEnd ( faacEncStruct* hEncoder );
-void FilterBank( faacEncHandle hEncoder,
+void FilterBank( faacEncStruct* hEncoder,
CoderInfo *coderInfo,
double *p_in_data,
double *p_out_mdct,
@@ -52,7 +52,7 @@
double *p_overlap,
int overlap_select );
-void IFilterBank( faacEncHandle hEncoder,
+void IFilterBank( faacEncStruct* hEncoder,
CoderInfo *coderInfo,
double *p_in_data,
double *p_out_mdct,
--- 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.68 2009/06/05 16:09:38 menno Exp $
+ * $Id: frame.c,v 1.69 2012/03/01 18:34:17 knik Exp $
*/
/*
@@ -87,8 +87,9 @@
}
-int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder,unsigned char** ppBuffer,unsigned long* pSizeOfDecoderSpecificInfo)
+int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hpEncoder,unsigned char** ppBuffer,unsigned long* pSizeOfDecoderSpecificInfo)
{
+ faacEncStruct* hEncoder = (faacEncStruct*)hpEncoder;
BitStream* pBitStream = NULL;
if((hEncoder == NULL) || (ppBuffer == NULL) || (pSizeOfDecoderSpecificInfo == NULL)) {
@@ -118,16 +119,18 @@
}
-faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration(faacEncHandle hEncoder)
+faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration(faacEncHandle hpEncoder)
{
+ faacEncStruct* hEncoder = (faacEncStruct*)hpEncoder;
faacEncConfigurationPtr config = &(hEncoder->config);
return config;
}
-int FAACAPI faacEncSetConfiguration(faacEncHandle hEncoder,
+int FAACAPI faacEncSetConfiguration(faacEncHandle hpEncoder,
faacEncConfigurationPtr config)
{
+ faacEncStruct* hEncoder = (faacEncStruct*)hpEncoder;
int i;
hEncoder->config.allowMidside = config->allowMidside;
@@ -278,7 +281,7 @@
config->psymodelidx = (sizeof(psymodellist) / sizeof(psymodellist[0])) - 2;
hEncoder->config.psymodelidx = config->psymodelidx;
- hEncoder->psymodel = psymodellist[hEncoder->config.psymodelidx].model;
+ hEncoder->psymodel = (psymodel_t *)psymodellist[hEncoder->config.psymodelidx].ptr;
hEncoder->psymodel->PsyInit(&hEncoder->gpsyInfo, hEncoder->psyInfo, hEncoder->numChannels,
hEncoder->sampleRate, hEncoder->srInfo->cb_width_long,
hEncoder->srInfo->num_cb_long, hEncoder->srInfo->cb_width_short,
@@ -298,7 +301,7 @@
unsigned long *maxOutputBytes)
{
unsigned int channel;
- faacEncHandle hEncoder;
+ faacEncStruct* hEncoder;
*inputSamples = FRAME_LEN*numChannels;
*maxOutputBytes = (6144/8)*numChannels;
@@ -335,7 +338,7 @@
hEncoder->config.psymodellist = (psymodellist_t *)psymodellist;
hEncoder->config.psymodelidx = 0;
hEncoder->psymodel =
- hEncoder->config.psymodellist[hEncoder->config.psymodelidx].model;
+ (psymodel_t *)hEncoder->config.psymodellist[hEncoder->config.psymodelidx].ptr;
hEncoder->config.shortctl = SHORTCTL_NORMAL;
/* default channel map is straight-through */
@@ -402,8 +405,9 @@
return hEncoder;
}
-int FAACAPI faacEncClose(faacEncHandle hEncoder)
+int FAACAPI faacEncClose(faacEncHandle hpEncoder)
{
+ faacEncStruct* hEncoder = (faacEncStruct*)hpEncoder;
unsigned int channel;
/* Deinitialize coder functions */
@@ -442,7 +446,7 @@
return 0;
}
-int FAACAPI faacEncEncode(faacEncHandle hEncoder,
+int FAACAPI faacEncEncode(faacEncHandle hpEncoder,
int32_t *inputBuffer,
unsigned int samplesInput,
unsigned char *outputBuffer,
@@ -449,6 +453,7 @@
unsigned int bufferSize
)
{
+ faacEncStruct* hEncoder = (faacEncStruct*)hpEncoder;
unsigned int channel, i;
int sb, frameBytes;
unsigned int offset;
@@ -1117,6 +1122,9 @@
/*
$Log: frame.c,v $
+Revision 1.69 2012/03/01 18:34:17 knik
+Build faac against the public API exposed in <faac.h> instead of the private API defined in "libfaac/frame.h".
+
Revision 1.68 2009/06/05 16:09:38 menno
Allow higher bitrates
--- 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.31 2012/02/23 13:11:28 knik Exp $
+ * $Id: frame.h,v 1.32 2012/03/01 18:34:17 knik Exp $
*/
#ifndef FRAME_H
@@ -36,6 +36,8 @@
# include <stdint.h>
#endif
+#include <faac.h>
+
#ifndef HAVE_INT32_T
typedef signed int int32_t;
#endif
@@ -50,24 +52,8 @@
#include "aacquant.h"
#include "fft.h"
-#if !defined(FAACAPI) && defined(__GNUC__) && (__GNUC__ >= 4)
-# if defined(_WIN32)
-# define FAACAPI __stdcall __declspec(dllexport)
-# else
-# define FAACAPI __attribute__((visibility("default")))
-# endif
-#endif
-#ifndef FAACAPI
-# define FAACAPI
-#endif
-
#pragma pack(push, 1)
-typedef struct {
- psymodel_t *model;
- char *name;
-} psymodellist_t;
-
#include <faaccfg.h>
typedef struct {
@@ -125,32 +111,7 @@
/* output bits difference in average bitrate mode */
int bitDiff;
-} faacEncStruct, *faacEncHandle;
-
-int FAACAPI faacEncGetVersion(char **faac_id_string,
- char **faac_copyright_string);
-
-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);
-
-int FAACAPI faacEncEncode(faacEncHandle hEncoder,
- int32_t *inputBuffer,
- unsigned int samplesInput,
- unsigned char *outputBuffer,
- unsigned int bufferSize
- );
-
-int FAACAPI faacEncClose(faacEncHandle hEncoder);
-
+} faacEncStruct;
#pragma pack(pop)
--- a/libfaac/huffman.h
+++ b/libfaac/huffman.h
@@ -22,7 +22,7 @@
***********/
/*
- * $Id: huffman.h,v 1.6 2004/07/12 08:46:43 corrados Exp $
+ * $Id: huffman.h,v 1.7 2012/03/01 18:34:17 knik Exp $
*/
#ifndef HUFFMAN_H
@@ -47,7 +47,7 @@
#define ABS(A) ((A) < 0 ? (-A) : (A))
-#include "frame.h"
+#include <faac.h>
void HuffmanInit(CoderInfo *coderInfo, unsigned int numChannels);
void HuffmanEnd(CoderInfo *coderInfo, unsigned int numChannels);
--- a/libfaac/ltp.c
+++ b/libfaac/ltp.c
@@ -24,7 +24,7 @@
***************************************************************************/
/*
- * $Id: ltp.c,v 1.9 2003/06/26 19:20:31 knik Exp $
+ * $Id: ltp.c,v 1.10 2012/03/01 18:34:17 knik Exp $
*/
#include <stdio.h>
@@ -275,7 +275,7 @@
return (bit_gain);
}
-void LtpInit(faacEncHandle hEncoder)
+void LtpInit(faacEncStruct* hEncoder)
{
int i;
unsigned int channel;
@@ -306,7 +306,7 @@
}
}
-void LtpEnd(faacEncHandle hEncoder)
+void LtpEnd(faacEncStruct* hEncoder)
{
unsigned int channel;
--- a/libfaac/ltp.h
+++ b/libfaac/ltp.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: ltp.h,v 1.3 2001/06/08 18:01:09 menno Exp $
+ * $Id: ltp.h,v 1.4 2012/03/01 18:34:17 knik Exp $
*/
#ifndef LTP_H
@@ -26,8 +26,8 @@
-void LtpInit(faacEncHandle hEncoder);
-void LtpEnd(faacEncHandle hEncoder);
+void LtpInit(faacEncStruct* hEncoder);
+void LtpEnd(faacEncStruct* hEncoder);
int LtpEncode(faacEncHandle hEncoder,
CoderInfo *coderInfo,
LtpInfo *ltpInfo,
--- a/libfaac/psychkni.c
+++ b/libfaac/psychkni.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: psychkni.c,v 1.18 2009/06/05 16:32:15 menno Exp $
+ * $Id: psychkni.c,v 1.19 2012/03/01 18:34:17 knik Exp $
*/
#include <stdio.h>
#include <stdlib.h>
@@ -26,7 +26,7 @@
#include "coder.h"
#include "fft.h"
#include "util.h"
-#include "frame.h"
+#include <faac.h>
typedef float psyfloat;
--- a/libfaac/tns.c
+++ b/libfaac/tns.c
@@ -24,7 +24,7 @@
Copyright (c) 1997.
**********************************************************************/
/*
- * $Id: tns.c,v 1.10 2003/11/24 18:08:28 knik Exp $
+ * $Id: tns.c,v 1.11 2012/03/01 18:34:17 knik Exp $
*/
#include <math.h>
@@ -84,7 +84,7 @@
/*****************************************************/
/* InitTns: */
/*****************************************************/
-void TnsInit(faacEncHandle hEncoder)
+void TnsInit(faacEncStruct* hEncoder)
{
unsigned int channel;
int fsIndex = hEncoder->sampleRateIdx;
--- a/libfaac/tns.h
+++ b/libfaac/tns.h
@@ -24,7 +24,7 @@
Copyright (c) 1997.
**********************************************************************/
/*
- * $Id: tns.h,v 1.5 2003/11/24 18:08:28 knik Exp $
+ * $Id: tns.h,v 1.6 2012/03/01 18:34:17 knik Exp $
*/
#ifndef TNS_H
@@ -35,7 +35,7 @@
#endif /* __cplusplus */
-void TnsInit(faacEncHandle hEncoder);
+void TnsInit(faacEncStruct* hEncoder);
void TnsEncode(TnsInfo* tnsInfo, int numberOfBands,int maxSfb,enum WINDOW_TYPE blockType,
int* sfbOffsetTable,double* spec);
void TnsEncodeFilterOnly(TnsInfo* tnsInfo, int numberOfBands, int maxSfb,