- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# neaacdec.h

    00001 /*
    00002 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
    00003 ** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
    00004 **
    00005 ** This program is free software; you can redistribute it and/or modify
    00006 ** it under the terms of the GNU General Public License as published by
    00007 ** the Free Software Foundation; either version 2 of the License, or
    00008 ** (at your option) any later version.
    00009 **
    00010 ** This program is distributed in the hope that it will be useful,
    00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013 ** GNU General Public License for more details.
    00014 **
    00015 ** You should have received a copy of the GNU General Public License
    00016 ** along with this program; if not, write to the Free Software
    00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018 **
    00019 ** Any non-GPL usage of this software or parts of this software is strictly
    00020 ** forbidden.
    00021 **
    00022 ** Software using this code must display the following message visibly in the
    00023 ** software:
    00024 ** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
    00025 ** in, for example, the about-box or help/startup screen.
    00026 **
    00027 ** Commercial non-GPL licensing of this software is possible.
    00028 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
    00029 **
    00030 ** $Id: neaacdec.h,v 1.3 2005/11/01 21:41:43 gabest Exp $
    00031 **/
    00032
    00033 #ifndef __NEAACDEC_H__
    00034 #define __NEAACDEC_H__
    00035
    00036 #ifdef __cplusplus
    00037 extern "C" {
    00038 #endif /* __cplusplus */
    00039
    00040
    00041 #if 1
    00042 /* MACROS FOR BACKWARDS COMPATIBILITY */
    00043 /* structs */
    00044 #define faacDecHandle                  NeAACDecHandle
    00045 #define faacDecConfiguration           NeAACDecConfiguration
    00046 #define faacDecConfigurationPtr        NeAACDecConfigurationPtr
    00047 #define faacDecFrameInfo               NeAACDecFrameInfo
    00048 /* functions */
    00049 #define faacDecGetErrorMessage         NeAACDecGetErrorMessage
    00050 #define faacDecSetConfiguration        NeAACDecSetConfiguration
    00051 #define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration
    00052 #define faacDecInit                    NeAACDecInit
    00053 #define faacDecInit2                   NeAACDecInit2
    00054 #define faacDecInitDRM                 NeAACDecInitDRM
    00055 #define faacDecPostSeekReset           NeAACDecPostSeekReset
    00056 #define faacDecOpen                    NeAACDecOpen
    00057 #define faacDecClose                   NeAACDecClose
    00058 #define faacDecDecode                  NeAACDecDecode
    00059 #define AudioSpecificConfig            NeAACDecAudioSpecificConfig
    00060 #endif
    00061
    00062
    00063 #ifdef _WIN32
    00064   #pragma pack(push, 8)
    00065   #ifndef NEAACDECAPI
    00066     #define NEAACDECAPI __cdecl
    00067   #endif
    00068 #else
    00069   #ifndef NEAACDECAPI
    00070     #define NEAACDECAPI
    00071   #endif
    00072 #endif
    00073
    00074 #define FAAD2_VERSION "2.1 beta"
    00075
    00076 /* object types for AAC */
    00077 #define MAIN       1
    00078 #define LC         2
    00079 #define SSR        3
    00080 #define LTP        4
    00081 #define HE_AAC     5
    00082 #define ER_LC     17
    00083 #define ER_LTP    19
    00084 #define LD        23
    00085 #define DRM_ER_LC 27 /* special object type for DRM */
    00086
    00087 /* header types */
    00088 #define RAW        0
    00089 #define ADIF       1
    00090 #define ADTS       2
    00091
    00092 /* SBR signalling */
    00093 #define NO_SBR           0
    00094 #define SBR_UPSAMPLED    1
    00095 #define SBR_DOWNSAMPLED  2
    00096 #define NO_SBR_UPSAMPLED 3
    00097
    00098 /* library output formats */
    00099 #define FAAD_FMT_16BIT  1
    00100 #define FAAD_FMT_24BIT  2
    00101 #define FAAD_FMT_32BIT  3
    00102 #define FAAD_FMT_FLOAT  4
    00103 #define FAAD_FMT_FIXED  FAAD_FMT_FLOAT
    00104 #define FAAD_FMT_DOUBLE 5
    00105
    00106 /* Capabilities */
    00107 #define LC_DEC_CAP           (1<<0) /* Can decode LC */
    00108 #define MAIN_DEC_CAP         (1<<1) /* Can decode MAIN */
    00109 #define LTP_DEC_CAP          (1<<2) /* Can decode LTP */
    00110 #define LD_DEC_CAP           (1<<3) /* Can decode LD */
    00111 #define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
    00112 #define FIXED_POINT_CAP      (1<<5) /* Fixed point */
    00113
    00114 /* Channel definitions */
    00115 #define FRONT_CHANNEL_CENTER (1)
    00116 #define FRONT_CHANNEL_LEFT   (2)
    00117 #define FRONT_CHANNEL_RIGHT  (3)
    00118 #define SIDE_CHANNEL_LEFT    (4)
    00119 #define SIDE_CHANNEL_RIGHT   (5)
    00120 #define BACK_CHANNEL_LEFT    (6)
    00121 #define BACK_CHANNEL_RIGHT   (7)
    00122 #define BACK_CHANNEL_CENTER  (8)
    00123 #define LFE_CHANNEL          (9)
    00124 #define UNKNOWN_CHANNEL      (0)
    00125
    00126 /* DRM channel definitions */
    00127 #define DRMCH_MONO          1
    00128 #define DRMCH_STEREO        2
    00129 #define DRMCH_SBR_MONO      3
    00130 #define DRMCH_SBR_STEREO    4
    00131 #define DRMCH_SBR_PS_STEREO 5
    00132
    00133
    00134 /* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
    00135    so at least so much bytes per channel should be available in this stream */
    00136 #define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
    00137
    00138
    00139 typedef void *NeAACDecHandle;
    00140
    00141 typedef struct mp4AudioSpecificConfig
    00142 {
    00143     /* Audio Specific Info */
    00144     unsigned char objectTypeIndex;
    00145     unsigned char samplingFrequencyIndex;
    00146     unsigned long samplingFrequency;
    00147     unsigned char channelsConfiguration;
    00148
    00149     /* GA Specific Info */
    00150     unsigned char frameLengthFlag;
    00151     unsigned char dependsOnCoreCoder;
    00152     unsigned short coreCoderDelay;
    00153     unsigned char extensionFlag;
    00154     unsigned char aacSectionDataResilienceFlag;
    00155     unsigned char aacScalefactorDataResilienceFlag;
    00156     unsigned char aacSpectralDataResilienceFlag;
    00157     unsigned char epConfig;
    00158
    00159     char sbr_present_flag;
    00160     char forceUpSampling;
    00161     char downSampledSBR;
    00162 } mp4AudioSpecificConfig;
    00163
    00164 typedef struct NeAACDecConfiguration
    00165 {
    00166     unsigned char defObjectType;
    00167     unsigned long defSampleRate;
    00168     unsigned char outputFormat;
    00169     unsigned char downMatrix;
    00170     unsigned char useOldADTSFormat;
    00171     unsigned char dontUpSampleImplicitSBR;
    00172 } NeAACDecConfiguration, *NeAACDecConfigurationPtr;
    00173
    00174 typedef struct NeAACDecFrameInfo
    00175 {
    00176     unsigned long bytesconsumed;
    00177     unsigned long samples;
    00178     unsigned char channels;
    00179     unsigned char error;
    00180     unsigned long samplerate;
    00181
    00182     /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
    00183     unsigned char sbr;
    00184
    00185     /* MPEG-4 ObjectType */
    00186     unsigned char object_type;
    00187
    00188     /* AAC header type; MP4 will be signalled as RAW also */
    00189     unsigned char header_type;
    00190
    00191     /* multichannel configuration */
    00192     unsigned char num_front_channels;
    00193     unsigned char num_side_channels;
    00194     unsigned char num_back_channels;
    00195     unsigned char num_lfe_channels;
    00196     unsigned char channel_position[64];
    00197
    00198     /* PS: 0: off, 1: on */
    00199     unsigned char ps;
    00200 } NeAACDecFrameInfo;
    00201
    00202 char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
    00203
    00204 unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
    00205
    00206 NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
    00207
    00208 NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
    00209
    00210 unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
    00211                                                    NeAACDecConfigurationPtr config);
    00212
    00213 /* Init the library based on info from the AAC file (ADTS/ADIF) */
    00214 long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
    00215                               unsigned char *buffer,
    00216                               unsigned long buffer_size,
    00217                               unsigned long *samplerate,
    00218                               unsigned char *channels);
    00219
    00220 /* Init the library using a DecoderSpecificInfo */
    00221 char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer,
    00222                                unsigned long SizeOfDecoderSpecificInfo,
    00223                                unsigned long *samplerate, unsigned char *channels);
    00224
    00225 /* Init the library for DRM */
    00226 char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
    00227                                  unsigned char channels);
    00228
    00229 void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
    00230
    00231 void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
    00232
    00233 void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
    00234                                  NeAACDecFrameInfo *hInfo,
    00235                                  unsigned char *buffer,
    00236                                  unsigned long buffer_size);
    00237
    00238 void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
    00239                                   NeAACDecFrameInfo *hInfo,
    00240                                   unsigned char *buffer,
    00241                                   unsigned long buffer_size,
    00242                                   void **sample_buffer,
    00243                                   unsigned long sample_buffer_size);
    00244
    00245 char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
    00246                                              unsigned long buffer_size,
    00247                                              mp4AudioSpecificConfig *mp4ASC);
    00248
    00249 #ifdef _WIN32
    00250   #pragma pack(pop)
    00251 #endif
    00252
    00253 #ifdef __cplusplus
    00254 }
    00255 #endif /* __cplusplus */
    00256
    00257 #endif