shithub: aacdec

Download patch

ref: c71144243747dd599cb9ff73fb70219adae968cb
parent: 32b2bf15a4e7bfe62338ce800a1e288cdeba9cca
author: menno <menno>
date: Tue Jan 15 14:55:09 EST 2002

Fix for strange sample rate from MP4 files (sometimes it's an index and sometimes it's the actual value)

--- a/frontend/main.c
+++ b/frontend/main.c
@@ -1,22 +1,22 @@
 /*
 ** FAAD - Freeware Advanced Audio Decoder
 ** Copyright (C) 2002 M. Bakker
-**  
+**
 ** 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 
+** 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.5 2002/01/15 13:51:42 menno Exp $
+** $Id: main.c,v 1.6 2002/01/15 19:55:09 menno Exp $
 **/
 
 #ifdef _WIN32
@@ -377,7 +377,7 @@
     /* Set the default object type and samplerate */
     /* This is useful for RAW AAC files */
     config = faacDecGetCurrentConfiguration(hDecoder);
-    config->defSampleRate = srates[srate];
+    config->defSampleRate = (srate > 10)?srate:srates[srate];
     if (use_ltp)
         config->defObjectType = LTP;
     config->outputFormat = outputFormat;
@@ -433,11 +433,11 @@
         {
             if(!to_stdout)
             {
-                aufile = open_audio_file(sndfile, srates[srate], frameInfo.channels,
+                aufile = open_audio_file(sndfile, (srate > 10)?srate:srates[srate], frameInfo.channels,
                     outputFormat, fileType);
             } else {
                 setmode(fileno(stdout), O_BINARY);
-                aufile = open_audio_file("-", srates[srate], frameInfo.channels,
+                aufile = open_audio_file("-", (srate > 10)?srate:srates[srate], frameInfo.channels,
                     outputFormat, fileType);
             }
             if (aufile == NULL)