shithub: aacdec

Download patch

ref: 047e5aa00c4b30a0c320a1abe1b3ddaa34a51c70
parent: 9c1ab867b5933d0d87412f814957e01771ddbae1
author: ca5e <ca5e>
date: Tue Sep 23 12:55:00 EDT 2003

Uses new frameinfo structure to get more accurate tech info for raw AACs

--- a/plugins/foo_mp4/foo_mp4.cpp
+++ b/plugins/foo_mp4/foo_mp4.cpp
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: foo_mp4.cpp,v 1.59 2003/09/20 11:11:19 ca5e Exp $
+** $Id: foo_mp4.cpp,v 1.60 2003/09/23 16:55:00 ca5e Exp $
 **/
 
 #include <mp4.h>
@@ -47,9 +47,50 @@
 #endif
 
 DECLARE_COMPONENT_VERSION ("MPEG-4 AAC decoder",
-                           "1.58",
+                           "1.59",
                            "Based on FAAD2 v" FAAD2_VERSION "\nCopyright (C) 2002-2003 http://www.audiocoding.com" );
 
+static const char *object_type_string(int type)
+{
+    static const char *types[31] = {
+        "AAC Main",
+        "AAC LC",
+        "AAC SSR",
+        "AAC LTP",
+        "AAC HE",
+        "AAC Scalable",
+        "TwinVQ",
+        "CELP",
+        "HVXC",
+        "Reserved",
+        "Reserved",
+        "TTSI",
+        "Main synthetic",
+        "Wavetable synthesis",
+        "General MIDI",
+        "Algorithmic Synthesis and Audio FX",
+        "ER AAC LC",
+        "Reserved",
+        "ER AAC LTP",
+        "ER AAC scalable",
+        "ER TwinVQ",
+        "ER BSAC",
+        "ER AAC LD",
+        "ER CELP",
+        "ER HVXC",
+        "ER HILN",
+        "ER Parametric",
+        "Reserved",
+        "Reserved",
+        "Reserved",
+        "Reserved",
+    };
+
+    if (type<1 || type>31) return NULL;
+
+    return types[type-1];
+}
+
 class input_mp4 : public input
 {
 public:
@@ -141,6 +182,11 @@
             track, "mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.avgBitrate") + 0.5));
         info->info_set_int("channels", (__int64)channels);
         info->info_set_int("samplerate", (__int64)samplerate);
+
+        const char *profile_str = object_type_string(mp4ASC.objectTypeIndex);
+        if (profile_str)
+            info->info_set("aac_profile", profile_str);
+
         if (mp4ASC.sbr_present_flag == 1) {
             info->info_set("codec", "AAC+SBR");
             m_framesize *= 2;
@@ -607,6 +653,9 @@
         __int64 bitrate = 128;
         unsigned char channels = 0;
         unsigned long samplerate = 0;
+        int sbr = 0;
+        int header_type = 0;
+        int profile = 0;
 
         m_reader = r;
         tagsize = (int)id3v2_calc_size(m_reader);
@@ -658,9 +707,6 @@
                     memset(&frameInfo, 0, sizeof(faacDecFrameInfo));
                     fill_buffer();
                     faacDecDecode(hDecoder, &frameInfo, m_aac_buffer, m_aac_bytes_into_buffer);
-
-                    m_samplerate = frameInfo.samplerate;
-                    m_framesize = (frameInfo.channels != 0) ? frameInfo.samples/frameInfo.channels : 0;
                 } while (!frameInfo.samples && !frameInfo.error);
 
                 if (frameInfo.error)
@@ -669,6 +715,12 @@
                     return 0;
                 }
 
+                m_samplerate = frameInfo.samplerate;
+                m_framesize = (frameInfo.channels != 0) ? frameInfo.samples/frameInfo.channels : 0;
+                sbr = frameInfo.sbr;
+                profile = frameInfo.object_type;
+                header_type = frameInfo.header_type;
+
                 faacDecClose(hDecoder);
                 m_reader->seek(tagsize);
             }
@@ -734,20 +786,30 @@
         m_length = length;
 
         if (flags & OPEN_FLAG_GET_INFO) {
+            const char *profile_str = object_type_string(profile);
+            const char *header_str = NULL;
+
             info->info_set_int("bitrate", bitrate);
             info->info_set_int("channels", (__int64)channels);
             info->info_set_int("samplerate", (__int64)m_samplerate);
 
-            if (m_framesize > 1024) //if (m_samplerate != samplerate)
+            if (profile_str)
+                info->info_set("aac_profile", profile_str);
+
+            if (header_type == RAW)
+                header_str = "RAW";
+            else if (header_type == ADIF)
+                header_str = "ADIF";
+            else if (header_type == ADTS)
+                header_str = "ADTS";
+
+            if (header_str)
+                info->info_set("aac_header_type", header_str);
+
+            if (sbr)
                 info->info_set("codec", "AAC+SBR");
             else
                 info->info_set("codec", "AAC");
-            if (m_header_type == 0)
-                info->info_set("stream type", "RAW");
-            else if (m_header_type == 1)
-                info->info_set("stream type", "ADTS");
-            else if (m_header_type == 2)
-                info->info_set("stream type", "ADIF");
         }
 
         tag_reader::g_run_multi(m_reader, info, "ape|id3v2|lyrics3|id3v1");
--- a/plugins/foo_mp4/foo_mp4.dsp
+++ b/plugins/foo_mp4/foo_mp4.dsp
@@ -100,107 +100,15 @@
 # PROP Default_Filter "h;hpp;hxx;hm;inl"
 # Begin Source File
 
-SOURCE=.\foobar2000\SDK\audio_chunk.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\..\..\Program Files\DXSDK\include\basetsd.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\cfg_memblock.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\cfg_var.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\component.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\componentversion.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\console.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\critsec.h
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\include\faad.h
 # End Source File
 # Begin Source File
 
-SOURCE=.\foobar2000\SDK\file_info.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\foobar2000.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\grow_buf.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\input.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\interface_helper.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\mem_block.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\mem_block_mgr.h
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\common\mp4v2\mp4.h
 # End Source File
 # Begin Source File
 
 SOURCE=..\..\common\mp4v2\mpeg4ip.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\pfc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\playlist_entry.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\profiler.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\ptr_list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\reader.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\reader_helper.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\SDK\service.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pfc\string_unicode.h
 # End Source File
 # Begin Source File