shithub: aacdec

Download patch

ref: faa21c4ffe1778245a4d3f258baa8b368351d4a5
parent: ca0f0a41b215eb0bc74602dc0da151042f74c0fb
author: menno <menno>
date: Tue Jan 15 08:49:42 EST 2002

Bugfix for MP4 files

--- a/frontend/main.c
+++ b/frontend/main.c
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: main.c,v 1.3 2002/01/15 13:20:13 menno Exp $
+** $Id: main.c,v 1.4 2002/01/15 13:49:42 menno Exp $
 **/
 
 #ifdef _WIN32
@@ -324,6 +324,12 @@
     return -1;
 }
 
+unsigned long srates[] =
+{
+    96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000,
+    12000, 11025, 8000
+};
+
 int decodeMP4file(char *mp4file, char *sndfile, int to_stdout,
                   int outputFormat, int fileType)
 {
@@ -371,7 +377,7 @@
     /* Set the default object type and samplerate */
     /* This is useful for RAW AAC files */
     config = faacDecGetCurrentConfiguration(hDecoder);
-    config->defSampleRate = srate;
+    config->defSampleRate = srates[srate];
     if (use_ltp)
         config->defObjectType = LTP;
     config->outputFormat = outputFormat;
@@ -452,10 +458,7 @@
         {
             fprintf(stderr, "Error: %s\n",
                 faacDecGetErrorMessage(frameInfo.error));
-            faacDecClose(hDecoder);
-            MP4Close(infile);
-            close_audio_file(aufile);
-            return frameInfo.error;
+            break;
         }
     }