diff -urNad faad2-svn~/include/neaacdec.h faad2-svn/include/neaacdec.h --- faad2-svn~/include/neaacdec.h 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/include/neaacdec.h 2007-11-28 23:29:27.000000000 +0000 @@ -35,6 +35,7 @@ extern "C" { #endif /* __cplusplus */ +#include #if 1 /* MACROS FOR BACKWARDS COMPATIBILITY */ @@ -197,51 +198,51 @@ unsigned char ps; } NeAACDecFrameInfo; -char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode); +int8_t* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode); -unsigned long NEAACDECAPI NeAACDecGetCapabilities(void); +uint32_t NEAACDECAPI NeAACDecGetCapabilities(void); NeAACDecHandle NEAACDECAPI NeAACDecOpen(void); NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder); -unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, +uint8_t 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); +int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, + uint8_t *buffer, + uint32_t buffer_size, + uint32_t *samplerate, + uint8_t *channels); /* Init the library using a DecoderSpecificInfo */ -char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer, - unsigned long SizeOfDecoderSpecificInfo, - unsigned long *samplerate, unsigned char *channels); +int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer, + uint32_t SizeOfDecoderSpecificInfo, + uint32_t *samplerate, uint8_t *channels); /* Init the library for DRM */ -char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate, - unsigned char channels); +int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate, + uint8_t channels); -void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame); +void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame); void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder); void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, - unsigned char *buffer, - unsigned long buffer_size); + uint8_t *buffer, + uint32_t buffer_size); void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, - unsigned char *buffer, - unsigned long buffer_size, + uint8_t *buffer, + uint32_t buffer_size, void **sample_buffer, - unsigned long sample_buffer_size); + uint32_t sample_buffer_size); -char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer, - unsigned long buffer_size, +int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer, + uint32_t buffer_size, mp4AudioSpecificConfig *mp4ASC); #ifdef _WIN32 diff -urNad faad2-svn~/libfaad/Makefile.am faad2-svn/libfaad/Makefile.am --- faad2-svn~/libfaad/Makefile.am 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/Makefile.am 2007-11-28 23:31:03.000000000 +0000 @@ -1,28 +1,29 @@ lib_LTLIBRARIES = libfaad.la +AM_CFLAGS = -iquote $(top_srcdir)/include include_HEADERS = $(top_srcdir)/include/faad.h \ - $(top_srcdir)/include/neaacdec.h + $(top_srcdir)/include/neaacdec.h libfaad_la_LDFLAGS = -lm libfaad_la_SOURCES = bits.c cfft.c decoder.c drc.c \ -drm_dec.c error.c filtbank.c \ -ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c \ -ps_dec.c ps_syntax.c \ -pulse.c specrec.c syntax.c tns.c hcr.c huffman.c \ -rvlc.c ssr.c ssr_fb.c ssr_ipqf.c common.c \ -sbr_dct.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c \ -sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c sbr_dec.c \ -analysis.h bits.h cfft.h cfft_tab.h common.h \ -decoder.h drc.h drm_dec.h error.h fixed.h filtbank.h \ -huffman.h ic_predict.h iq_table.h is.h kbd_win.h lt_predict.h \ -mdct.h mdct_tab.h mp4.h ms.h output.h pns.h ps_dec.h ps_tables.h \ -pulse.h rvlc.h \ -sbr_dct.h sbr_dec.h sbr_e_nf.h sbr_fbt.h sbr_hfadj.h sbr_hfgen.h \ -sbr_huff.h sbr_noise.h sbr_qmf.h sbr_syntax.h sbr_tf_grid.h \ -sine_win.h specrec.h ssr.h ssr_fb.h ssr_ipqf.h \ -ssr_win.h syntax.h structs.h tns.h \ -sbr_qmf_c.h codebook/hcb.h \ -codebook/hcb_1.h codebook/hcb_2.h codebook/hcb_3.h codebook/hcb_4.h \ -codebook/hcb_5.h codebook/hcb_6.h codebook/hcb_7.h codebook/hcb_8.h \ -codebook/hcb_9.h codebook/hcb_10.h codebook/hcb_11.h codebook/hcb_sf.h \ No newline at end of file + drm_dec.c error.c filtbank.c \ + ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c \ + ps_dec.c ps_syntax.c \ + pulse.c specrec.c syntax.c tns.c hcr.c huffman.c \ + rvlc.c ssr.c ssr_fb.c ssr_ipqf.c common.c \ + sbr_dct.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c \ + sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c sbr_dec.c \ + analysis.h bits.h cfft.h cfft_tab.h common.h \ + decoder.h drc.h drm_dec.h error.h fixed.h filtbank.h \ + huffman.h ic_predict.h iq_table.h is.h kbd_win.h lt_predict.h \ + mdct.h mdct_tab.h mp4.h ms.h output.h pns.h ps_dec.h ps_tables.h \ + pulse.h rvlc.h \ + sbr_dct.h sbr_dec.h sbr_e_nf.h sbr_fbt.h sbr_hfadj.h sbr_hfgen.h \ + sbr_huff.h sbr_noise.h sbr_qmf.h sbr_syntax.h sbr_tf_grid.h \ + sine_win.h specrec.h ssr.h ssr_fb.h ssr_ipqf.h \ + ssr_win.h syntax.h structs.h tns.h \ + sbr_qmf_c.h codebook/hcb.h \ + codebook/hcb_1.h codebook/hcb_2.h codebook/hcb_3.h codebook/hcb_4.h \ + codebook/hcb_5.h codebook/hcb_6.h codebook/hcb_7.h codebook/hcb_8.h \ + codebook/hcb_9.h codebook/hcb_10.h codebook/hcb_11.h codebook/hcb_sf.h diff -urNad faad2-svn~/libfaad/common.h faad2-svn/libfaad/common.h --- faad2-svn~/libfaad/common.h 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/common.h 2007-11-28 23:29:27.000000000 +0000 @@ -39,6 +39,8 @@ # include "../config.h" #endif +#include "neaacdec.h" + #if 1 #define INLINE __inline #else @@ -210,7 +212,7 @@ #else # if HAVE_STDINT_H # include -# else +# else /* !HAVE_STDINT_H */ /* we need these... */ #ifndef __TCS__ typedef unsigned long long uint64_t; @@ -225,7 +227,7 @@ typedef long int32_t; typedef short int16_t; typedef char int8_t; -# endif +# endif /* !HAVE_STDINT_H */ #endif #if HAVE_UNISTD_H //# include diff -urNad faad2-svn~/libfaad/decoder.c faad2-svn/libfaad/decoder.c --- faad2-svn~/libfaad/decoder.c 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/decoder.c 2007-11-28 23:29:27.000000000 +0000 @@ -34,7 +34,6 @@ #include #include -#include "decoder.h" #include "mp4.h" #include "syntax.h" #include "error.h" @@ -54,13 +53,13 @@ #endif /* static function declarations */ -static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, +static void* aac_frame_decode(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, uint8_t *buffer, uint32_t buffer_size, void **sample_buffer, uint32_t sample_buffer_size); -static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo); +static void create_channel_config(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo); -char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode) +int8_t* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode) { if (errcode >= NUM_ERROR_MESSAGES) return NULL; @@ -97,9 +96,9 @@ NeAACDecHandle NEAACDECAPI NeAACDecOpen(void) { uint8_t i; - NeAACDecHandle hDecoder = NULL; + NeAACDecStruct* hDecoder = NULL; - if ((hDecoder = (NeAACDecHandle)faad_malloc(sizeof(NeAACDecStruct))) == NULL) + if ((hDecoder = (NeAACDecStruct*)faad_malloc(sizeof(NeAACDecStruct))) == NULL) return NULL; memset(hDecoder, 0, sizeof(NeAACDecStruct)); @@ -154,8 +153,9 @@ return hDecoder; } -NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder) +NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hpDecoder) { + NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if (hDecoder) { NeAACDecConfigurationPtr config = &(hDecoder->config); @@ -166,9 +166,10 @@ return NULL; } -uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, +uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hpDecoder, NeAACDecConfigurationPtr config) { + NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if (hDecoder && config) { /* check if we can decode this object type */ @@ -203,7 +204,7 @@ } -int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer, +int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hpDecoder, uint8_t *buffer, uint32_t buffer_size, uint32_t *samplerate, uint8_t *channels) { @@ -211,7 +212,7 @@ bitfile ld; adif_header adif; adts_header adts; - + NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL)) return -1; @@ -310,12 +311,13 @@ } /* Init the library using a DecoderSpecificInfo */ -int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer, +int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hpDecoder, uint8_t *pBuffer, uint32_t SizeOfDecoderSpecificInfo, uint32_t *samplerate, uint8_t *channels) { int8_t rc; mp4AudioSpecificConfig mp4ASC; + NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if((hDecoder == NULL) || (pBuffer == NULL) @@ -401,9 +403,11 @@ } #ifdef DRM -int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate, +int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hpDecoder, uint32_t samplerate, uint8_t channels) { + NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; + if (hDecoder == NULL) return 1; /* error */ @@ -442,9 +446,10 @@ } #endif -void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder) +void NEAACDECAPI NeAACDecClose(NeAACDecHandle hpDecoder) { uint8_t i; + NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if (hDecoder == NULL) return; @@ -495,8 +500,10 @@ if (hDecoder) faad_free(hDecoder); } -void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame) +void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hpDecoder, int32_t frame) { + NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; + if (hDecoder) { hDecoder->postSeekResetFlag = 1; @@ -506,7 +513,7 @@ } } -static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo) +static void create_channel_config(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo) { hInfo->num_front_channels = 0; hInfo->num_side_channels = 0; @@ -724,18 +731,22 @@ } } -void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, +void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hpDecoder, NeAACDecFrameInfo *hInfo, uint8_t *buffer, uint32_t buffer_size) { + NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; + return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0); } -void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, +void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hpDecoder, NeAACDecFrameInfo *hInfo, uint8_t *buffer, uint32_t buffer_size, void **sample_buffer, uint32_t sample_buffer_size) { + NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; + if ((sample_buffer == NULL) || (sample_buffer_size == 0)) { hInfo->error = 27; @@ -750,14 +761,14 @@ #define ERROR_STATE_INIT 6 -static void conceal_output(NeAACDecHandle hDecoder, uint16_t frame_len, +static void conceal_output(NeAACDecStruct* hDecoder, uint16_t frame_len, uint8_t out_ch, void *sample_buffer) { return; } #endif -static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, +static void* aac_frame_decode(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, uint8_t *buffer, uint32_t buffer_size, void **sample_buffer2, uint32_t sample_buffer_size) { diff -urNad faad2-svn~/libfaad/decoder.h faad2-svn/libfaad/decoder.h --- faad2-svn~/libfaad/decoder.h 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/decoder.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,124 +0,0 @@ -/* -** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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: decoder.h,v 1.48 2007/11/01 12:33:30 menno Exp $ -**/ - -#ifndef __DECODER_H__ -#define __DECODER_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _WIN32 - #pragma pack(push, 8) - #ifndef NEAACDECAPI - #define NEAACDECAPI __cdecl - #endif -#else - #ifndef NEAACDECAPI - #define NEAACDECAPI - #endif -#endif - - -/* 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 - -#define LC_DEC_CAP (1<<0) -#define MAIN_DEC_CAP (1<<1) -#define LTP_DEC_CAP (1<<2) -#define LD_DEC_CAP (1<<3) -#define ERROR_RESILIENCE_CAP (1<<4) -#define FIXED_POINT_CAP (1<<5) - -#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) - -char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode); - -uint32_t NEAACDECAPI NeAACDecGetCapabilities(void); - -NeAACDecHandle NEAACDECAPI NeAACDecOpen(void); - -NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder); - -uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, - NeAACDecConfigurationPtr config); - -/* Init the library based on info from the AAC file (ADTS/ADIF) */ -int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, - uint8_t *buffer, - uint32_t buffer_size, - uint32_t *samplerate, - uint8_t *channels); - -/* Init the library using a DecoderSpecificInfo */ -int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer, - uint32_t SizeOfDecoderSpecificInfo, - uint32_t *samplerate, uint8_t *channels); - -/* Init the library for DRM */ -int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate, - uint8_t channels); - -void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder); - -void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame); - -void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, - NeAACDecFrameInfo *hInfo, - uint8_t *buffer, - uint32_t buffer_size); - -void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, - NeAACDecFrameInfo *hInfo, - uint8_t *buffer, uint32_t buffer_size, - void **sample_buffer, uint32_t sample_buffer_size); - -#ifdef _WIN32 - #pragma pack(pop) -#endif - -#ifdef __cplusplus -} -#endif -#endif diff -urNad faad2-svn~/libfaad/filtbank.c faad2-svn/libfaad/filtbank.c --- faad2-svn~/libfaad/filtbank.c 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/filtbank.c 2007-11-28 23:29:27.000000000 +0000 @@ -40,7 +40,6 @@ #endif #include "filtbank.h" -#include "decoder.h" #include "syntax.h" #include "kbd_win.h" #include "sine_win.h" diff -urNad faad2-svn~/libfaad/hcr.c faad2-svn/libfaad/hcr.c --- faad2-svn~/libfaad/hcr.c 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/hcr.c 2007-11-28 23:29:27.000000000 +0000 @@ -214,7 +214,7 @@ codeword[index].bits.len = 0; } -uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, +uint8_t reordered_spectral_data(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld, int16_t *spectral_data) { uint16_t PCWs_done; diff -urNad faad2-svn~/libfaad/mp4.h faad2-svn/libfaad/mp4.h --- faad2-svn~/libfaad/mp4.h 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/mp4.h 2007-11-28 23:29:27.000000000 +0000 @@ -35,11 +35,7 @@ extern "C" { #endif -#include "decoder.h" - -int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer, - uint32_t buffer_size, - mp4AudioSpecificConfig *mp4ASC); +#include "neaacdec.h" int8_t AudioSpecificConfig2(uint8_t *pBuffer, uint32_t buffer_size, diff -urNad faad2-svn~/libfaad/output.c faad2-svn/libfaad/output.c --- faad2-svn~/libfaad/output.c 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/output.c 2007-11-28 23:29:27.000000000 +0000 @@ -32,7 +32,6 @@ #include "structs.h" #include "output.h" -#include "decoder.h" #ifndef FIXED_POINT @@ -87,7 +86,7 @@ #define CONV(a,b) ((a<<1)|(b&0x1)) -static void to_PCM_16bit(NeAACDecHandle hDecoder, real_t **input, +static void to_PCM_16bit(NeAACDecStruct* hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, int16_t **sample_buffer) { @@ -152,7 +151,7 @@ } } -static void to_PCM_24bit(NeAACDecHandle hDecoder, real_t **input, +static void to_PCM_24bit(NeAACDecStruct* hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, int32_t **sample_buffer) { @@ -222,7 +221,7 @@ } } -static void to_PCM_32bit(NeAACDecHandle hDecoder, real_t **input, +static void to_PCM_32bit(NeAACDecStruct* hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, int32_t **sample_buffer) { @@ -292,7 +291,7 @@ } } -static void to_PCM_float(NeAACDecHandle hDecoder, real_t **input, +static void to_PCM_float(NeAACDecStruct* hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, float32_t **sample_buffer) { @@ -344,7 +343,7 @@ } } -static void to_PCM_double(NeAACDecHandle hDecoder, real_t **input, +static void to_PCM_double(NeAACDecStruct* hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, double **sample_buffer) { @@ -396,7 +395,7 @@ } } -void *output_to_PCM(NeAACDecHandle hDecoder, +void *output_to_PCM(NeAACDecStruct* hDecoder, real_t **input, void *sample_buffer, uint8_t channels, uint16_t frame_len, uint8_t format) { @@ -466,7 +465,7 @@ } } -void* output_to_PCM(NeAACDecHandle hDecoder, +void* output_to_PCM(NeAACDecStruct* hDecoder, real_t **input, void *sample_buffer, uint8_t channels, uint16_t frame_len, uint8_t format) { diff -urNad faad2-svn~/libfaad/output.h faad2-svn/libfaad/output.h --- faad2-svn~/libfaad/output.h 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/output.h 2007-11-28 23:29:27.000000000 +0000 @@ -35,7 +35,7 @@ extern "C" { #endif -void* output_to_PCM(NeAACDecHandle hDecoder, +void* output_to_PCM(NeAACDecStruct* hDecoder, real_t **input, void *samplebuffer, uint8_t channels, diff -urNad faad2-svn~/libfaad/specrec.c faad2-svn/libfaad/specrec.c --- faad2-svn~/libfaad/specrec.c 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/specrec.c 2007-11-28 23:29:27.000000000 +0000 @@ -58,7 +58,7 @@ /* static function declarations */ -static uint8_t quant_to_spec(NeAACDecHandle hDecoder, +static uint8_t quant_to_spec(NeAACDecStruct* hDecoder, ic_stream *ics, int16_t *quant_data, real_t *spec_data, uint16_t frame_len); @@ -300,10 +300,9 @@ in section named section. This offset depends on window_sequence and scale_factor_grouping and is needed to decode the spectral_data(). */ -uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics) +uint8_t window_grouping_info(NeAACDecStruct* hDecoder, ic_stream *ics) { uint8_t i, g; - uint8_t sf_index = hDecoder->sf_index; switch (ics->window_sequence) { @@ -546,7 +545,7 @@ - Within a scalefactor window band, the coefficients are in ascending spectral order. */ -static uint8_t quant_to_spec(NeAACDecHandle hDecoder, +static uint8_t quant_to_spec(NeAACDecStruct* hDecoder, ic_stream *ics, int16_t *quant_data, real_t *spec_data, uint16_t frame_len) { @@ -680,7 +679,7 @@ return error; } -static uint8_t allocate_single_channel(NeAACDecHandle hDecoder, uint8_t channel, +static uint8_t allocate_single_channel(NeAACDecStruct* hDecoder, uint8_t channel, uint8_t output_channels) { int mul = 1; @@ -781,7 +780,7 @@ return 0; } -static uint8_t allocate_channel_pair(NeAACDecHandle hDecoder, +static uint8_t allocate_channel_pair(NeAACDecStruct* hDecoder, uint8_t channel, uint8_t paired_channel) { int mul = 1; @@ -886,7 +885,7 @@ return 0; } -uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, +uint8_t reconstruct_single_channel(NeAACDecStruct* hDecoder, ic_stream *ics, element *sce, int16_t *spec_data) { uint8_t retval; @@ -1096,7 +1095,7 @@ return 0; } -uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, +uint8_t reconstruct_channel_pair(NeAACDecStruct* hDecoder, ic_stream *ics1, ic_stream *ics2, element *cpe, int16_t *spec_data1, int16_t *spec_data2) { uint8_t retval; @@ -1106,6 +1105,7 @@ #ifdef PROFILE int64_t count = faad_get_ts(); #endif + if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) { retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel); diff -urNad faad2-svn~/libfaad/specrec.h faad2-svn/libfaad/specrec.h --- faad2-svn~/libfaad/specrec.h 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/specrec.h 2007-11-28 23:29:27.000000000 +0000 @@ -37,10 +37,10 @@ #include "syntax.h" -uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics); -uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, +uint8_t window_grouping_info(NeAACDecStruct* hDecoder, ic_stream *ics); +uint8_t reconstruct_channel_pair(NeAACDecStruct* hDecoder, ic_stream *ics1, ic_stream *ics2, element *cpe, int16_t *spec_data1, int16_t *spec_data2); -uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, element *sce, +uint8_t reconstruct_single_channel(NeAACDecStruct* hDecoder, ic_stream *ics, element *sce, int16_t *spec_data); #ifdef __cplusplus diff -urNad faad2-svn~/libfaad/structs.h faad2-svn/libfaad/structs.h --- faad2-svn~/libfaad/structs.h 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/structs.h 2007-11-28 23:29:27.000000000 +0000 @@ -312,67 +312,6 @@ ic_stream ics2; } element; /* syntax element (SCE, CPE, LFE) */ -typedef struct mp4AudioSpecificConfig -{ - /* Audio Specific Info */ - /*uint8_t*/ unsigned char objectTypeIndex; - /*uint8_t*/ unsigned char samplingFrequencyIndex; - /*uint32_t*/ unsigned long samplingFrequency; - /*uint8_t*/ unsigned char channelsConfiguration; - - /* GA Specific Info */ - /*uint8_t*/ unsigned char frameLengthFlag; - /*uint8_t*/ unsigned char dependsOnCoreCoder; - /*uint16_t*/ unsigned short coreCoderDelay; - /*uint8_t*/ unsigned char extensionFlag; - /*uint8_t*/ unsigned char aacSectionDataResilienceFlag; - /*uint8_t*/ unsigned char aacScalefactorDataResilienceFlag; - /*uint8_t*/ unsigned char aacSpectralDataResilienceFlag; - /*uint8_t*/ unsigned char epConfig; - - /*uint8_t*/ char sbr_present_flag; - /*uint8_t*/ char forceUpSampling; - /*uint8_t*/ char downSampledSBR; -} mp4AudioSpecificConfig; - -typedef struct NeAACDecConfiguration -{ - /*uint8_t*/ unsigned char defObjectType; - /*uint32_t*/ unsigned long defSampleRate; - /*uint8_t*/ unsigned char outputFormat; - /*uint8_t*/ unsigned char downMatrix; - /*uint8_t*/ unsigned char useOldADTSFormat; - /*uint8_t*/ unsigned char dontUpSampleImplicitSBR; -} NeAACDecConfiguration, *NeAACDecConfigurationPtr; - -typedef struct NeAACDecFrameInfo -{ - /*uint32_t*/ unsigned long bytesconsumed; - /*uint32_t*/ unsigned long samples; - /*uint8_t*/ unsigned char channels; - /*uint8_t*/ unsigned char error; - /*uint32_t*/ unsigned long samplerate; - - /* SBR: 0: off, 1: on; normal, 2: on; downsampled */ - /*uint8_t*/ unsigned char sbr; - - /* MPEG-4 ObjectType */ - /*uint8_t*/ unsigned char object_type; - - /* AAC header type; MP4 will be signalled as RAW also */ - /*uint8_t*/ unsigned char header_type; - - /* multichannel configuration */ - /*uint8_t*/ unsigned char num_front_channels; - /*uint8_t*/ unsigned char num_side_channels; - /*uint8_t*/ unsigned char num_back_channels; - /*uint8_t*/ unsigned char num_lfe_channels; - /*uint8_t*/ unsigned char channel_position[MAX_CHANNELS]; - - /* PS: 0: off, 1: on */ - /*uint8_t*/ unsigned char ps; -} NeAACDecFrameInfo; - typedef struct { uint8_t adts_header_present; @@ -477,9 +416,7 @@ int64_t requant_cycles; #endif const unsigned char *cmes; -} NeAACDecStruct, *NeAACDecHandle; - - +} NeAACDecStruct; #ifdef __cplusplus } diff -urNad faad2-svn~/libfaad/syntax.c faad2-svn/libfaad/syntax.c --- faad2-svn~/libfaad/syntax.c 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/syntax.c 2007-11-28 23:29:27.000000000 +0000 @@ -38,7 +38,6 @@ #include #include -#include "decoder.h" #include "syntax.h" #include "specrec.h" #include "huffman.h" @@ -55,51 +54,51 @@ /* static function declarations */ -static void decode_sce_lfe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, +static void decode_sce_lfe(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele); -static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, +static void decode_cpe(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele); -static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, +static uint8_t single_lfe_channel_element(NeAACDecStruct* hDecoder, bitfile *ld, uint8_t channel, uint8_t *tag); -static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, +static uint8_t channel_pair_element(NeAACDecStruct* hDecoder, bitfile *ld, uint8_t channel, uint8_t *tag); #ifdef COUPLING_DEC -static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld); +static uint8_t coupling_channel_element(NeAACDecStruct* hDecoder, bitfile *ld); #endif -static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld); +static uint16_t data_stream_element(NeAACDecStruct* hDecoder, bitfile *ld); static uint8_t program_config_element(program_config *pce, bitfile *ld); -static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc +static uint8_t fill_element(NeAACDecStruct* hDecoder, bitfile *ld, drc_info *drc #ifdef SBR_DEC ,uint8_t sbr_ele #endif ); -static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele, +static uint8_t individual_channel_stream(NeAACDecStruct* hDecoder, element *ele, bitfile *ld, ic_stream *ics, uint8_t scal_flag, int16_t *spec_data); -static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, +static uint8_t ics_info(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld, uint8_t common_window); -static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld); -static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld); +static uint8_t section_data(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld); +static uint8_t scale_factor_data(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld); #ifdef SSR_DEC static void gain_control_data(bitfile *ld, ic_stream *ics); #endif -static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, +static uint8_t spectral_data(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld, int16_t *spectral_data); static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count); static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld); static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld); #ifdef LTP_DEC -static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld); +static uint8_t ltp_data(NeAACDecStruct* hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld); #endif static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld); static void adts_variable_header(adts_header *adts, bitfile *ld); static void adts_error_check(adts_header *adts, bitfile *ld); static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc); static uint8_t excluded_channels(bitfile *ld, drc_info *drc); -static uint8_t side_info(NeAACDecHandle hDecoder, element *ele, +static uint8_t side_info(NeAACDecStruct* hDecoder, element *ele, bitfile *ld, ic_stream *ics, uint8_t scal_flag); #ifdef DRM -static int8_t DRM_aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, +static int8_t DRM_aac_scalable_main_header(NeAACDecStruct* hDecoder, ic_stream *ics1, ic_stream *ics2, bitfile *ld, uint8_t this_layer_stereo); #endif @@ -321,7 +320,7 @@ return 0; } -static void decode_sce_lfe(NeAACDecHandle hDecoder, +static void decode_sce_lfe(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele) { @@ -366,7 +365,7 @@ hDecoder->fr_ch_ele++; } -static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, +static void decode_cpe(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele) { uint8_t channels = hDecoder->fr_channels; @@ -414,7 +413,7 @@ hDecoder->fr_ch_ele++; } -void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, +void raw_data_block(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc) { uint8_t id_syn_ele; @@ -584,7 +583,7 @@ /* Table 4.4.4 and */ /* Table 4.4.9 */ -static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, +static uint8_t single_lfe_channel_element(NeAACDecStruct* hDecoder, bitfile *ld, uint8_t channel, uint8_t *tag) { uint8_t retval = 0; @@ -631,7 +630,7 @@ } /* Table 4.4.5 */ -static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, +static uint8_t channel_pair_element(NeAACDecStruct* hDecoder, bitfile *ld, uint8_t channels, uint8_t *tag) { ALIGN int16_t spec_data1[1024] = {0}; @@ -761,7 +760,7 @@ } /* Table 4.4.6 */ -static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, +static uint8_t ics_info(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld, uint8_t common_window) { uint8_t retval = 0; @@ -912,7 +911,7 @@ #ifdef COUPLING_DEC /* Table 4.4.8: Currently just for skipping the bits... */ -static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld) +static uint8_t coupling_channel_element(NeAACDecStruct* hDecoder, bitfile *ld) { uint8_t c, result = 0; uint8_t ind_sw_cce_flag = 0; @@ -1005,7 +1004,7 @@ #endif /* Table 4.4.10 */ -static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld) +static uint16_t data_stream_element(NeAACDecStruct* hDecoder, bitfile *ld) { uint8_t byte_aligned; uint16_t i, count; @@ -1034,7 +1033,7 @@ } /* Table 4.4.11 */ -static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc +static uint8_t fill_element(NeAACDecStruct* hDecoder, bitfile *ld, drc_info *drc #ifdef SBR_DEC ,uint8_t sbr_ele #endif @@ -1213,7 +1212,7 @@ #ifdef DRM /* Table 4.4.13 ASME */ -void DRM_aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, +void DRM_aac_scalable_main_element(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc) { uint8_t retval = 0; @@ -1423,7 +1422,7 @@ } /* Table 4.4.15 */ -static int8_t DRM_aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, +static int8_t DRM_aac_scalable_main_header(NeAACDecStruct* hDecoder, ic_stream *ics1, ic_stream *ics2, bitfile *ld, uint8_t this_layer_stereo) { uint8_t retval = 0; @@ -1491,7 +1490,7 @@ } #endif -static uint8_t side_info(NeAACDecHandle hDecoder, element *ele, +static uint8_t side_info(NeAACDecStruct* hDecoder, element *ele, bitfile *ld, ic_stream *ics, uint8_t scal_flag) { uint8_t result; @@ -1584,7 +1583,7 @@ } /* Table 4.4.24 */ -static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele, +static uint8_t individual_channel_stream(NeAACDecStruct* hDecoder, element *ele, bitfile *ld, ic_stream *ics, uint8_t scal_flag, int16_t *spec_data) { @@ -1644,7 +1643,7 @@ } /* Table 4.4.25 */ -static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld) +static uint8_t section_data(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld) { uint8_t g; uint8_t sect_esc_val, sect_bits; @@ -1891,7 +1890,7 @@ } /* Table 4.4.26 */ -static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld) +static uint8_t scale_factor_data(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld) { uint8_t ret = 0; #ifdef PROFILE @@ -1999,7 +1998,7 @@ #ifdef LTP_DEC /* Table 4.4.28 */ -static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld) +static uint8_t ltp_data(NeAACDecStruct* hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld) { uint8_t sfb, w; @@ -2062,7 +2061,7 @@ #endif /* Table 4.4.29 */ -static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, +static uint8_t spectral_data(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld, int16_t *spectral_data) { int8_t i; diff -urNad faad2-svn~/libfaad/syntax.h faad2-svn/libfaad/syntax.h --- faad2-svn~/libfaad/syntax.h 2007-11-28 23:28:14.000000000 +0000 +++ faad2-svn/libfaad/syntax.h 2007-11-28 23:29:27.000000000 +0000 @@ -35,7 +35,6 @@ extern "C" { #endif -#include "decoder.h" #include "bits.h" #define MAIN 1 @@ -113,12 +112,12 @@ uint8_t adts_frame(adts_header *adts, bitfile *ld); void get_adif_header(adif_header *adif, bitfile *ld); -void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, +void raw_data_block(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc); -uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, +uint8_t reordered_spectral_data(NeAACDecStruct* hDecoder, ic_stream *ics, bitfile *ld, int16_t *spectral_data); #ifdef DRM -void DRM_aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, +void DRM_aac_scalable_main_element(NeAACDecStruct* hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc); #endif