shithub: aacdec

Download patch

ref: 9a71d064d3f3d40c5f855b0ed40f27f8dd4cb0d0
parent: 96eeea189ca734359c7707ecb942771e3ec95138
author: menno <menno>
date: Mon Sep 22 13:55:09 EDT 2008

Smaller fixes for compilation issues and ARM

--- a/common/mp4ff/mp4ff_int_types.h
+++ b/common/mp4ff/mp4ff_int_types.h
@@ -7,7 +7,7 @@
 #include <stdlib.h>
 #endif /* #ifdef __MINGW32__ */
 
-typedef char int8_t;
+typedef signed char int8_t;
 typedef unsigned char uint8_t;
 typedef short int16_t;
 typedef unsigned short uint16_t;
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -25,7 +25,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: main.c,v 1.84 2008/09/19 23:31:39 menno Exp $
+** $Id: main.c,v 1.85 2008/09/22 17:55:09 menno Exp $
 **/
 
 #ifdef _WIN32
@@ -58,7 +58,7 @@
 
 static int quiet = 0;
 
-void faad_fprintf(FILE *stream, const char *fmt, ...)
+static void faad_fprintf(FILE *stream, const char *fmt, ...)
 {
     va_list ap;
 
@@ -83,7 +83,7 @@
 } aac_buffer;
 
 
-int fill_buffer(aac_buffer *b)
+static int fill_buffer(aac_buffer *b)
 {
     int bread;
 
@@ -128,7 +128,7 @@
     return 1;
 }
 
-void advance_buffer(aac_buffer *b, int bytes)
+static void advance_buffer(aac_buffer *b, int bytes)
 {
     b->file_offset += bytes;
     b->bytes_consumed = bytes;
@@ -139,7 +139,7 @@
 
 static int adts_sample_rates[] = {96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350,0,0,0};
 
-int adts_parse(aac_buffer *b, int *bitrate, float *length)
+static int adts_parse(aac_buffer *b, int *bitrate, float *length)
 {
     int frames, frame_length;
     int t_framelength = 0;
@@ -221,7 +221,7 @@
 #define SPEAKER_TOP_BACK_RIGHT         0x20000
 #define SPEAKER_RESERVED               0x80000000
 
-long aacChannelConfig2wavexChannelMask(NeAACDecFrameInfo *hInfo)
+static long aacChannelConfig2wavexChannelMask(NeAACDecFrameInfo *hInfo)
 {
     if (hInfo->channels == 6 && hInfo->num_lfe_channels)
     {
@@ -233,7 +233,7 @@
     }
 }
 
-char *position2string(int position)
+static char *position2string(int position)
 {
     switch (position)
     {
@@ -253,7 +253,7 @@
     return "";
 }
 
-void print_channel_info(NeAACDecFrameInfo *frameInfo)
+static void print_channel_info(NeAACDecFrameInfo *frameInfo)
 {
     /* print some channel info */
     int i;
@@ -285,7 +285,7 @@
     faad_fprintf(stderr, "\n");
 }
 
-int FindAdtsSRIndex(int sr)
+static int FindAdtsSRIndex(int sr)
 {
     int i;
 
@@ -297,7 +297,7 @@
     return 16 - 1;
 }
 
-unsigned char *MakeAdtsHeader(int *dataSize, NeAACDecFrameInfo *hInfo, int old_format)
+static unsigned char *MakeAdtsHeader(int *dataSize, NeAACDecFrameInfo *hInfo, int old_format)
 {
     unsigned char *data;
     int profile = (hInfo->object_type - 1) & 0x3;
@@ -347,7 +347,7 @@
 /* globals */
 char *progName;
 
-char *file_ext[] =
+static const char *file_ext[] =
 {
     NULL,
     ".wav",
@@ -358,7 +358,7 @@
     NULL
 };
 
-void usage(void)
+static void usage(void)
 {
     faad_fprintf(stdout, "\nUsage:\n");
     faad_fprintf(stdout, "%s [options] infile.aac\n", progName);
@@ -396,7 +396,7 @@
     return;
 }
 
-int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_stdout,
+static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_stdout,
                   int def_srate, int object_type, int outputFormat, int fileType,
                   int downMatrix, int infoOnly, int adts_out, int old_format,
                   float *song_length)
@@ -673,7 +673,7 @@
     return frameInfo.error;
 }
 
-int GetAACTrack(mp4ff_t *infile)
+static int GetAACTrack(mp4ff_t *infile)
 {
     /* find AAC track */
     int i, rc;
@@ -702,13 +702,13 @@
     return -1;
 }
 
-unsigned long srates[] =
+static const unsigned long srates[] =
 {
     96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000,
     12000, 11025, 8000
 };
 
-int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_stdout,
+static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_stdout,
                   int outputFormat, int fileType, int downMatrix, int noGapless,
                   int infoOnly, int adts_out, float *song_length)
 {
--- a/libfaad/common.h
+++ b/libfaad/common.h
@@ -25,7 +25,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: common.h,v 1.73 2008/03/23 23:03:28 menno Exp $
+** $Id: common.h,v 1.74 2008/09/22 17:55:09 menno Exp $
 **/
 
 #ifndef __COMMON_H__
@@ -222,9 +222,9 @@
 typedef unsigned long uint32_t;
 typedef unsigned short uint16_t;
 typedef unsigned char uint8_t;
-typedef long int32_t;
-typedef short int16_t;
-typedef char int8_t;
+typedef signed long int32_t;
+typedef signed short int16_t;
+typedef signed char int8_t;
 # endif
 #endif
 #if HAVE_UNISTD_H
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -25,7 +25,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: decoder.c,v 1.114 2008/04/06 00:34:30 menno Exp $
+** $Id: decoder.c,v 1.115 2008/09/22 17:55:09 menno Exp $
 **/
 
 #include "common.h"
@@ -329,11 +329,11 @@
 
 #ifdef SBR_DEC
     /* implicit signalling */
-    if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR))
+    if (*samplerate <= 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0))
     {
         *samplerate *= 2;
         hDecoder->forceUpSampling = 1;
-    } else if (*samplerate > 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) {
+    } else if (*samplerate > 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0)) {
         hDecoder->downSampledSBR = 1;
     }
 #endif
