neaacdec.h
Go to the documentation of this file.
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
** MA 02110-1301 USA
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: neaacdec.h,v 1.13 2009/01/26 23:51:15 menno Exp $
**/
#ifndef __NEAACDEC_H__
#define __NEAACDEC_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if 1
/* MACROS FOR BACKWARDS COMPATIBILITY */
/* structs */
#define faacDecHandle NeAACDecHandle
#define faacDecConfiguration NeAACDecConfiguration
#define faacDecConfigurationPtr NeAACDecConfigurationPtr
#define faacDecFrameInfo NeAACDecFrameInfo
/* functions */
#define faacDecGetErrorMessage NeAACDecGetErrorMessage
#define faacDecSetConfiguration NeAACDecSetConfiguration
#define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration
#define faacDecInit NeAACDecInit
#define faacDecInit2 NeAACDecInit2
#define faacDecInitDRM NeAACDecInitDRM
#define faacDecInitDAB NeAACDecInitDAB
#define faacDecPostSeekReset NeAACDecPostSeekReset
#define faacDecOpen NeAACDecOpen
#define faacDecClose NeAACDecClose
#define faacDecDecode NeAACDecDecode
#define AudioSpecificConfig NeAACDecAudioSpecificConfig
#endif
#ifdef _WIN32
#pragma pack(push, 8)
#ifndef NEAACDECAPI
#define NEAACDECAPI __cdecl
#endif
#else
#ifndef NEAACDECAPI
#define NEAACDECAPI
#endif
#endif
#define FAAD2_VERSION "2.7"
/* object types for AAC */
#define MAIN 1
#define LC 2
#define SSR 3
#define LTP 4
#define HE_AAC 5
#define ER_LC 17
#define ER_LTP 19
#define LD 23
#define DRM_ER_LC 27 /* special object type for DRM */
/* header types */
#define RAW 0
#define ADIF 1
#define ADTS 2
#define LATM 3
/* SBR signalling */
#define NO_SBR 0
#define SBR_UPSAMPLED 1
#define SBR_DOWNSAMPLED 2
#define NO_SBR_UPSAMPLED 3
/* library output formats */
#define FAAD_FMT_16BIT 1
#define FAAD_FMT_24BIT 2
#define FAAD_FMT_32BIT 3
#define FAAD_FMT_FLOAT 4
#define FAAD_FMT_FIXED FAAD_FMT_FLOAT
#define FAAD_FMT_DOUBLE 5
/* Capabilities */
#define LC_DEC_CAP (1<<0) /* Can decode LC */
#define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */
#define LTP_DEC_CAP (1<<2) /* Can decode LTP */
#define LD_DEC_CAP (1<<3) /* Can decode LD */
#define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
#define FIXED_POINT_CAP (1<<5) /* Fixed point */
/* Channel definitions */
#define FRONT_CHANNEL_CENTER (1)
#define FRONT_CHANNEL_LEFT (2)
#define FRONT_CHANNEL_RIGHT (3)
#define SIDE_CHANNEL_LEFT (4)
#define SIDE_CHANNEL_RIGHT (5)
#define BACK_CHANNEL_LEFT (6)
#define BACK_CHANNEL_RIGHT (7)
#define BACK_CHANNEL_CENTER (8)
#define LFE_CHANNEL (9)
#define UNKNOWN_CHANNEL (0)
/* DRM channel definitions */
#define DRMCH_MONO 1
#define DRMCH_STEREO 2
#define DRMCH_SBR_MONO 3
#define DRMCH_SBR_STEREO 4
#define DRMCH_SBR_PS_STEREO 5
/* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
so at least so much bytes per channel should be available in this stream */
#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
typedef void *NeAACDecHandle;
typedef struct mp4AudioSpecificConfig
{
/* Audio Specific Info */
unsigned char objectTypeIndex;
unsigned char samplingFrequencyIndex;
unsigned long samplingFrequency;
unsigned char channelsConfiguration;
/* GA Specific Info */
unsigned char frameLengthFlag;
unsigned char dependsOnCoreCoder;
unsigned short coreCoderDelay;
unsigned char extensionFlag;
unsigned char aacSectionDataResilienceFlag;
unsigned char aacScalefactorDataResilienceFlag;
unsigned char aacSpectralDataResilienceFlag;
unsigned char epConfig;
char sbr_present_flag;
char forceUpSampling;
char downSampledSBR;
} mp4AudioSpecificConfig;
typedef struct NeAACDecConfiguration
{
unsigned char defObjectType;
unsigned long defSampleRate;
unsigned char outputFormat;
unsigned char downMatrix;
unsigned char useOldADTSFormat;
unsigned char dontUpSampleImplicitSBR;
} NeAACDecConfiguration, *NeAACDecConfigurationPtr;
typedef struct NeAACDecFrameInfo
{
unsigned long bytesconsumed;
unsigned long samples;
unsigned char channels;
unsigned char error;
unsigned long samplerate;
/* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
unsigned char sbr;
/* MPEG-4 ObjectType */
unsigned char object_type;
/* AAC header type; MP4 will be signalled as RAW also */
unsigned char header_type;
/* multichannel configuration */
unsigned char num_front_channels;
unsigned char num_side_channels;
unsigned char num_back_channels;
unsigned char num_lfe_channels;
unsigned char channel_position[64];
/* PS: 0: off, 1: on */
unsigned char ps;
} NeAACDecFrameInfo;
char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
NeAACDecConfigurationPtr config);
/* Init the library based on info from the AAC file (ADTS/ADIF) */
long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
unsigned char *buffer,
unsigned long buffer_size,
unsigned long *samplerate,
unsigned char *channels);
/* Init the library using a DecoderSpecificInfo */
char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder,
unsigned char *pBuffer,
unsigned long SizeOfDecoderSpecificInfo,
unsigned long *samplerate,
unsigned char *channels);
/* Init the library for DRM */
char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder,
unsigned long samplerate,
unsigned char channels);
char NEAACDECAPI NeAACDecInitDAB(NeAACDecHandle *hDecoder,
unsigned long samplerate,
unsigned char channels,
unsigned char sbr);
void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size);
void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size,
void **sample_buffer,
unsigned long sample_buffer_size);
char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
unsigned long buffer_size,
mp4AudioSpecificConfig *mp4ASC);
#ifdef _WIN32
#pragma pack(pop)
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
NeAACDecHandle
void * NeAACDecHandle
Definition neaacdec.h:140
NeAACDecInitDAB
char NEAACDECAPI NeAACDecInitDAB(NeAACDecHandle *hDecoder, unsigned long samplerate, unsigned char channels, unsigned char sbr)
NeAACDecDecode
void *NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, unsigned char *buffer, unsigned long buffer_size)
NEAACDECAPI
#define NEAACDECAPI
Definition neaacdec.h:70
NeAACDecConfigurationPtr
struct NeAACDecConfiguration * NeAACDecConfigurationPtr
NeAACDecGetCurrentConfiguration
NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder)
NeAACDecOpen
NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
NeAACDecPostSeekReset
void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame)
NeAACDecInitDRM
char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate, unsigned char channels)
NeAACDecClose
void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder)
NeAACDecInit
long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, unsigned char *buffer, unsigned long buffer_size, unsigned long *samplerate, unsigned char *channels)
NeAACDecInit2
char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer, unsigned long SizeOfDecoderSpecificInfo, unsigned long *samplerate, unsigned char *channels)
NeAACDecAudioSpecificConfig
char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer, unsigned long buffer_size, mp4AudioSpecificConfig *mp4ASC)
NeAACDecSetConfiguration
unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, NeAACDecConfigurationPtr config)
NeAACDecDecode2
void *NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, unsigned char *buffer, unsigned long buffer_size, void **sample_buffer, unsigned long sample_buffer_size)
NeAACDecGetCapabilities
unsigned long NEAACDECAPI NeAACDecGetCapabilities(void)
NeAACDecGetErrorMessage
char *NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode)
NeAACDecConfiguration
Definition neaacdec.h:166
NeAACDecConfiguration::defSampleRate
unsigned long defSampleRate
Definition neaacdec.h:168
NeAACDecConfiguration::outputFormat
unsigned char outputFormat
Definition neaacdec.h:169
NeAACDecConfiguration::defObjectType
unsigned char defObjectType
Definition neaacdec.h:167
NeAACDecConfiguration::downMatrix
unsigned char downMatrix
Definition neaacdec.h:170
NeAACDecConfiguration::dontUpSampleImplicitSBR
unsigned char dontUpSampleImplicitSBR
Definition neaacdec.h:172
NeAACDecConfiguration::useOldADTSFormat
unsigned char useOldADTSFormat
Definition neaacdec.h:171
NeAACDecFrameInfo
Definition neaacdec.h:176
NeAACDecFrameInfo::channel_position
unsigned char channel_position[64]
Definition neaacdec.h:197
NeAACDecFrameInfo::object_type
unsigned char object_type
Definition neaacdec.h:187
NeAACDecFrameInfo::num_back_channels
unsigned char num_back_channels
Definition neaacdec.h:195
NeAACDecFrameInfo::num_side_channels
unsigned char num_side_channels
Definition neaacdec.h:194
NeAACDecFrameInfo::ps
unsigned char ps
Definition neaacdec.h:200
NeAACDecFrameInfo::header_type
unsigned char header_type
Definition neaacdec.h:190
NeAACDecFrameInfo::num_lfe_channels
unsigned char num_lfe_channels
Definition neaacdec.h:196
NeAACDecFrameInfo::samples
unsigned long samples
Definition neaacdec.h:178
NeAACDecFrameInfo::sbr
unsigned char sbr
Definition neaacdec.h:184
NeAACDecFrameInfo::num_front_channels
unsigned char num_front_channels
Definition neaacdec.h:193
NeAACDecFrameInfo::bytesconsumed
unsigned long bytesconsumed
Definition neaacdec.h:177
NeAACDecFrameInfo::channels
unsigned char channels
Definition neaacdec.h:179
NeAACDecFrameInfo::samplerate
unsigned long samplerate
Definition neaacdec.h:181
NeAACDecFrameInfo::error
unsigned char error
Definition neaacdec.h:180
mp4AudioSpecificConfig
Definition neaacdec.h:143
mp4AudioSpecificConfig::epConfig
unsigned char epConfig
Definition neaacdec.h:158
mp4AudioSpecificConfig::sbr_present_flag
char sbr_present_flag
Definition neaacdec.h:160
mp4AudioSpecificConfig::dependsOnCoreCoder
unsigned char dependsOnCoreCoder
Definition neaacdec.h:152
mp4AudioSpecificConfig::frameLengthFlag
unsigned char frameLengthFlag
Definition neaacdec.h:151
mp4AudioSpecificConfig::channelsConfiguration
unsigned char channelsConfiguration
Definition neaacdec.h:148
mp4AudioSpecificConfig::aacScalefactorDataResilienceFlag
unsigned char aacScalefactorDataResilienceFlag
Definition neaacdec.h:156
mp4AudioSpecificConfig::downSampledSBR
char downSampledSBR
Definition neaacdec.h:162
mp4AudioSpecificConfig::coreCoderDelay
unsigned short coreCoderDelay
Definition neaacdec.h:153
mp4AudioSpecificConfig::samplingFrequencyIndex
unsigned char samplingFrequencyIndex
Definition neaacdec.h:146
mp4AudioSpecificConfig::objectTypeIndex
unsigned char objectTypeIndex
Definition neaacdec.h:145
mp4AudioSpecificConfig::forceUpSampling
char forceUpSampling
Definition neaacdec.h:161
mp4AudioSpecificConfig::extensionFlag
unsigned char extensionFlag
Definition neaacdec.h:154
mp4AudioSpecificConfig::aacSpectralDataResilienceFlag
unsigned char aacSpectralDataResilienceFlag
Definition neaacdec.h:157
mp4AudioSpecificConfig::aacSectionDataResilienceFlag
unsigned char aacSectionDataResilienceFlag
Definition neaacdec.h:155
mp4AudioSpecificConfig::samplingFrequency
unsigned long samplingFrequency
Definition neaacdec.h:147