FAAC定义了一个结构体用来定义解码器的工作解码参数,该结构体的定义如下所示:
typedef struct faacEncConfiguration
{
/* config version */
int version;
/* library version */
char *name;
/* copyright string */
char *copyright;
/* MPEG version, 2 or 4 */
unsigned int mpegVersion;
/* AAC object type */
unsigned int aacObjectType;
/* Allow mid/side coding */
unsigned int allowMidside;
/* Use one of the channels as LFE channel */
/* LFE(low-frequencyeffects) */
unsigned int useLfe;
/* Use Temporal Noise Shaping */
unsigned int useTns;
/* bitrate / channel of AAC file */
unsigned long bitRate;
/* AAC file frequency bandwidth */
unsigned int bandWidth;
/* Quantizer quality */
/* 默认100,值越大音质越高 */
unsigned long quantqual;
/* Bitstream output format (0 = Raw; 1 = ADTS) */
unsigned int outputFormat;
/* psychoacoustic model list */
psymodellist_t *psymodellist;
/* selected index in psymodellist */
unsigned int psymodelidx;
/*
PCM Sample Input Format
0 FAAC_INPUT_NULL invalid, signifies a misconfigured config
1 FAAC_INPUT_16BIT native endian 16bit
2 FAAC_INPUT_24BIT native endian 24bit in 24 bits(not implemented)
3 FAAC_INPUT_32BIT native endian 24bit in 32 bits (DEFAULT)
4 FAAC_INPUT_FLOAT 32bit floating point
*/
unsigned int inputFormat;
/* block type enforcing
* (SHORTCTL_NORMAL/SHORTCTL_NOSHORT/SHORTCTL_NOLONG)
*/
int shortctl;
/*
Channel Remapping
Default 0, 1, 2, 3 ... 63 (64 is MAX_CHANNELS in coder.h)
WAVE 4.0 2, 0, 1, 3
WAVE 5.0 2, 0, 1, 3, 4
WAVE 5.1 2, 0, 1, 4, 5, 3
AIFF 5.1 2, 0, 3, 1, 4, 5
*/
int channel_map[64];
} faacEncConfiguration, *faacEncConfigurationPtr;
主要的参数配置如下所示:
# 2-MPEG2 4-MPEG4
mpegVersion=4
# 1-MAIN 2-LOW 3-SSR 4-LTP
aacObjectType=2
# 0-NO 1-YES
allowMidside=0
# 0-NO 1-YES
useLfe=0
# 0-NO 1-YES
useTns=0
bitRate=48000
bandWidth=64000
# Default=100 LOWER<100 HIGHER>100
quantqua=100
# 0=RAW 1=ADTS
outputFormat=1
函数faacEncGetCurrentConfiguration用于获取解码器的参数配置,而faacEncSetConfiguration用于将配置好的解码参数设定到解码器上去。