shithub: aacdec

Download patch

ref: 580f32e643ef52c2e7603fee6064917d332df61b
parent: 5ecb2ee2de967a861a3e0bfb2e2a3990fde08d53
author: menno <menno>
date: Tue Jan 6 06:59:48 EST 2004

Allowed config option for library for smart frontends that can handle a samplerate change after decoding first frame
Also known as: no more upsampling on implicit SBR files (if frontend supports it)

--- a/common/mp4ff/mp4atom.c
+++ b/common/mp4ff/mp4atom.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4atom.c,v 1.13 2004/01/05 14:05:11 menno Exp $
+** $Id: mp4atom.c,v 1.14 2004/01/06 11:59:47 menno Exp $
 **/
 
 #include <stdlib.h>
@@ -154,6 +154,8 @@
         return ATOM_DISC;
     else if (mp4ff_atom_compare(a,b,c,d, 'g','n','r','e'))
         return ATOM_GENRE2;
+    else if (mp4ff_atom_compare(a,b,c,d, 'c','o','v','r'))
+		return ATOM_COVER;
     else if (mp4ff_atom_compare(a,b,c,d, 'c','p','i','l'))
         return ATOM_COMPILATION;
     else if (mp4ff_atom_compare(a,b,c,d, 'c','t','t','s'))
--- a/common/mp4ff/mp4ff.h
+++ b/common/mp4ff/mp4ff.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4ff.h,v 1.16 2004/01/05 14:05:11 menno Exp $
+** $Id: mp4ff.h,v 1.19 2004/01/11 15:52:18 menno Exp $
 **/
 
 #ifndef MP4FF_H
@@ -99,7 +99,7 @@
 int mp4ff_meta_get_disc(const mp4ff_t *f, char **value);
 int mp4ff_meta_get_compilation(const mp4ff_t *f, char **value);
 int mp4ff_meta_get_tempo(const mp4ff_t *f, char **value);
-
+int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value);
 #ifdef USE_TAGGING
 
 /* metadata tag structure */
--- a/common/mp4ff/mp4ffint.h
+++ b/common/mp4ff/mp4ffint.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4ffint.h,v 1.10 2004/01/05 14:05:11 menno Exp $
+** $Id: mp4ffint.h,v 1.11 2004/01/06 11:59:47 menno Exp $
 **/
 
 #ifndef MP4FF_INTERNAL_H
@@ -95,6 +95,7 @@
 #define ATOM_COMPILATION 19
 #define ATOM_GENRE2 20
 #define ATOM_TEMPO 21
+#define ATOM_COVER 22
 
 #ifdef HAVE_CONFIG_H
 #include "../../config.h"
@@ -275,6 +276,7 @@
 int32_t mp4ff_meta_get_disc(const mp4ff_t *f, char **value);
 int32_t mp4ff_meta_get_compilation(const mp4ff_t *f, char **value);
 int32_t mp4ff_meta_get_tempo(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value);
 #endif
 
 /* mp4ff.c */
--- a/common/mp4ff/mp4meta.c
+++ b/common/mp4ff/mp4meta.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4meta.c,v 1.10 2004/01/05 14:05:11 menno Exp $
+** $Id: mp4meta.c,v 1.13 2004/01/11 15:52:18 menno Exp $
 **/
 
 #ifdef USE_TAGGING
@@ -163,7 +163,7 @@
     static char *tag_names[] = {
         "unknown", "title", "artist", "writer", "album",
         "date", "tool", "comment", "genre", "track",
-        "disc", "compilation", "genre", "tempo"
+        "disc", "compilation", "genre", "tempo", "cover"
     };
     uint8_t tag_idx = 0;
 
@@ -182,6 +182,7 @@
     case ATOM_COMPILATION: tag_idx = 11; break;
     case ATOM_GENRE2: tag_idx = 12; break;
     case ATOM_TEMPO: tag_idx = 13; break;
+    case ATOM_COVER: tag_idx = 14; break;
     default: tag_idx = 0; break;
     }
 
