shithub: aacdec

Download patch

ref: 0e2d830404f2fa71f63d6a133ce2d1d01dd2629a
parent: 130c46862751338fdb7085f738496aed60fef5a8
author: menno <menno>
date: Tue Feb 25 13:15:59 EST 2003

Fixed Winamp3 plugin compilation

--- a/common/faad/aacinfo.h
+++ b/common/faad/aacinfo.h
@@ -16,9 +16,12 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: aacinfo.h,v 1.1 2002/01/14 19:15:49 menno Exp $
+** $Id: aacinfo.h,v 1.2 2003/02/25 18:15:52 menno Exp $
 **/
 
+#ifndef AACINFO_H__
+#define AACINFO_H__
+
 #include "filestream.h"
 
 typedef struct {
@@ -39,4 +42,6 @@
 static int read_ADTS_header(FILE_STREAM *file, faadAACInfo *info,
                             unsigned long **seek_table, int *seek_table_len,
                             int tagsize, int no_seek_table);
-int StringComp(char const *str1, char const *str2, unsigned long len);
\ No newline at end of file
+int StringComp(char const *str1, char const *str2, unsigned long len);
+
+#endif
--- a/plugins/winamp3/FAAD.cpp
+++ b/plugins/winamp3/FAAD.cpp
@@ -19,20 +19,22 @@
 kreel@tiscali.it
 */
 
+#include "SDK/bfc/std.h"
+#include "SDK/bfc/memblock.h"
+#include "SDK/bfc/timerclient.h"
+
 #include <windows.h>
 #include <stdio.h>
 #include <process.h>
 #include "resource.h"
-//#include "FAAD.h"
 #include <faad.h>
+#include "faadwa3.h"
 #include "..\..\..\faac\include\faac.h"
-//#include "..\..\include\faad.h"
-/*#include <faad.h>
 extern "C" {
 #include <aacinfo.h>	// get_AAC_format()
 }
+
 #include <mp4.h>
-*/
 #include "cnv_FAAD.h"
 #include "CRegistry.h"
 #include "Defines.h"
@@ -130,7 +132,7 @@
         {
         unsigned char *buff = NULL;
         unsigned __int32 buff_size = 0;
-        mp4AudioSpecific mp4ASC;
+        mp4AudioSpecificConfig mp4ASC;
 
 			MP4GetTrackESConfiguration(infile, trackId, (unsigned __int8 **)&buff, &buff_size);
 
@@ -219,7 +221,7 @@
 	unsigned __int32	buffer_size;
 	DWORD				timeScale;
 	BYTE				sf;
-    mp4AudioSpecificInfo mp4ASC;
+    mp4AudioSpecificConfig mp4ASC;
 
 		if(!(mp4File=MP4Read(infos->getFilename(), 0)))
 			ERROR_getInfos("Error opening file");
--- a/plugins/winamp3/aacInfoLib.dsp
+++ b/plugins/winamp3/aacInfoLib.dsp
@@ -66,7 +66,7 @@
 # PROP Target_Dir ""
 MTL=midl.exe
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../faad2/common/faad" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../faad2/common/faad" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
 # ADD BASE RSC /l 0x410 /d "_DEBUG"
 # ADD RSC /l 0x410 /d "_DEBUG"
 BSC32=bscmake.exe
--- a/plugins/winamp3/cnv_FAAD.cpp
+++ b/plugins/winamp3/cnv_FAAD.cpp
@@ -19,6 +19,10 @@
 kreel@tiscali.it
 */
 
+#include "SDK/bfc/std.h"
+#include "SDK/bfc/memblock.h"
+#include "SDK/bfc/timerclient.h"
+
 #include <stdlib.h>
 #include "..\..\..\faac\include\faac.h"
 #include "cnv_FAAD.h"
@@ -25,6 +29,7 @@
 #include <faad.h>
 #include "CRegistry.h"
 #include "Defines.h"
+#include "faadwa3.h"
 
 // *********************************************************************************************
 
--- a/plugins/winamp3/cnv_FAAD.dsp
+++ b/plugins/winamp3/cnv_FAAD.dsp
@@ -69,7 +69,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CNV_FAAD_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../faad2/common/faad" /I "../../include" /I "../../../faad2/common/mp4v2" /I "SDK" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CNV_FAAD_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../faad2/common/faad" /I "../../include" /I "../../../faad2/common/mp4v2" /I "SDK" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CNV_FAAD_EXPORTS" /YX /FD /GZ /c
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x410 /d "_DEBUG"
--- /dev/null
+++ b/plugins/winamp3/faadwa3.h
@@ -1,0 +1,116 @@
+/*
+cnv_FAAD - MP4-AAC decoder plugin for Winamp3
+Copyright (C) 2002 Antonio Foranna
+
+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.
+
+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
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+The author can be contacted at:
+kreel@tiscali.it
+*/
+
+#ifndef _AACPCM_H
+#define _AACPCM_H
+
+#include <studio/services/svc_mediaconverter.h>
+#include <studio/services/servicei.h>
+#include <studio/corecb.h>
+#include <studio/wac.h>
+#include <attribs/cfgitemi.h>
+#include <attribs/attrint.h>
+#include <faad.h>
+extern "C" {
+#include <aacinfo.h>    // get_AAC_format()
+}
+#include <mp4.h>
+#include "Defines.h"
+
+
+
+// -----------------------------------------------------------------------------------------------
+
+
+
+class AacPcm : public svc_mediaConverterI
+{
+public:
+    AacPcm();
+    virtual ~AacPcm();
+
+    // service
+    static const char *getServiceName() { return FILES_SUPPORT " to PCM converter"; }
+
+    virtual int canConvertFrom(svc_fileReader *reader, const char *name, const char *chunktype) {
+        if(name && (!STRICMP(Std::extension(name),"aac")|| !STRICMP(Std::extension(name),"mp4"))) return 1; // only accepts *.aac and *.mp4 files
+        return 0;
+    }
+    virtual const char *getConverterTo() { return "PCM"; }
+
+    virtual int getInfos(MediaInfo *infos);
+
+    virtual int processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswitch);
+
+    virtual int getLatency(void) { return 0; }
+
+    // callbacks
+
+    virtual int corecb_onSeeked(int newpos)
+    {
+/*      if(!IsSeekable)
+        {
+            newpos_ms=-1;
+            return 0;
+        }*/
+        newpos_ms=newpos;
+        return 0;
+    }
+
+// Raw AAC
+    BOOL            FindBitrate;
+
+private:
+
+//MP4
+    MP4FileHandle   mp4File;
+    MP4SampleId     sampleId,
+                    numSamples;
+    int             track;
+    BYTE            type;
+
+// AAC
+    FILE            *aacFile;
+    DWORD           Samplerate;
+    BYTE            Channels;
+    DWORD           bps;
+    DWORD           src_size; // aac filesize
+    BYTE            *buffer;
+    long            tagsize;
+    DWORD           *seek_table;
+    int             seek_table_length;
+    bool            BlockSeeking;
+
+// GLOBAL
+    faacDecHandle   hDecoder;
+    faadAACInfo     file_info;
+    faacDecFrameInfo    frameInfo;
+    DWORD           len_ms;         // length of file in milliseconds
+    DWORD           bytes_read;     // from file
+    DWORD           bytes_consumed; // by faadDecDecode
+    long            bytes_into_buffer;
+//  DWORD           dst_size;
+    long            newpos_ms;
+    BOOL            IsSeekable;
+    bool            IsAAC;
+};
+#endif
+