--- a/libfaad/ps_dec.c
+++ b/libfaad/ps_dec.c
@@ -25,7 +25,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: ps_dec.c,v 1.14 2007/11/01 12:33:33 menno Exp $
+** $Id: ps_dec.c,v 1.15 2008/09/22 17:55:09 menno Exp $
 **/
 
 #include "common.h"
@@ -233,6 +233,8 @@
 {
     uint8_t i;
 
+	if (!hyb) return;
+
     if (hyb->work)
         faad_free(hyb->work);
 
@@ -251,6 +253,8 @@
     }
     if (hyb->temp)
         faad_free(hyb->temp);
+
+	faad_free(hyb);
 }
 
 /* real filter, size 2 */
--- a/libfaad/structs.h
+++ b/libfaad/structs.h
@@ -25,7 +25,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: structs.h,v 1.47 2008/03/23 23:03:29 menno Exp $
+** $Id: structs.h,v 1.48 2008/09/22 17:55:09 menno Exp $
 **/
 
 #ifndef __STRUCTS_H__
@@ -330,9 +330,9 @@
     /*uint8_t*/ unsigned char aacSpectralDataResilienceFlag;
     /*uint8_t*/ unsigned char epConfig;
 
-    /*uint8_t*/ char sbr_present_flag;
-    /*uint8_t*/ char forceUpSampling;
-    /*uint8_t*/ char downSampledSBR;
+    /*uint8_t*/ signed char sbr_present_flag;
+    /*uint8_t*/ signed char forceUpSampling;
+    /*uint8_t*/ signed char downSampledSBR;
 } mp4AudioSpecificConfig;
 
 #define MAX_ASC_BYTES 64