@@ -403,6 +404,11 @@
 int32_t mp4ff_meta_get_tempo(const mp4ff_t *f, char **value)
 {
     return mp4ff_meta_find_by_name(f, "tempo", value);
+}
+
+int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value)
+{
+    return mp4ff_meta_find_by_name(f, "cover", value);
 }
 
 #endif
\ No newline at end of file
--- a/common/mp4ff/mp4tagupdate.c
+++ b/common/mp4ff/mp4tagupdate.c
@@ -224,6 +224,7 @@
 //	{"trkn","track"},
 //	{"disk","disc"},
 //	{"gnre","genre"},
+	{"covr","cover"},
 };
 
 
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: main.c,v 1.69 2004/01/05 14:05:11 menno Exp $
+** $Id: main.c,v 1.70 2004/01/06 11:59:47 menno Exp $
 **/
 
 #ifdef _WIN32
@@ -464,6 +464,7 @@
     config->outputFormat = outputFormat;
     config->downMatrix = downMatrix;
     config->useOldADTSFormat = old_format;
+    config->dontUpSampleImplicitSBR = 1;
     faacDecSetConfiguration(hDecoder, config);
 
     /* get AAC infos for printing */
@@ -735,6 +736,7 @@
     config = faacDecGetCurrentConfiguration(hDecoder);
     config->outputFormat = outputFormat;
     config->downMatrix = downMatrix;
+    config->dontUpSampleImplicitSBR = 1;
     faacDecSetConfiguration(hDecoder, config);
 
     if (adts_out)
@@ -804,7 +806,7 @@
         long samples = mp4ff_num_samples(infile, track);
         float f = 1024.0;
         float seconds;
-        if ((mp4ASC.sbr_present_flag == 1) || mp4ASC.forceUpSampling)
+        if (mp4ASC.sbr_present_flag == 1)
         {
             f = f * 2.0;
         }
--- a/include/faad.h
+++ b/include/faad.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: faad.h,v 1.37 2004/01/05 14:05:11 menno Exp $
+** $Id: faad.h,v 1.38 2004/01/06 11:59:48 menno Exp $
 **/
 
 #ifndef __AACDEC_H__
@@ -138,6 +138,7 @@
     unsigned char outputFormat;
     unsigned char downMatrix;
     unsigned char useOldADTSFormat;
+    unsigned char dontUpSampleImplicitSBR;
 } faacDecConfiguration, *faacDecConfigurationPtr;
 
 typedef struct faacDecFrameInfo
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: decoder.c,v 1.84 2004/01/05 14:05:11 menno Exp $
+** $Id: decoder.c,v 1.85 2004/01/06 11:59:48 menno Exp $
 **/
 
 #include "common.h"
@@ -256,7 +256,7 @@
 
 #ifdef SBR_DEC
     /* implicit signalling */
-    if (*samplerate <= 24000)
+    if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR))
     {
         *samplerate *= 2;
         hDecoder->forceUpSampling = 1;
@@ -324,7 +324,10 @@
 #endif
 #ifdef SBR_DEC
     hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag;
-    hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
+    if (hDecoder->config.dontUpSampleImplicitSBR == 0)
+        hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
+    else
+        hDecoder->forceUpSampling = 0;
 
     /* AAC core decoder samplerate is 2 times as low */
     if (hDecoder->sbr_present_flag == 1 || hDecoder->forceUpSampling == 1)
--- a/libfaad/structs.h
+++ b/libfaad/structs.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: structs.h,v 1.24 2004/01/05 14:05:12 menno Exp $
+** $Id: structs.h,v 1.25 2004/01/06 11:59:48 menno Exp $
 **/
 
 #ifndef __STRUCTS_H__
@@ -333,6 +333,7 @@
     uint8_t outputFormat;
     uint8_t downMatrix;
     uint8_t useOldADTSFormat;
+    uint8_t dontUpSampleImplicitSBR;
 } faacDecConfiguration, *faacDecConfigurationPtr;
 
 typedef struct faacDecFrameInfo