ref: 36ac51109224df99ad0e96609d37d126864f51ff
parent: 233ca4b6e61450f6acddd4ba0a3fae5d93b2ee7b
author: menno <menno>
date: Mon Jan 21 15:38:34 EST 2002
Winamp3 plugin added
--- /dev/null
+++ b/plugins/winamp3/aacpcm.cpp
@@ -1,0 +1,111 @@
+/*
+** 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
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** $Id: aacpcm.cpp,v 1.1 2002/01/21 20:38:34 menno Exp $
+**/
+
+#include <stdio.h>
+#include "aacpcm.h"
+
+AacPcm::AacPcm()
+{
+ hDecoder = faacDecOpen();
+ buffercount = 0;
+ bytecount = 0;
+ init_called = 0;
+
+ samplerate = 44100;
+ bps = 16;
+ nch = 2;
+}
+
+AacPcm::~AacPcm()
+{
+ faacDecClose(hDecoder);
+}
+
+int AacPcm::getInfos(MediaInfo *infos)
+{
+ infos->setTitle(Std::filename(infos->getFilename()));
+ infos->setInfo(StringPrintf("%ihz %ibps %dch", samplerate, bps, nch));
+
+ return 0;
+}
+
+int AacPcm::processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswitch)
+{
+ unsigned long sr, ch;
+ short *samplebuffer;
+ faacDecFrameInfo frameInfo;
+ int k, last_frame = 0;
+
+ svc_fileReader *reader = infos->getReader();
+ if (!reader)
+ return 0;
+
+ int eof = 0;
+
+ // I assume that it lets me read from the beginning of the file here
+ if (!init_called)
+ {
+ buffercount = 0;
+ reader->read(buffer, 768*2);
+ bytecount += 768*2;
+
+ buffercount = faacDecInit(hDecoder, buffer, &sr, &ch);
+ samplerate = sr;
+ nch = ch;
+
+ init_called = 1;
+ }
+
+ if (buffercount > 0)
+ {
+ bytecount += buffercount;
+
+ for (k = 0; k < (768*2 - buffercount); k++)
+ buffer[k] = buffer[k + buffercount];
+
+ reader->read(buffer + (768*2) - buffercount, buffercount);
+ buffercount = 0;
+ }
+
+ samplebuffer = faacDecDecode(hDecoder, &frameInfo, buffer);
+ if (frameInfo.error)
+ {
+ last_frame = 1;
+ }
+
+ buffercount += frameInfo.bytesconsumed;
+ bytecount += frameInfo.bytesconsumed;
+
+ if (bytecount >= 2*reader->getLength())
+ last_frame = 1;
+
+
+ ChunkInfosI *ci = new ChunkInfosI();
+ ci->addInfo("srate", samplerate);
+ ci->addInfo("bps", bps);
+ ci->addInfo("nch", frameInfo.channels);
+
+ chunk_list->setChunk("PCM", samplebuffer, 2048*frameInfo.channels, ci);
+
+ if (last_frame)
+ return 0;
+ return 1;
+}
--- /dev/null
+++ b/plugins/winamp3/aacpcm.h
@@ -1,0 +1,66 @@
+/*
+** 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
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** $Id: aacpcm.h,v 1.1 2002/01/21 20:38:34 menno Exp $
+**/
+
+#ifndef _AACPCM_H
+#define _AACPCM_H
+
+#include <faad.h>
+#include "sdk/studio/services/svc_mediaconverter.h"
+#include "sdk/studio/services/servicei.h"
+#include "sdk/studio/corecb.h"
+#include "sdk/studio/wac.h"
+#include "sdk/attribs/cfgitemi.h"
+#include "sdk/attribs/attrint.h"
+
+class AacPcm : public svc_mediaConverterI
+{
+public:
+ AacPcm();
+ virtual ~AacPcm();
+
+ // service
+ static const char *getServiceName() { return "AAC to PCM converter"; }
+
+ virtual int canConvertFrom(svc_fileReader *reader, const char *name, const char *chunktype) {
+ if(name && !STRICMP(Std::extension(name),"aac")) return 1; // only accepts *.aac 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) { return 0; } // do nothing on seek
+
+private:
+ faacDecHandle hDecoder;
+
+ unsigned char buffer[768*2];
+ long buffercount, bytecount;
+ int init_called;
+
+ int samplerate, bps, nch;
+};
+#endif
--- /dev/null
+++ b/plugins/winamp3/cnv_aacpcm.cpp
@@ -1,0 +1,66 @@
+/*
+** 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
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** $Id: cnv_aacpcm.cpp,v 1.1 2002/01/21 20:38:34 menno Exp $
+**/
+
+#include "cnv_aacpcm.h"
+#include "aacpcm.h"
+
+static WACNAME wac;
+WAComponentClient *the = &wac;
+
+#include "sdk/studio/services/servicei.h"
+static waServiceT<svc_mediaConverter, AacPcm> aacpcm;
+
+// {3AF667AD-3CF8-459e-8C7C-BD8CD1D6F8C2}
+static const GUID guid =
+{ 0x3af667ad, 0x3cf8, 0x459e, { 0x8c, 0x7c, 0xbd, 0x8c, 0xd1, 0xd6, 0xf8, 0xc2 } };
+
+
+WACNAME::WACNAME() : CfgItemI("AAC files support")
+{
+#ifdef FORTIFY
+ FortifySetName("cnv_aacpcm.wac");
+ FortifyEnterScope();
+#endif
+}
+
+WACNAME::~WACNAME()
+{
+#ifdef FORTIFY
+ FortifyLeaveScope();
+#endif
+}
+
+GUID WACNAME::getGUID()
+{
+ return guid;
+}
+
+void WACNAME::onRegisterServices()
+{
+ api->service_register(&aacpcm);
+ api->core_registerExtension("*.aac", "AAC Files");
+}
+
+void WACNAME::onDestroy()
+{
+ api->service_deregister(&aacpcm);
+ WAComponentClient::onDestroy();
+}
--- /dev/null
+++ b/plugins/winamp3/cnv_aacpcm.dsp
@@ -1,0 +1,383 @@
+# Microsoft Developer Studio Project File - Name="cnv_aacpcm" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=cnv_aacpcm - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "cnv_aacpcm.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "cnv_aacpcm.mak" CFG="cnv_aacpcm - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "cnv_aacpcm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "cnv_aacpcm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=xicl6.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "cnv_aacpcm - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /G6 /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_MEAN_AND_LEAN" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x413 /d "NDEBUG"
+# ADD RSC /l 0x413 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/cnv_aacpcm.wac"
+
+!ELSEIF "$(CFG)" == "cnv_aacpcm - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
+# ADD CPP /nologo /G6 /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_MEAN_AND_LEAN" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x413 /d "_DEBUG"
+# ADD RSC /l 0x413 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/cnv_aacpcm.wac" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "cnv_aacpcm - Win32 Release"
+# Name "cnv_aacpcm - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Group "sdk source"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\sdk\studio\assert.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\attribs\attribute.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\attribs\attrint.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\bitmap.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\blending.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\canvas.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\attribs\cfgitemi.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\corecb.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\depend.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\nsGUID.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\pathparse.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\playstring.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\ptrlist.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\region.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\services\servicei.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\std.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\string.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\services\svc_mediaconverter.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\waclient.cpp
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\aacpcm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\cnv_aacpcm.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Group "sdk"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\sdk\studio\api.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\apihelp.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\attribs\attrcb.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\attribs\attribute.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\attribs\attrint.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\basewnd.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\bitmap.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\blending.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\canvas.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\attribs\cfgitem.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\attribs\cfgitemi.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\chunklist.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\common.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\compdb.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\corecb.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\depend.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\drag.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\fontdef.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\guid.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\map.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\mediainfo.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\multimap.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\named.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\nsGUID.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\pair.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\pathparse.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\platform\platform.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\playstring.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\ptrlist.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\region.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\rootcomp.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\rootwnd.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\scriptvar.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\services\service.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\services\servicei.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\services\services.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\stack.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\std.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\services\svc_fileread.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\services\svc_mediaconverter.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\tlist.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\vcputypes.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\common\virtualwnd.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sdk\studio\wac.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\aacpcm.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\cnv_aacpcm.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\faad.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
--- /dev/null
+++ b/plugins/winamp3/cnv_aacpcm.dsw
@@ -1,0 +1,44 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "cnv_aacpcm"=.\cnv_aacpcm.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libfaad
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "libfaad"=..\..\libfaad\libfaad.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
--- /dev/null
+++ b/plugins/winamp3/cnv_aacpcm.h
@@ -1,0 +1,49 @@
+/*
+** 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
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** $Id: cnv_aacpcm.h,v 1.1 2002/01/21 20:38:34 menno Exp $
+**/
+
+#ifndef _CNV_AACPCM_H
+#define _CNV_AACPCM_H
+
+#include "sdk/studio/wac.h"
+#include "sdk/common/rootcomp.h"
+#include "sdk/attribs/cfgitemi.h"
+#include "sdk/attribs/attrint.h"
+
+#define WACNAME WACcnv_aacpcm
+
+class WACNAME : public WAComponentClient, public CfgItemI
+{
+public:
+ WACNAME();
+ virtual ~WACNAME();
+
+ virtual const char *getName() { return "AAC to PCM converter"; };
+ virtual GUID getGUID();
+
+ virtual void onRegisterServices();
+ virtual void onDestroy();
+
+ virtual int getDisplayComponent() { return FALSE; };
+
+ virtual CfgItem *getCfgInterface(int n) { return this; }
+};
+
+#endif