Revision: 9482 http://pure-data.svn.sourceforge.net/pure-data/?rev=9482&view=rev Author: eighthave Date: 2008-02-22 08:56:27 -0800 (Fri, 22 Feb 2008)
Log Message: ----------- importing lame-3.97.tar.gz
Added Paths: ----------- vendor/lame/ vendor/lame/current/ vendor/lame/current/ACM/ vendor/lame/current/ACM/ACM.cpp vendor/lame/current/ACM/ACM.h vendor/lame/current/ACM/ACMStream.cpp vendor/lame/current/ACM/ACMStream.h vendor/lame/current/ACM/ADbg/ vendor/lame/current/ACM/ADbg/ADbg.cpp vendor/lame/current/ACM/ADbg/ADbg.dsp vendor/lame/current/ACM/ADbg/ADbg.h vendor/lame/current/ACM/ADbg/ADbg_vc7.vcproj vendor/lame/current/ACM/ADbg/Makefile.am vendor/lame/current/ACM/ADbg/Makefile.in vendor/lame/current/ACM/AEncodeProperties.cpp vendor/lame/current/ACM/AEncodeProperties.h vendor/lame/current/ACM/DecodeStream.cpp vendor/lame/current/ACM/DecodeStream.h vendor/lame/current/ACM/LameACM.inf vendor/lame/current/ACM/Makefile.am vendor/lame/current/ACM/Makefile.in vendor/lame/current/ACM/TODO vendor/lame/current/ACM/acm.rc vendor/lame/current/ACM/adebug.h vendor/lame/current/ACM/ddk/ vendor/lame/current/ACM/ddk/Makefile.am vendor/lame/current/ACM/ddk/Makefile.in vendor/lame/current/ACM/ddk/msacmdrv.h vendor/lame/current/ACM/lame.ico vendor/lame/current/ACM/lameACM.def vendor/lame/current/ACM/lameACM_vc6.dsp vendor/lame/current/ACM/lameACM_vc7.vcproj vendor/lame/current/ACM/lame_acm.xml vendor/lame/current/ACM/main.cpp vendor/lame/current/ACM/readme.txt vendor/lame/current/ACM/resource.h vendor/lame/current/ACM/tinyxml/ vendor/lame/current/ACM/tinyxml/Makefile.am vendor/lame/current/ACM/tinyxml/Makefile.in vendor/lame/current/ACM/tinyxml/Makefile.tinyxml vendor/lame/current/ACM/tinyxml/changes.txt vendor/lame/current/ACM/tinyxml/dox vendor/lame/current/ACM/tinyxml/makedistlinux vendor/lame/current/ACM/tinyxml/makedistwin.bat vendor/lame/current/ACM/tinyxml/readme.txt vendor/lame/current/ACM/tinyxml/test.dsp vendor/lame/current/ACM/tinyxml/test.dsw vendor/lame/current/ACM/tinyxml/tinyxml.cpp vendor/lame/current/ACM/tinyxml/tinyxml.dsp vendor/lame/current/ACM/tinyxml/tinyxml.h vendor/lame/current/ACM/tinyxml/tinyxml_vc7.vcproj vendor/lame/current/ACM/tinyxml/tinyxmlerror.cpp vendor/lame/current/ACM/tinyxml/tinyxmlparser.cpp vendor/lame/current/ACM/tinyxml/xmltest.cpp vendor/lame/current/API vendor/lame/current/COPYING vendor/lame/current/ChangeLog vendor/lame/current/DEFINES vendor/lame/current/Dll/ vendor/lame/current/Dll/BladeMP3EncDLL.c vendor/lame/current/Dll/BladeMP3EncDLL.def vendor/lame/current/Dll/BladeMP3EncDLL.h vendor/lame/current/Dll/Example.cpp vendor/lame/current/Dll/Example_vc6.dsp vendor/lame/current/Dll/Example_vc6.dsw vendor/lame/current/Dll/LameDLLInterface.htm vendor/lame/current/Dll/LameDll_vc6.dsp vendor/lame/current/Dll/LameDll_vc7.vcproj vendor/lame/current/Dll/MP3export.pas vendor/lame/current/Dll/Makefile.am vendor/lame/current/Dll/Makefile.in vendor/lame/current/Dll/Makefile.mingw32 vendor/lame/current/Dll/README vendor/lame/current/HACKING vendor/lame/current/INSTALL vendor/lame/current/INSTALL.configure vendor/lame/current/LICENSE vendor/lame/current/Makefile.MSVC vendor/lame/current/Makefile.am vendor/lame/current/Makefile.am.global vendor/lame/current/Makefile.in vendor/lame/current/Makefile.unix vendor/lame/current/README vendor/lame/current/README.WINGTK vendor/lame/current/STYLEGUIDE vendor/lame/current/TODO vendor/lame/current/USAGE vendor/lame/current/acinclude.m4 vendor/lame/current/aclocal.m4 vendor/lame/current/config.guess vendor/lame/current/config.h.in vendor/lame/current/config.sub vendor/lame/current/configMS.h vendor/lame/current/configure vendor/lame/current/configure.in vendor/lame/current/debian/ vendor/lame/current/debian/Makefile.am vendor/lame/current/debian/Makefile.in vendor/lame/current/debian/changelog vendor/lame/current/debian/control vendor/lame/current/debian/copyright vendor/lame/current/debian/lame.docs vendor/lame/current/debian/lame.files vendor/lame/current/debian/libmp3lame0-dev.docs vendor/lame/current/debian/libmp3lame0-dev.files vendor/lame/current/debian/libmp3lame0.files vendor/lame/current/debian/rules vendor/lame/current/depcomp vendor/lame/current/doc/ vendor/lame/current/doc/Makefile.am vendor/lame/current/doc/Makefile.in vendor/lame/current/doc/html/ vendor/lame/current/doc/html/Makefile.am vendor/lame/current/doc/html/Makefile.in vendor/lame/current/doc/html/basic.html vendor/lame/current/doc/html/contributors.html vendor/lame/current/doc/html/examples.html vendor/lame/current/doc/html/history.html vendor/lame/current/doc/html/id3.html vendor/lame/current/doc/html/index.html vendor/lame/current/doc/html/lame.css vendor/lame/current/doc/html/modes.html vendor/lame/current/doc/html/node6.html vendor/lame/current/doc/html/presets.html vendor/lame/current/doc/html/switchs.html vendor/lame/current/doc/man/ vendor/lame/current/doc/man/Makefile.am vendor/lame/current/doc/man/Makefile.in vendor/lame/current/doc/man/lame.1 vendor/lame/current/dshow/ vendor/lame/current/dshow/Encoder.cpp vendor/lame/current/dshow/Encoder.h vendor/lame/current/dshow/Makefile.am vendor/lame/current/dshow/Makefile.in vendor/lame/current/dshow/Mpegac.cpp vendor/lame/current/dshow/Mpegac.def vendor/lame/current/dshow/Mpegac.h vendor/lame/current/dshow/PropPage.cpp vendor/lame/current/dshow/PropPage.h vendor/lame/current/dshow/PropPage_adv.cpp vendor/lame/current/dshow/PropPage_adv.h vendor/lame/current/dshow/Property.rc vendor/lame/current/dshow/README vendor/lame/current/dshow/REG.CPP vendor/lame/current/dshow/REG.H vendor/lame/current/dshow/UIDS.H vendor/lame/current/dshow/aboutprp.cpp vendor/lame/current/dshow/aboutprp.h vendor/lame/current/dshow/dshow.dsp vendor/lame/current/dshow/dshow.dsw vendor/lame/current/dshow/elogo.ico vendor/lame/current/dshow/iaudioprops.h vendor/lame/current/dshow/resource.h vendor/lame/current/frontend/ vendor/lame/current/frontend/Makefile.am vendor/lame/current/frontend/Makefile.in vendor/lame/current/frontend/amiga_mpega.c vendor/lame/current/frontend/brhist.c vendor/lame/current/frontend/brhist.h vendor/lame/current/frontend/console.c vendor/lame/current/frontend/console.h vendor/lame/current/frontend/depcomp vendor/lame/current/frontend/get_audio.c vendor/lame/current/frontend/get_audio.h vendor/lame/current/frontend/gpkplotting.c vendor/lame/current/frontend/gpkplotting.h vendor/lame/current/frontend/gtkanal.c vendor/lame/current/frontend/gtkanal.h vendor/lame/current/frontend/lame_vc6.dsp vendor/lame/current/frontend/lame_vc7.vcproj vendor/lame/current/frontend/lametime.c vendor/lame/current/frontend/lametime.h vendor/lame/current/frontend/main.c vendor/lame/current/frontend/main.h vendor/lame/current/frontend/mp3rtp.c vendor/lame/current/frontend/mp3x.c vendor/lame/current/frontend/mp3x_vc6.dsp vendor/lame/current/frontend/mp3x_vc7.vcproj vendor/lame/current/frontend/parse.c vendor/lame/current/frontend/parse.h vendor/lame/current/frontend/portableio.c vendor/lame/current/frontend/portableio.h vendor/lame/current/frontend/rtp.c vendor/lame/current/frontend/rtp.h vendor/lame/current/frontend/timestatus.c vendor/lame/current/frontend/timestatus.h vendor/lame/current/include/ vendor/lame/current/include/Makefile.am vendor/lame/current/include/Makefile.in vendor/lame/current/include/lame.h vendor/lame/current/install-sh vendor/lame/current/lame.bat vendor/lame/current/lame.spec vendor/lame/current/lame.spec.in vendor/lame/current/lame_projects_vc6.dsp vendor/lame/current/lame_vc6.dsw vendor/lame/current/lame_vc7.sln vendor/lame/current/libmp3lame/ vendor/lame/current/libmp3lame/Makefile.am vendor/lame/current/libmp3lame/Makefile.in vendor/lame/current/libmp3lame/VbrTag.c vendor/lame/current/libmp3lame/VbrTag.h vendor/lame/current/libmp3lame/bitstream.c vendor/lame/current/libmp3lame/bitstream.h vendor/lame/current/libmp3lame/depcomp vendor/lame/current/libmp3lame/encoder.c vendor/lame/current/libmp3lame/encoder.h vendor/lame/current/libmp3lame/fft.c vendor/lame/current/libmp3lame/fft.h vendor/lame/current/libmp3lame/gain_analysis.c vendor/lame/current/libmp3lame/gain_analysis.h vendor/lame/current/libmp3lame/i386/ vendor/lame/current/libmp3lame/i386/Makefile.am vendor/lame/current/libmp3lame/i386/Makefile.in vendor/lame/current/libmp3lame/i386/choose_table.nas vendor/lame/current/libmp3lame/i386/cpu_feat.nas vendor/lame/current/libmp3lame/i386/fft.nas vendor/lame/current/libmp3lame/i386/fft3dn.nas vendor/lame/current/libmp3lame/i386/fftfpu.nas vendor/lame/current/libmp3lame/i386/fftsse.nas vendor/lame/current/libmp3lame/i386/ffttbl.nas vendor/lame/current/libmp3lame/i386/nasm.h vendor/lame/current/libmp3lame/id3tag.c vendor/lame/current/libmp3lame/id3tag.h vendor/lame/current/libmp3lame/l3side.h vendor/lame/current/libmp3lame/lame-analysis.h vendor/lame/current/libmp3lame/lame.c vendor/lame/current/libmp3lame/lame_global_flags.h vendor/lame/current/libmp3lame/libmp3lame_vc6.dsp vendor/lame/current/libmp3lame/libmp3lame_vc7.vcproj vendor/lame/current/libmp3lame/machine.h vendor/lame/current/libmp3lame/mpglib_interface.c vendor/lame/current/libmp3lame/newmdct.c vendor/lame/current/libmp3lame/newmdct.h vendor/lame/current/libmp3lame/presets.c vendor/lame/current/libmp3lame/psymodel.c vendor/lame/current/libmp3lame/psymodel.h vendor/lame/current/libmp3lame/quantize.c vendor/lame/current/libmp3lame/quantize.h vendor/lame/current/libmp3lame/quantize_pvt.c vendor/lame/current/libmp3lame/quantize_pvt.h vendor/lame/current/libmp3lame/reservoir.c vendor/lame/current/libmp3lame/reservoir.h vendor/lame/current/libmp3lame/set_get.c vendor/lame/current/libmp3lame/set_get.h vendor/lame/current/libmp3lame/tables.c vendor/lame/current/libmp3lame/tables.h vendor/lame/current/libmp3lame/takehiro.c vendor/lame/current/libmp3lame/util.c vendor/lame/current/libmp3lame/util.h vendor/lame/current/libmp3lame/vbrquantize.c vendor/lame/current/libmp3lame/vbrquantize.h vendor/lame/current/libmp3lame/version.c vendor/lame/current/libmp3lame/version.h vendor/lame/current/ltconfig vendor/lame/current/ltmain.sh vendor/lame/current/mac/ vendor/lame/current/mac/LAME.mcp vendor/lame/current/mac/LAME_Carbon_Debug.pch vendor/lame/current/mac/LAME_Carbon_Final.pch vendor/lame/current/mac/LAME_Classic_Debug.pch vendor/lame/current/mac/LAME_Classic_Final.pch vendor/lame/current/mac/MacDLLMain.c vendor/lame/current/mac/Makefile.am vendor/lame/current/mac/Makefile.in vendor/lame/current/mac/Precompile_Common.h vendor/lame/current/misc/ vendor/lame/current/misc/Lame.vbs vendor/lame/current/misc/Makefile.am vendor/lame/current/misc/Makefile.in vendor/lame/current/misc/abx.c vendor/lame/current/misc/ath.c vendor/lame/current/misc/auenc vendor/lame/current/misc/depcomp vendor/lame/current/misc/lame4dos.bat vendor/lame/current/misc/lameGUI.html vendor/lame/current/misc/lameid3.pl vendor/lame/current/misc/mlame vendor/lame/current/misc/mlame_corr.c vendor/lame/current/misc/mugeco.sh vendor/lame/current/misc/scalartest.c vendor/lame/current/missing vendor/lame/current/mkinstalldirs vendor/lame/current/mpglib/ vendor/lame/current/mpglib/Makefile.am vendor/lame/current/mpglib/Makefile.in vendor/lame/current/mpglib/README vendor/lame/current/mpglib/TODO vendor/lame/current/mpglib/common.c vendor/lame/current/mpglib/common.h vendor/lame/current/mpglib/dct64_i386.c vendor/lame/current/mpglib/dct64_i386.h vendor/lame/current/mpglib/decode_i386.c vendor/lame/current/mpglib/decode_i386.h vendor/lame/current/mpglib/depcomp vendor/lame/current/mpglib/huffman.h vendor/lame/current/mpglib/interface.c vendor/lame/current/mpglib/interface.h vendor/lame/current/mpglib/l2tables.h vendor/lame/current/mpglib/layer1.c vendor/lame/current/mpglib/layer1.h vendor/lame/current/mpglib/layer2.c vendor/lame/current/mpglib/layer2.h vendor/lame/current/mpglib/layer3.c vendor/lame/current/mpglib/layer3.h vendor/lame/current/mpglib/mpg123.h vendor/lame/current/mpglib/mpglib.h vendor/lame/current/mpglib/mpglib_vc6.dsp vendor/lame/current/mpglib/mpglib_vc7.vcproj vendor/lame/current/mpglib/tabinit.c vendor/lame/current/mpglib/tabinit.h vendor/lame/current/testcase.mp3 vendor/lame/current/testcase.wav
Added: vendor/lame/current/ACM/ACM.cpp =================================================================== --- vendor/lame/current/ACM/ACM.cpp (rev 0) +++ vendor/lame/current/ACM/ACM.cpp 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,1421 @@ +/** + * + * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows + * + * Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/*! + \author Steve Lhomme + \version $Id: ACM.cpp,v 1.18 2005/03/13 14:43:21 robert Exp $ +*/ + +#if !defined(STRICT) +#define STRICT +#endif // STRICT + +#include <algorithm> + +#include <windows.h> +#include <windowsx.h> +#include <intshcut.h> + +#include <mmreg.h> +#include <msacm.h> +#include <msacmdrv.h> + +#include <assert.h> + +#include <version.h> + +#include "adebug.h" +#include "resource.h" +#include "ACMStream.h" + +#ifdef ENABLE_DECODING +#include "DecodeStream.h" +#endif // ENABLE_DECODING + +#include "ACM.h" + +#ifndef IDC_HAND +#define IDC_HAND MAKEINTRESOURCE(32649) +#endif // IDC_HAND + +char ACM::VersionString[20]; + +const char ACM_VERSION[] = "0.9.0"; + +#ifdef WIN32 +// +// 32-bit versions +// +#if (WINVER >= 0x0400) + #define VERSION_ACM_DRIVER MAKE_ACM_VERSION(4, 0, 0) +#else +#define VERSION_ACM_DRIVER MAKE_ACM_VERSION(3, 51, 0) +#endif +#define VERSION_MSACM MAKE_ACM_VERSION(3, 50, 0) + +#else +// +// 16-bit versions +// +#define VERSION_ACM_DRIVER MAKE_ACM_VERSION(1, 0, 0) +#define VERSION_MSACM MAKE_ACM_VERSION(2, 1, 0) + +#endif + +#define PERSONAL_FORMAT WAVE_FORMAT_MPEGLAYER3 +#define SIZE_FORMAT_STRUCT sizeof(MPEGLAYER3WAVEFORMAT) +//#define SIZE_FORMAT_STRUCT 0 + +//static const char channel_mode[][13] = {"mono","stereo","joint stereo","dual channel"}; +static const char channel_mode[][13] = {"mono","stereo"}; +static const unsigned int mpeg1_freq[] = {48000,44100,32000}; +static const unsigned int mpeg2_freq[] = {24000,22050,16000,12000,11025,8000}; +static const unsigned int mpeg1_bitrate[] = {320, 256, 224, 192, 160, 128, 112, 96, 80, 64, 56, 48, 40, 32}; +static const unsigned int mpeg2_bitrate[] = {160, 144, 128, 112, 96, 80, 64, 56, 48, 40, 32, 24, 16, 8}; + +#define SIZE_CHANNEL_MODE (sizeof(channel_mode) / (sizeof(char) * 13)) +#define SIZE_FREQ_MPEG1 (sizeof(mpeg1_freq) / sizeof(unsigned int)) +#define SIZE_FREQ_MPEG2 (sizeof(mpeg2_freq) / sizeof(unsigned int)) +#define SIZE_BITRATE_MPEG1 (sizeof(mpeg1_bitrate) / sizeof(unsigned int)) +#define SIZE_BITRATE_MPEG2 (sizeof(mpeg2_bitrate) / sizeof(unsigned int)) + +static const int FORMAT_TAG_MAX_NB = 2; // PCM and PERSONAL (mandatory to have at least PCM and your format) +static const int FILTER_TAG_MAX_NB = 0; // this is a codec, not a filter + +// number of supported PCM formats +static const int FORMAT_MAX_NB_PCM = + 2 * // number of PCM channel mode (stereo/mono) + (SIZE_FREQ_MPEG1 + // number of MPEG 1 sampling freq + SIZE_FREQ_MPEG2); // number of MPEG 2 sampling freq + +////////////////////////////////////////////////////////////////////// +// +////////////////////////////////////////////////////////////////////// +bool bitrate_item::operator<(const bitrate_item & other_bitrate) const +{ + return (other_bitrate.frequency < frequency || + (other_bitrate.frequency == frequency && + (other_bitrate.bitrate < bitrate || + (other_bitrate.bitrate == bitrate && + (other_bitrate.channels < channels))))); +} + +////////////////////////////////////////////////////////////////////// +// Configuration Dialog +////////////////////////////////////////////////////////////////////// +/* +static CALLBACK ConfigProc( + HWND hwndDlg, // handle to dialog box +UINT uMsg, // message +WPARAM wParam, // first message parameter +LPARAM lParam // second message parameter +) +{ + BOOL bResult; + + switch (uMsg) { + case WM_COMMAND: + UINT command; + command = GET_WM_COMMAND_ID(wParam, lParam); + if (IDOK == command) + { + EndDialog(hwndDlg, (IDOK == command)); + } else if (IDCANCEL == command) + { + EndDialog(hwndDlg, (IDOK == command)); + } + bResult = FALSE; + break; + default: + bResult = FALSE; // will be treated by DefWindowProc +} + return bResult; +} + + +inline DWORD ACM::Configure(HWND hParentWindow, LPDRVCONFIGINFO pConfig) +{ + my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "ACM : Configure (Parent Window = 0x%08X)",hParentWindow); + + DialogBoxParam( my_hModule, MAKEINTRESOURCE(IDD_CONFIG), hParentWindow, ::ConfigProc , (LPARAM)this); + + return DRVCNF_OK; // Can also return + // DRVCNF_CANCEL + // and DRVCNF_RESTART +} +*/ +////////////////////////////////////////////////////////////////////// +// About Dialog +////////////////////////////////////////////////////////////////////// + +static BOOL CALLBACK AboutProc( + HWND hwndDlg, // handle to dialog box +UINT uMsg, // message +WPARAM wParam, // first message parameter +LPARAM lParam // second message parameter +) +{ + static HBRUSH hBrushStatic = NULL; +// static LOGFONT lf; // structure for font information +// static HFONT hfnt; + static HCURSOR hcOverCursor = NULL; + BOOL bResult; + + switch (uMsg) { + case WM_INITDIALOG: + char tmp[150]; + wsprintf(tmp,"LAME MP3 codec v%s", ACM::GetVersionString()); + ::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_ABOUT_TITLE), tmp); + +/* + ::GetObject(::GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &lf); + lf.lfUnderline = TRUE; + + hfnt = ::CreateFontIndirect(&lf); + + ::SendMessage(::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL), WM_SETFONT, (WPARAM) hfnt, TRUE); +* / + hBrushStatic = ::CreateSolidBrush(::GetSysColor (COLOR_BTNFACE)); +*/ hcOverCursor = ::LoadCursor(NULL,(LPCTSTR)IDC_HAND); + if (hcOverCursor == NULL) + hcOverCursor = ::LoadCursor(NULL,(LPCTSTR)IDC_CROSS); + + bResult = TRUE; + break; +/* + case WM_CTLCOLORSTATIC: + /// \todo only if there are URLs + if ((HWND)lParam == ::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL)) + { + ::SetTextColor((HDC)wParam, ::GetSysColor (COLOR_HIGHLIGHT)); + ::SetBkColor((HDC)wParam, ::GetSysColor (COLOR_BTNFACE)); + + return (LRESULT) hBrushStatic; + } + else + return (LRESULT) NULL; +*/ + case WM_MOUSEMOVE: + { + POINT pnt; + ::GetCursorPos(&pnt); + + RECT rect; + ::GetWindowRect( ::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL), &rect); + + if ( ::PtInRect(&rect,pnt) ) + { + ::SetCursor(hcOverCursor); + } + + + } + break; + + case WM_LBUTTONUP: + { + POINT pnt; + ::GetCursorPos(&pnt); + + RECT rect; + ::GetWindowRect( ::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL), &rect); + + TCHAR Url[200]; + bool bUrl = false; + if (::PtInRect(&rect,pnt)) + { + wsprintf(Url,LAME_URL); + bUrl = true; + } + + if (bUrl) + { + LPSTR tmpStr; + HRESULT hresult = ::TranslateURL(Url, TRANSLATEURL_FL_GUESS_PROTOCOL|TRANSLATEURL_FL_GUESS_PROTOCOL, &tmpStr); + if (hresult == S_OK) + ::ShellExecute(hwndDlg,"open",tmpStr,NULL,"",SW_SHOWMAXIMIZED ); + else if (hresult == S_FALSE) + ::ShellExecute(hwndDlg,"open",Url,NULL,"",SW_SHOWMAXIMIZED ); + } + + } + break; + + case WM_COMMAND: + UINT command; + command = GET_WM_COMMAND_ID(wParam, lParam); + if (IDOK == command) + { + EndDialog(hwndDlg, TRUE); + } + bResult = FALSE; + break; + + case IDC_STATIC_ABOUT_URL: + break; + default: + bResult = FALSE; // will be treated by DefWindowProc +} + return bResult; +} + +inline DWORD ACM::About(HWND hParentWindow) +{ + my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "ACM : About (Parent Window = 0x%08X)",hParentWindow); + + DialogBoxParam( my_hModule, MAKEINTRESOURCE(IDD_ABOUT), hParentWindow, ::AboutProc , (LPARAM)this); + + return DRVCNF_OK; // Can also return +// DRVCNF_CANCEL +// and DRVCNF_RESTART +} + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +ACM::ACM( HMODULE hModule ) + :my_hModule(hModule), + my_hIcon(NULL), + my_debug(ADbg(DEBUG_LEVEL_CREATION)), + my_EncodingProperties(hModule) +{ + my_EncodingProperties.ParamsRestore(); + + /// \todo get the debug level from the registry + unsigned char DebugFileName[512]; + + char tmp[128]; + wsprintf(tmp,"LAMEacm 0x%08X",this); + my_debug.setPrefix(tmp); /// \todo get it from the registry + my_debug.setIncludeTime(true); /// \todo get it from the registry + + // Check in the registry if we have to Output Debug information + DebugFileName[0] = '\0'; + + HKEY OssKey; + if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\MUKOLI", 0, KEY_READ , &OssKey ) == ERROR_SUCCESS) { + DWORD DataType; + DWORD DebugFileNameSize = 512; + if (RegQueryValueEx( OssKey, "DebugFile", NULL, &DataType, DebugFileName, &DebugFileNameSize ) == ERROR_SUCCESS) { + if (DataType == REG_SZ) { + my_debug.setUseFile(true); + my_debug.setDebugFile((char *)DebugFileName); + my_debug.OutPut("Debug file is %s",(char *)DebugFileName); + } + } + } + +#if LAME_ALPHA_VERSION > 0 + wsprintf(VersionString,"%s - %d.%d (alpha %d)", ACM_VERSION, LAME_MAJOR_VERSION, LAME_MINOR_VERSION,LAME_PATCH_VERSION); +#elif LAME_BETA_VERSION > 0 + wsprintf(VersionString,"%s - %d.%d (beta %d)", ACM_VERSION, LAME_MAJOR_VERSION, LAME_MINOR_VERSION, LAME_PATCH_VERSION); +#else + wsprintf(VersionString,"%s - %d.%d (stable)", ACM_VERSION, LAME_MAJOR_VERSION, LAME_MINOR_VERSION); +#endif + + BuildBitrateTable(); + + my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "New ACM Creation (0x%08X)",this); +} + +ACM::~ACM() +{ +// not used, it's done automatically when closing the driver if (my_hIcon != NULL) +// CloseHandle(my_hIcon); + + bitrate_table.clear(); + + my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "ACM Deleted (0x%08X)",this); +} + +////////////////////////////////////////////////////////////////////// +// Main message handler +////////////////////////////////////////////////////////////////////// + +LONG ACM::DriverProcedure(const HDRVR hdrvr, const UINT msg, LONG lParam1, LONG lParam2) +{ + DWORD dwRes = 0L; + +//my_debug.OutPut(DEBUG_LEVEL_MSG, "message 0x%08X for ThisACM 0x%08X", msg, this); + +switch (msg) { + case DRV_INSTALL: + my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_INSTALL"); + // Sent when the driver is installed. + dwRes = DRVCNF_OK; // Can also return + break; // DRVCNF_CANCEL + // and DRV_RESTART + + case DRV_REMOVE: + // Sent when the driver is removed. + my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_REMOVE"); + dwRes = 1L; // return value ignored + break; + + case DRV_QUERYCONFIGURE: + my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_QUERYCONFIGURE"); + // Sent to determine if the driver can be + // configured. + dwRes = 1L; // Zero indicates configuration + break; // NOT supported + + case DRV_CONFIGURE: + my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_CONFIGURE"); + // Sent to display the configuration + // dialog box for the driver. +// dwRes = Configure( (HWND) lParam1, (LPDRVCONFIGINFO) lParam2 ); + if (my_EncodingProperties.Config(my_hModule, (HWND) lParam1)) + { + dwRes = DRVCNF_OK; // Can also return + // DRVCNF_CANCEL + // and DRVCNF_RESTART + } else { + dwRes = DRVCNF_CANCEL; + } + break; + + /************************************** + // ACM additional messages + ***************************************/ + + case ACMDM_DRIVER_ABOUT: + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_DRIVER_ABOUT"); + + dwRes = About( (HWND) lParam1 ); + + break; + + case ACMDM_DRIVER_DETAILS: // acmDriverDetails + // Fill-in general informations about the driver/codec + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_DRIVER_DETAILS"); + + dwRes = OnDriverDetails(hdrvr, (LPACMDRIVERDETAILS) lParam1); + + break; + + case ACMDM_FORMATTAG_DETAILS: // acmFormatTagDetails + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_FORMATTAG_DETAILS"); + + dwRes = OnFormatTagDetails((LPACMFORMATTAGDETAILS) lParam1, lParam2); + + break; + + case ACMDM_FORMAT_DETAILS: // acmFormatDetails + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_FORMAT_DETAILS"); + + dwRes = OnFormatDetails((LPACMFORMATDETAILS) lParam1, lParam2); + + break; + + case ACMDM_FORMAT_SUGGEST: // acmFormatSuggest + // Sent to determine if the driver can be + // configured. + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_FORMAT_SUGGEST"); + dwRes = OnFormatSuggest((LPACMDRVFORMATSUGGEST) lParam1); + break; + + /************************************** + // ACM stream messages + ***************************************/ + + case ACMDM_STREAM_OPEN: + // Sent to determine if the driver can be + // configured. + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_OPEN"); + dwRes = OnStreamOpen((LPACMDRVSTREAMINSTANCE) lParam1); + break; + + case ACMDM_STREAM_SIZE: + // returns a recommended size for a source + // or destination buffer on an ACM stream + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_SIZE"); + dwRes = OnStreamSize((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMDRVSTREAMSIZE)lParam2); + break; + + case ACMDM_STREAM_PREPARE: + // prepares an ACMSTREAMHEADER structure for + // an ACM stream conversion + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_PREPARE"); + dwRes = OnStreamPrepareHeader((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMSTREAMHEADER) lParam2); + break; + + case ACMDM_STREAM_UNPREPARE: + // cleans up the preparation performed by + // the ACMDM_STREAM_PREPARE message for an ACM stream + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_UNPREPARE"); + dwRes = OnStreamUnPrepareHeader((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMSTREAMHEADER) lParam2); + break; + + case ACMDM_STREAM_CONVERT: + // perform a conversion on the specified conversion stream + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_CONVERT"); + dwRes = OnStreamConvert((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMDRVSTREAMHEADER) lParam2); + + break; + + case ACMDM_STREAM_CLOSE: + // closes an ACM conversion stream + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_CLOSE"); + dwRes = OnStreamClose((LPACMDRVSTREAMINSTANCE)lParam1); + break; + + /************************************** + // Unknown message + ***************************************/ + + default: + // Process any other messages. + my_debug.OutPut(DEBUG_LEVEL_MSG, "ACM::DriverProc unknown message (0x%08X), lParam1 = 0x%08X, lParam2 = 0x%08X", msg, lParam1, lParam2); + return DefDriverProc ((DWORD)this, hdrvr, msg, lParam1, lParam2); + } + + return dwRes; +} + +////////////////////////////////////////////////////////////////////// +// Special message handlers +////////////////////////////////////////////////////////////////////// +/*! + Retreive the config details of this ACM driver + The index represent the specified format + + \param a_FormatDetails will be filled with all the corresponding data +*/ +inline DWORD ACM::OnFormatDetails(LPACMFORMATDETAILS a_FormatDetails, const LPARAM a_Query) +{ + DWORD Result = ACMERR_NOTPOSSIBLE; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATDETAILS a_Query = 0x%08X",a_Query); + switch (a_Query & ACM_FORMATDETAILSF_QUERYMASK) { + + // Fill-in the informations corresponding to the FormatDetails->dwFormatTagIndex + case ACM_FORMATDETAILSF_INDEX : + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "enter ACM_FORMATDETAILSF_INDEX for index 0x%04X:%03d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex); + if (a_FormatDetails->dwFormatTag == PERSONAL_FORMAT) { + if (a_FormatDetails->dwFormatIndex < GetNumberEncodingFormats()) { + LPWAVEFORMATEX WaveExt; + WaveExt = a_FormatDetails->pwfx; + + WaveExt->wFormatTag = PERSONAL_FORMAT; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format in : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec); + GetMP3FormatForIndex(a_FormatDetails->dwFormatIndex, *WaveExt, a_FormatDetails->szFormat); + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format out : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec); + Result = MMSYSERR_NOERROR; + } + else + { + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATDETAILSF_INDEX unknown index 0x%04X:%03d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex); + } + } + else if (a_FormatDetails->dwFormatTag == WAVE_FORMAT_PCM) { + if (a_FormatDetails->dwFormatIndex < FORMAT_MAX_NB_PCM) { + LPWAVEFORMATEX WaveExt; + WaveExt = a_FormatDetails->pwfx; + + WaveExt->wFormatTag = WAVE_FORMAT_PCM; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format in : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec); + GetPCMFormatForIndex(a_FormatDetails->dwFormatIndex, *WaveExt, a_FormatDetails->szFormat); + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format out : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec); + Result = MMSYSERR_NOERROR; + } + else + { + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATDETAILSF_INDEX unknown index 0x%04X:%03d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex); + } + } + else + { + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Unknown a_FormatDetails->dwFormatTag = 0x%08X",a_FormatDetails->dwFormatTag); + } + + case ACM_FORMATDETAILSF_FORMAT : + /// \todo we may output the corresponding strong (only for personal format) + LPWAVEFORMATEX WaveExt; + WaveExt = a_FormatDetails->pwfx; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "enter ACM_FORMATDETAILSF_FORMAT : 0x%04X:%03d, format in : channels %d, sample rate %d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex, WaveExt->nChannels, WaveExt->nSamplesPerSec); + + Result = MMSYSERR_NOERROR; + break; + + default: + Result = ACMERR_NOTPOSSIBLE; + break; + } + + a_FormatDetails->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; + + return Result; +} + +/*! + Retreive the details of each known format by this ACM driver + The index represent the specified format (0 = MP3 / 1 = PCM) + + \param a_FormatTagDetails will be filled with all the corresponding data +*/ +inline DWORD ACM::OnFormatTagDetails(LPACMFORMATTAGDETAILS a_FormatTagDetails, const LPARAM a_Query) +{ + DWORD Result; + DWORD the_format = WAVE_FORMAT_UNKNOWN; // the format to give details + + if (a_FormatTagDetails->cbStruct >= sizeof(*a_FormatTagDetails)) { + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACMDM_FORMATTAG_DETAILS, a_Query = 0x%08X",a_Query); + switch(a_Query & ACM_FORMATTAGDETAILSF_QUERYMASK) { + + case ACM_FORMATTAGDETAILSF_INDEX: + // Fill-in the informations corresponding to the a_FormatDetails->dwFormatTagIndex + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "get ACM_FORMATTAGDETAILSF_INDEX for index %03d",a_FormatTagDetails->dwFormatTagIndex); + + if (a_FormatTagDetails->dwFormatTagIndex < FORMAT_TAG_MAX_NB) { + switch (a_FormatTagDetails->dwFormatTagIndex) + { + case 0: + the_format = PERSONAL_FORMAT; + break; + default : + the_format = WAVE_FORMAT_PCM; + break; + } + } + else + { + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATTAGDETAILSF_INDEX for unsupported index %03d",a_FormatTagDetails->dwFormatTagIndex); + Result = ACMERR_NOTPOSSIBLE; + } + break; + + case ACM_FORMATTAGDETAILSF_FORMATTAG: + // Fill-in the informations corresponding to the a_FormatDetails->dwFormatTagIndex and hdrvr given + switch (a_FormatTagDetails->dwFormatTag) + { + case WAVE_FORMAT_PCM: + the_format = WAVE_FORMAT_PCM; + break; + case PERSONAL_FORMAT: + the_format = PERSONAL_FORMAT; + break; + default: + return (ACMERR_NOTPOSSIBLE); + } + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "get ACM_FORMATTAGDETAILSF_FORMATTAG for index 0x%02X, cStandardFormats = %d",a_FormatTagDetails->dwFormatTagIndex,a_FormatTagDetails->cStandardFormats); + break; + case ACM_FORMATTAGDETAILSF_LARGESTSIZE: + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATTAGDETAILSF_LARGESTSIZE not used"); + Result = 0L; + break; + default: + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails Unknown Format tag query"); + Result = MMSYSERR_NOTSUPPORTED; + break; + } + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails the_format = 0x%08X",the_format); + switch(the_format) + { + case WAVE_FORMAT_PCM: + a_FormatTagDetails->dwFormatTag = WAVE_FORMAT_PCM; + a_FormatTagDetails->dwFormatTagIndex = 0; + a_FormatTagDetails->cbFormatSize = sizeof(PCMWAVEFORMAT); + /// \note 0 may mean we don't know how to decode + a_FormatTagDetails->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; + a_FormatTagDetails->cStandardFormats = FORMAT_MAX_NB_PCM; + // should be filled by Windows a_FormatTagDetails->szFormatTag[0] = '\0'; + Result = MMSYSERR_NOERROR; + break; + case PERSONAL_FORMAT: + a_FormatTagDetails->dwFormatTag = PERSONAL_FORMAT; + a_FormatTagDetails->dwFormatTagIndex = 1; + a_FormatTagDetails->cbFormatSize = SIZE_FORMAT_STRUCT; + a_FormatTagDetails->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; + a_FormatTagDetails->cStandardFormats = GetNumberEncodingFormats(); + lstrcpyW( a_FormatTagDetails->szFormatTag, L"Lame MP3" ); + Result = MMSYSERR_NOERROR; + break; + default: + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails Unknown format 0x%08X",the_format); + return (ACMERR_NOTPOSSIBLE); + } + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails %d possibilities for format 0x%08X",a_FormatTagDetails->cStandardFormats,the_format); + } + else + { + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "a_FormatTagDetails->cbStruct < sizeof(*a_FormatDetails)"); + Result = ACMERR_NOTPOSSIBLE; + } + + return Result; +} + +/*! + Retreive the global details of this ACM driver + + \param a_DriverDetail will be filled with all the corresponding data +*/ +inline DWORD ACM::OnDriverDetails(const HDRVR hdrvr, LPACMDRIVERDETAILS a_DriverDetail) +{ + if (my_hIcon == NULL) + my_hIcon = LoadIcon(GetDriverModuleHandle(hdrvr), MAKEINTRESOURCE(IDI_ICON)); + a_DriverDetail->hicon = my_hIcon; + + a_DriverDetail->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC; + a_DriverDetail->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED; + + /// \note this is an explicit hack of the FhG values + /// \note later it could be a new value when the decoding is done + a_DriverDetail->wMid = MM_FRAUNHOFER_IIS; + a_DriverDetail->wPid = MM_FHGIIS_MPEGLAYER3; + + a_DriverDetail->vdwACM = VERSION_MSACM; + a_DriverDetail->vdwDriver = VERSION_ACM_DRIVER; + a_DriverDetail->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; + a_DriverDetail->cFormatTags = FORMAT_TAG_MAX_NB; // 2 : MP3 and PCM +// a_DriverDetail->cFormatTags = 1; // 2 : MP3 and PCM + a_DriverDetail->cFilterTags = FILTER_TAG_MAX_NB; + + lstrcpyW( a_DriverDetail->szShortName, L"LAME MP3" ); + char tmpStr[128]; + wsprintf(tmpStr, "LAME MP3 Codec v%s", GetVersionString()); + int u = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, tmpStr, -1, a_DriverDetail->szLongName, 0); + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, tmpStr, -1, a_DriverDetail->szLongName, u); + lstrcpyW( a_DriverDetail->szCopyright, L"2002 Steve Lhomme" ); + lstrcpyW( a_DriverDetail->szLicensing, L"LGPL (see gnu.org)" ); + /// \todo update this part when the code changes + lstrcpyW( a_DriverDetail->szFeatures , L"only CBR implementation" ); + + return MMSYSERR_NOERROR; // Can also return DRVCNF_CANCEL +} + +/*! + Suggest an output format for the specified input format + + \param a_FormatSuggest will be filled with all the corresponding data +*/ +inline DWORD ACM::OnFormatSuggest(LPACMDRVFORMATSUGGEST a_FormatSuggest) +{ + DWORD Result = MMSYSERR_NOTSUPPORTED; + DWORD fdwSuggest = (ACM_FORMATSUGGESTF_TYPEMASK & a_FormatSuggest->fdwSuggest); + +my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest %s%s%s%s (0x%08X)", + (fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS) ? "channels, ":"", + (fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC) ? "samples/sec, ":"", + (fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE) ? "bits/sample, ":"", + (fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG) ? "format, ":"", + fdwSuggest); + +my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest for source format = 0x%04X, channels = %d, Samples/s = %d, AvgB/s = %d, BlockAlign = %d, b/sample = %d", + a_FormatSuggest->pwfxSrc->wFormatTag, + a_FormatSuggest->pwfxSrc->nChannels, + a_FormatSuggest->pwfxSrc->nSamplesPerSec, + a_FormatSuggest->pwfxSrc->nAvgBytesPerSec, + a_FormatSuggest->pwfxSrc->nBlockAlign, + a_FormatSuggest->pwfxSrc->wBitsPerSample); + +my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggested destination format = 0x%04X, channels = %d, Samples/s = %d, AvgB/s = %d, BlockAlign = %d, b/sample = %d", + a_FormatSuggest->pwfxDst->wFormatTag, + a_FormatSuggest->pwfxDst->nChannels, + a_FormatSuggest->pwfxDst->nSamplesPerSec, + a_FormatSuggest->pwfxDst->nAvgBytesPerSec, + a_FormatSuggest->pwfxDst->nBlockAlign, + a_FormatSuggest->pwfxDst->wBitsPerSample); + + switch (a_FormatSuggest->pwfxSrc->wFormatTag) + { + case WAVE_FORMAT_PCM: + /// \todo handle here the decoding ? + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest for PCM source"); + // + // if the destination format tag is restricted, verify that + // it is within our capabilities... + // + // this driver is able to decode to PCM + // + if (ACM_FORMATSUGGESTF_WFORMATTAG & fdwSuggest) + { + if (PERSONAL_FORMAT != a_FormatSuggest->pwfxDst->wFormatTag) + return (ACMERR_NOTPOSSIBLE); + } + else + { + a_FormatSuggest->pwfxDst->wFormatTag = PERSONAL_FORMAT; + } + + +my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed A"); + // + // if the destination channel count is restricted, verify that + // it is within our capabilities... + // + // this driver is not able to change the number of channels + // + if (ACM_FORMATSUGGESTF_NCHANNELS & fdwSuggest) + { + if (a_FormatSuggest->pwfxSrc->nChannels != a_FormatSuggest->pwfxDst->nChannels) + return (ACMERR_NOTPOSSIBLE); + } + else + { + a_FormatSuggest->pwfxDst->nChannels = a_FormatSuggest->pwfxSrc->nChannels; + } + + if (a_FormatSuggest->pwfxSrc->nChannels != 1 && a_FormatSuggest->pwfxSrc->nChannels != 2) + return MMSYSERR_INVALPARAM; + + +my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed B"); + // + // if the destination samples per second is restricted, verify + // that it is within our capabilities... + // + // this driver is not able to change the sample rate + // + if (ACM_FORMATSUGGESTF_NSAMPLESPERSEC & fdwSuggest) + { + if (a_FormatSuggest->pwfxSrc->nSamplesPerSec != a_FormatSuggest->pwfxDst->nSamplesPerSec) + return (ACMERR_NOTPOSSIBLE); + } + else + { + a_FormatSuggest->pwfxDst->nSamplesPerSec = a_FormatSuggest->pwfxSrc->nSamplesPerSec; + } + + +my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed C"); + // + // if the destination bits per sample is restricted, verify + // that it is within our capabilities... + // + // We prefer decoding to 16-bit PCM. + // + if (ACM_FORMATSUGGESTF_WBITSPERSAMPLE & fdwSuggest) + { + if ( (16 != a_FormatSuggest->pwfxDst->wBitsPerSample) && (8 != a_FormatSuggest->pwfxDst->wBitsPerSample) ) + return (ACMERR_NOTPOSSIBLE); + } + else + { + a_FormatSuggest->pwfxDst->wBitsPerSample = 16; + } + + // a_FormatSuggest->pwfxDst->nBlockAlign = FORMAT_BLOCK_ALIGN; + a_FormatSuggest->pwfxDst->nBlockAlign = a_FormatSuggest->pwfxDst->nChannels * a_FormatSuggest->pwfxDst->wBitsPerSample / 8; + + a_FormatSuggest->pwfxDst->nAvgBytesPerSec = a_FormatSuggest->pwfxDst->nChannels * 64000 / 8; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed"); + Result = MMSYSERR_NOERROR; + + + break; + case PERSONAL_FORMAT: + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest for PERSONAL source"); + // + // if the destination format tag is restricted, verify that + // it is within our capabilities... + // + // this driver is able to decode to PCM + // + if (ACM_FORMATSUGGESTF_WFORMATTAG & fdwSuggest) + { + if (WAVE_FORMAT_PCM != a_FormatSuggest->pwfxDst->wFormatTag) + return (ACMERR_NOTPOSSIBLE); + } + else + { + a_FormatSuggest->pwfxDst->wFormatTag = WAVE_FORMAT_PCM; + } + + + // + // if the destination channel count is restricted, verify that + // it is within our capabilities... + // + // this driver is not able to change the number of channels + // + if (ACM_FORMATSUGGESTF_NCHANNELS & fdwSuggest) + { + if (a_FormatSuggest->pwfxSrc->nChannels != a_FormatSuggest->pwfxDst->nChannels) + return (ACMERR_NOTPOSSIBLE); + } + else + { + a_FormatSuggest->pwfxDst->nChannels = a_FormatSuggest->pwfxSrc->nChannels; + } + + + // + // if the destination samples per second is restricted, verify + // that it is within our capabilities... + // + // this driver is not able to change the sample rate + // + if (ACM_FORMATSUGGESTF_NSAMPLESPERSEC & fdwSuggest) + { + if (a_FormatSuggest->pwfxSrc->nSamplesPerSec != a_FormatSuggest->pwfxDst->nSamplesPerSec) + return (ACMERR_NOTPOSSIBLE); + } + else + { + a_FormatSuggest->pwfxDst->nSamplesPerSec = a_FormatSuggest->pwfxSrc->nSamplesPerSec; + } + + + // + // if the destination bits per sample is restricted, verify + // that it is within our capabilities... + // + // We prefer decoding to 16-bit PCM. + // + if (ACM_FORMATSUGGESTF_WBITSPERSAMPLE & fdwSuggest) + { + if ( (16 != a_FormatSuggest->pwfxDst->wBitsPerSample) && (8 != a_FormatSuggest->pwfxDst->wBitsPerSample) ) + return (ACMERR_NOTPOSSIBLE); + } + else + { + a_FormatSuggest->pwfxDst->wBitsPerSample = 16; + } + + // a_FormatSuggest->pwfxDst->nBlockAlign = FORMAT_BLOCK_ALIGN; + a_FormatSuggest->pwfxDst->nBlockAlign = a_FormatSuggest->pwfxDst->nChannels * a_FormatSuggest->pwfxDst->wBitsPerSample / 8; + + /// \todo this value must be a correct one ! + a_FormatSuggest->pwfxDst->nAvgBytesPerSec = a_FormatSuggest->pwfxDst->nSamplesPerSec * a_FormatSuggest->pwfxDst->nChannels * a_FormatSuggest->pwfxDst->wBitsPerSample / 8; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed"); + Result = MMSYSERR_NOERROR; + + + break; + } + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggested destination format = 0x%04X, channels = %d, Samples/s = %d, AvgB/s = %d, BlockAlign = %d, b/sample = %d", + a_FormatSuggest->pwfxDst->wFormatTag, + a_FormatSuggest->pwfxDst->nChannels, + a_FormatSuggest->pwfxDst->nSamplesPerSec, + a_FormatSuggest->pwfxDst->nAvgBytesPerSec, + a_FormatSuggest->pwfxDst->nBlockAlign, + a_FormatSuggest->pwfxDst->wBitsPerSample); + + return Result; +} + +/*! + Create a stream instance for decoding/encoding + + \param a_StreamInstance contain information about the stream desired +*/ +inline DWORD ACM::OnStreamOpen(LPACMDRVSTREAMINSTANCE a_StreamInstance) +{ + DWORD Result = ACMERR_NOTPOSSIBLE; + + // + // the most important condition to check before doing anything else + // is that this ACM driver can actually perform the conversion we are + // being opened for. this check should fail as quickly as possible + // if the conversion is not possible by this driver. + // + // it is VERY important to fail quickly so the ACM can attempt to + // find a driver that is suitable for the conversion. also note that + // the ACM may call this driver several times with slightly different + // format specifications before giving up. + // + // this driver first verifies that the source and destination formats + // are acceptable... + // + switch (a_StreamInstance->pwfxSrc->wFormatTag) + { + case WAVE_FORMAT_PCM: + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PCM source (%05d samples %d channels %d bits/sample)",a_StreamInstance->pwfxSrc->nSamplesPerSec,a_StreamInstance->pwfxSrc->nChannels,a_StreamInstance->pwfxSrc->wBitsPerSample); + if (a_StreamInstance->pwfxDst->wFormatTag == PERSONAL_FORMAT) + { + unsigned int OutputFrequency; + + /// \todo Smart mode + if (my_EncodingProperties.GetSmartOutputMode()) + OutputFrequency = ACMStream::GetOutputSampleRate(a_StreamInstance->pwfxSrc->nSamplesPerSec,a_StreamInstance->pwfxDst->nAvgBytesPerSec,a_StreamInstance->pwfxDst->nChannels); + else + OutputFrequency = a_StreamInstance->pwfxSrc->nSamplesPerSec; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PERSONAL output (%05d samples %d channels %d bits/sample %d kbps)",a_StreamInstance->pwfxDst->nSamplesPerSec,a_StreamInstance->pwfxDst->nChannels,a_StreamInstance->pwfxDst->wBitsPerSample,8 * a_StreamInstance->pwfxDst->nAvgBytesPerSec); + + /// \todo add the possibility to have channel resampling (mono to stereo / stereo to mono) + /// \todo support resampling ? + /// \todo only do the test on OutputFrequency in "Smart Output" mode + if (a_StreamInstance->pwfxDst->nSamplesPerSec != OutputFrequency || +// a_StreamInstance->pwfxSrc->nSamplesPerSec != a_StreamInstance->pwfxDst->nSamplesPerSec || + a_StreamInstance->pwfxSrc->nChannels != a_StreamInstance->pwfxDst->nChannels || + a_StreamInstance->pwfxSrc->wBitsPerSample != 16) + { + Result = ACMERR_NOTPOSSIBLE; + } else { + if ((a_StreamInstance->fdwOpen & ACM_STREAMOPENF_QUERY) == 0) + { + ACMStream * the_stream = ACMStream::Create(); + a_StreamInstance->dwInstance = (DWORD) the_stream; + + if (the_stream != NULL) + { + MPEGLAYER3WAVEFORMAT * casted = (MPEGLAYER3WAVEFORMAT *) a_StreamInstance->pwfxDst; + vbr_mode a_mode = (casted->fdwFlags-2 == 0)?vbr_abr:vbr_off; + if (the_stream->init(a_StreamInstance->pwfxDst->nSamplesPerSec, + OutputFrequency, + a_StreamInstance->pwfxDst->nChannels, + a_StreamInstance->pwfxDst->nAvgBytesPerSec, + a_mode)) + Result = MMSYSERR_NOERROR; + else + ACMStream::Erase( the_stream ); + } + } + else + { + Result = MMSYSERR_NOERROR; + } + } + } + break; + case PERSONAL_FORMAT: + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PERSONAL source (%05d samples %d channels %d bits/sample %d kbps)",a_StreamInstance->pwfxSrc->nSamplesPerSec,a_StreamInstance->pwfxSrc->nChannels,a_StreamInstance->pwfxSrc->wBitsPerSample,8 * a_StreamInstance->pwfxSrc->nAvgBytesPerSec); + if (a_StreamInstance->pwfxDst->wFormatTag == WAVE_FORMAT_PCM) + { +#ifdef ENABLE_DECODING + if ((a_StreamInstance->fdwOpen & ACM_STREAMOPENF_QUERY) == 0) + { + /// \todo create the decoding stream + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PCM output (%05d samples %d channels %d bits/sample %d B/s)",a_StreamInstance->pwfxDst->nSamplesPerSec,a_StreamInstance->pwfxDst->nChannels,a_StreamInstance->pwfxDst->wBitsPerSample,a_StreamInstance->pwfxDst->nAvgBytesPerSec); + + DecodeStream * the_stream = DecodeStream::Create(); + a_StreamInstance->dwInstance = (DWORD) the_stream; + + if (the_stream != NULL) + { + if (the_stream->init(a_StreamInstance->pwfxDst->nSamplesPerSec, + a_StreamInstance->pwfxDst->nChannels, + a_StreamInstance->pwfxDst->nAvgBytesPerSec, + a_StreamInstance->pwfxSrc->nAvgBytesPerSec)) + Result = MMSYSERR_NOERROR; + else + DecodeStream::Erase( the_stream ); + } + } + else + { + /// \todo decoding verification + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream is valid"); + Result = MMSYSERR_NOERROR; + } +#endif // ENABLE_DECODING + } + break; + } + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream Result = %d",Result); + return Result; +} + +inline DWORD ACM::OnStreamSize(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMSIZE the_StreamSize) +{ + DWORD Result = ACMERR_NOTPOSSIBLE; + + switch (ACM_STREAMSIZEF_QUERYMASK & the_StreamSize->fdwSize) + { + case ACM_STREAMSIZEF_DESTINATION: + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Get source buffer size for destination size = %d",the_StreamSize->cbDstLength); + break; + case ACM_STREAMSIZEF_SOURCE: + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Get destination buffer size for source size = %d",the_StreamSize->cbSrcLength); + if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && + PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) + { + ACMStream * the_stream = (ACMStream *) a_StreamInstance->dwInstance; + if (the_stream != NULL) + { + the_StreamSize->cbDstLength = the_stream->GetOutputSizeForInput(the_StreamSize->cbSrcLength); + Result = MMSYSERR_NOERROR; + } + } + else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && + WAVE_FORMAT_PCM== a_StreamInstance->pwfxDst->wFormatTag) + { +#ifdef ENABLE_DECODING + DecodeStream * the_stream = (DecodeStream *) a_StreamInstance->dwInstance; + if (the_stream != NULL) + { + the_StreamSize->cbDstLength = the_stream->GetOutputSizeForInput(the_StreamSize->cbSrcLength); + Result = MMSYSERR_NOERROR; + } +#endif // ENABLE_DECODING + } + break; + default: + Result = MMSYSERR_INVALFLAG; + break; + } + + return Result; +} + +inline DWORD ACM::OnStreamClose(LPACMDRVSTREAMINSTANCE a_StreamInstance) +{ + DWORD Result = ACMERR_NOTPOSSIBLE; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamClose the stream 0x%X",a_StreamInstance->dwInstance); + if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && + PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) + { + ACMStream::Erase( (ACMStream *) a_StreamInstance->dwInstance ); + } + else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && + WAVE_FORMAT_PCM== a_StreamInstance->pwfxDst->wFormatTag) + { +#ifdef ENABLE_DECODING + DecodeStream::Erase( (DecodeStream *) a_StreamInstance->dwInstance ); +#endif // ENABLE_DECODING + } + + // nothing to do yet + Result = MMSYSERR_NOERROR; + + return Result; +} + +inline DWORD ACM::OnStreamPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader) +{ + DWORD Result = ACMERR_NOTPOSSIBLE; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, " prepare : Src : %d (0x%08X) / %d - Dst : %d (0x%08X) / %d" + , a_StreamHeader->cbSrcLength + , a_StreamHeader->pbSrc + , a_StreamHeader->cbSrcLengthUsed + , a_StreamHeader->cbDstLength + , a_StreamHeader->pbDst + , a_StreamHeader->cbDstLengthUsed + ); + + if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && + PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) + { + ACMStream * the_stream = (ACMStream *)a_StreamInstance->dwInstance; + + if (the_stream->open(my_EncodingProperties)) + Result = MMSYSERR_NOERROR; + } + else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && + WAVE_FORMAT_PCM == a_StreamInstance->pwfxDst->wFormatTag) + { +#ifdef ENABLE_DECODING + DecodeStream * the_stream = (DecodeStream *)a_StreamInstance->dwInstance; + + if (the_stream->open()) + Result = MMSYSERR_NOERROR; +#endif // ENABLE_DECODING + } + + return Result; +} + +inline DWORD ACM::OnStreamUnPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader) +{ + DWORD Result = ACMERR_NOTPOSSIBLE; + + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "unprepare : Src : %d / %d - Dst : %d / %d" + , a_StreamHeader->cbSrcLength + , a_StreamHeader->cbSrcLengthUsed + , a_StreamHeader->cbDstLength + , a_StreamHeader->cbDstLengthUsed + ); + if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && + PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) + { + ACMStream * the_stream = (ACMStream *)a_StreamInstance->dwInstance; + DWORD OutputSize = a_StreamHeader->cbDstLength; + + if (the_stream->close(a_StreamHeader->pbDst, &OutputSize) && (OutputSize <= a_StreamHeader->cbDstLength)) + { + a_StreamHeader->cbDstLengthUsed = OutputSize; + Result = MMSYSERR_NOERROR; + } + } + else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && + WAVE_FORMAT_PCM== a_StreamInstance->pwfxDst->wFormatTag) + { +#ifdef ENABLE_DECODING + DecodeStream * the_stream = (DecodeStream *)a_StreamInstance->dwInstance; + DWORD OutputSize = a_StreamHeader->cbDstLength; + + if (the_stream->close(a_StreamHeader->pbDst, &OutputSize) && (OutputSize <= a_StreamHeader->cbDstLength)) + { + a_StreamHeader->cbDstLengthUsed = OutputSize; + Result = MMSYSERR_NOERROR; + } +#endif // ENABLE_DECODING + } + + return Result; +} + +inline DWORD ACM::OnStreamConvert(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMHEADER a_StreamHeader) +{ + DWORD Result = ACMERR_NOTPOSSIBLE; + + if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && + PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) + { + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamConvert SRC = PCM (encode)"); + + ACMStream * the_stream = (ACMStream *) a_StreamInstance->dwInstance; + if (the_stream != NULL) + { + if (the_stream->ConvertBuffer( a_StreamHeader )) + Result = MMSYSERR_NOERROR; + } + } + else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && + WAVE_FORMAT_PCM == a_StreamInstance->pwfxDst->wFormatTag) + { + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamConvert SRC = MP3 (decode)"); + +#ifdef ENABLE_DECODING + DecodeStream * the_stream = (DecodeStream *) a_StreamInstance->dwInstance; + if (the_stream != NULL) + { + if (the_stream->ConvertBuffer( a_StreamHeader )) + Result = MMSYSERR_NOERROR; + } +#endif // ENABLE_DECODING + } + else + my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamConvert unsupported conversion"); + + return Result; +} + + +void ACM::GetMP3FormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const +{ + int Block_size; + char temp[ACMFORMATDETAILS_FORMAT_CHARS]; + + + if (the_Index < bitrate_table.size()) + { + // the_Format.wBitsPerSample = 16; + the_Format.wBitsPerSample = 0; + + /// \todo handle more channel modes (mono, stereo, joint-stereo, dual-channel) + // the_Format.nChannels = SIZE_CHANNEL_MODE - int(the_Index % SIZE_CHANNEL_MODE); + + the_Format.nBlockAlign = 1; + + the_Format.nSamplesPerSec = bitrate_table[the_Index].frequency; + the_Format.nAvgBytesPerSec = bitrate_table[the_Index].bitrate * 1000 / 8; + if (bitrate_table[the_Index].frequency >= mpeg1_freq[SIZE_FREQ_MPEG1-1]) + Block_size = 1152; + else + Block_size = 576; + + the_Format.nChannels = bitrate_table[the_Index].channels; + + the_Format.cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX); + MPEGLAYER3WAVEFORMAT * tmpFormat = (MPEGLAYER3WAVEFORMAT *) &the_Format; + tmpFormat->wID = 1; + // this is the only way I found to know if we do CBR or ABR + tmpFormat->fdwFlags = 2 + ((bitrate_table[the_Index].mode == vbr_abr)?0:2); + tmpFormat->nBlockSize = Block_size * the_Format.nAvgBytesPerSec / the_Format.nSamplesPerSec; + tmpFormat->nFramesPerBlock = 1; + tmpFormat->nCodecDelay = 0; // 0x0571 on FHG + + /// \todo : generate the string with the appropriate stereo mode + if (bitrate_table[the_Index].mode == vbr_abr) + wsprintfA( temp, "%d Hz, %d kbps ABR, %s", the_Format.nSamplesPerSec, the_Format.nAvgBytesPerSec * 8 / 1000, (the_Format.nChannels == 1)?"Mono":"Stereo"); + else + wsprintfA( temp, "%d Hz, %d kbps CBR, %s", the_Format.nSamplesPerSec, the_Format.nAvgBytesPerSec * 8 / 1000, (the_Format.nChannels == 1)?"Mono":"Stereo"); + + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, temp, -1, the_String, ACMFORMATDETAILS_FORMAT_CHARS); + } + } + +void ACM::GetPCMFormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const +{ + the_Format.nChannels = SIZE_CHANNEL_MODE - int(the_Index % SIZE_CHANNEL_MODE); + the_Format.wBitsPerSample = 16; + the_Format.nBlockAlign = the_Format.nChannels * the_Format.wBitsPerSample / 8; + + + DWORD a_Channel_Independent = the_Index / SIZE_CHANNEL_MODE; + + // first MPEG1 frequencies + if (a_Channel_Independent < SIZE_FREQ_MPEG1) + { + the_Format.nSamplesPerSec = mpeg1_freq[a_Channel_Independent]; + } + else + { + a_Channel_Independent -= SIZE_FREQ_MPEG1; + the_Format.nSamplesPerSec = mpeg2_freq[a_Channel_Independent]; + } + + the_Format.nAvgBytesPerSec = the_Format.nSamplesPerSec * the_Format.nChannels * the_Format.wBitsPerSample / 8; +} + +DWORD ACM::GetNumberEncodingFormats() const +{ + return bitrate_table.size(); +} + +bool ACM::IsSmartOutput(const int frequency, const int bitrate, const int channels) const +{ + double compression_ratio = double(frequency * 2 * channels) / double(bitrate * 100); + +//my_debug.OutPut(DEBUG_LEVEL_FUNC_DEBUG, "compression_ratio %f, freq %d, bitrate %d, channels %d", compression_ratio, frequency, bitrate, channels); + + if(my_EncodingProperties.GetSmartOutputMode()) + return (compression_ratio <= my_EncodingProperties.GetSmartRatio()); + else return true; +} + +void ACM::BuildBitrateTable() +{ + my_debug.OutPut("entering BuildBitrateTable"); + + // fill the table + unsigned int channel,bitrate,freq; + + bitrate_table.clear(); + + // CBR bitrates + for (channel = 0;channel < SIZE_CHANNEL_MODE;channel++) + { + // MPEG I + for (freq = 0;freq < SIZE_FREQ_MPEG1;freq++) + { + for (bitrate = 0;bitrate < SIZE_BITRATE_MPEG1;bitrate++) + { + + if (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg1_freq[freq], mpeg1_bitrate[bitrate], channel+1)) + { + bitrate_item * bitrate_table_tmp = new bitrate_item; + if (bitrate_table_tmp == NULL) + return; + + bitrate_table_tmp->frequency = mpeg1_freq[freq]; + bitrate_table_tmp->bitrate = mpeg1_bitrate[bitrate]; + bitrate_table_tmp->channels = channel+1; + bitrate_table_tmp->mode = vbr_off; + bitrate_table.push_back(*bitrate_table_tmp); + } + } + } + // MPEG II / II.5 + for (freq = 0;freq < SIZE_FREQ_MPEG2;freq++) + { + for (bitrate = 0;bitrate < SIZE_BITRATE_MPEG2;bitrate++) + { + if (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg2_freq[freq], mpeg2_bitrate[bitrate], channel+1)) + { + bitrate_item * bitrate_table_tmp = new bitrate_item; + if (bitrate_table_tmp == NULL) + return; + + bitrate_table_tmp->frequency = mpeg2_freq[freq]; + bitrate_table_tmp->bitrate = mpeg2_bitrate[bitrate]; + bitrate_table_tmp->channels = channel+1; + bitrate_table_tmp->mode = vbr_abr; + bitrate_table.push_back(*bitrate_table_tmp); + } + } + } + } + + if (my_EncodingProperties.GetAbrOutputMode()) + // ABR bitrates + { + for (channel = 0;channel < SIZE_CHANNEL_MODE;channel++) + { + // MPEG I + for (freq = 0;freq < SIZE_FREQ_MPEG1;freq++) + { + for (bitrate = my_EncodingProperties.GetAbrBitrateMax(); + bitrate >= my_EncodingProperties.GetAbrBitrateMin(); + bitrate -= my_EncodingProperties.GetAbrBitrateStep()) + { + if (bitrate >= mpeg1_bitrate[SIZE_BITRATE_MPEG1-1] && (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg1_freq[freq], bitrate, channel+1))) + { + bitrate_item * bitrate_table_tmp = new bitrate_item; + if (bitrate_table_tmp == NULL) + return; + + bitrate_table_tmp->frequency = mpeg1_freq[freq]; + bitrate_table_tmp->bitrate = bitrate; + bitrate_table_tmp->channels = channel+1; + bitrate_table_tmp->mode = vbr_abr; + bitrate_table.push_back(*bitrate_table_tmp); + } + } + } + // MPEG II / II.5 + for (freq = 0;freq < SIZE_FREQ_MPEG2;freq++) + { + for (bitrate = my_EncodingProperties.GetAbrBitrateMax(); + bitrate >= my_EncodingProperties.GetAbrBitrateMin(); + bitrate -= my_EncodingProperties.GetAbrBitrateStep()) + { + if (bitrate >= mpeg2_bitrate[SIZE_BITRATE_MPEG2-1] && (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg2_freq[freq], bitrate, channel+1))) + { + bitrate_item * bitrate_table_tmp = new bitrate_item; + if (bitrate_table_tmp == NULL) + return; + + bitrate_table_tmp->frequency = mpeg2_freq[freq]; + bitrate_table_tmp->bitrate = bitrate; + bitrate_table_tmp->channels = channel+1; + bitrate_table_tmp->mode = vbr_abr; + bitrate_table.push_back(*bitrate_table_tmp); + } + } + } + } + } + + // sorting by frequency/bitrate/channel + std::sort(bitrate_table.begin(), bitrate_table.end()); + +/* { + // display test + int i=0; + for (i=0; i<bitrate_table.size();i++) + { + my_debug.OutPut("bitrate_table[%d].frequency = %d",i,bitrate_table[i].frequency); + my_debug.OutPut("bitrate_table[%d].bitrate = %d",i,bitrate_table[i].bitrate); + my_debug.OutPut("bitrate_table[%d].channel = %d",i,bitrate_table[i].channels); + my_debug.OutPut("bitrate_table[%d].ABR = %s\n",i,(bitrate_table[i].mode == vbr_abr)?"ABR":"CBR"); + } + }*/ + + my_debug.OutPut("leaving BuildBitrateTable"); +}
Added: vendor/lame/current/ACM/ACM.h =================================================================== --- vendor/lame/current/ACM/ACM.h (rev 0) +++ vendor/lame/current/ACM/ACM.h 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,100 @@ +/** + * + * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows + * + * Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/*! + \author Steve Lhomme + \version $Id: ACM.h,v 1.7 2002/04/06 14:01:33 robux4 Exp $ +*/ + +#if !defined(_ACM_H__INCLUDED_) +#define _ACM_H__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include <vector> + +#include <windows.h> +#include <mmsystem.h> +#include <mmreg.h> +#include <msacm.h> +#include <msacmdrv.h> + +#include "lame.h" + +#include "ADbg/ADbg.h" + +class AEncodeProperties; + +class bitrate_item { + public: + unsigned int frequency; + unsigned int bitrate; + unsigned int channels; + vbr_mode mode; + + bool operator<(const bitrate_item & bitrate) const; +}; + +class ACM +{ +public: + ACM( HMODULE hModule ); + virtual ~ACM(); + + LONG DriverProcedure(const HDRVR hdrvr, const UINT msg, LONG lParam1, LONG lParam2); + + static const char * GetVersionString(void) {return VersionString;} + +protected: +// inline DWORD Configure( HWND hParentWindow, LPDRVCONFIGINFO pConfig ); + inline DWORD About( HWND hParentWindow ); + + inline DWORD OnDriverDetails(const HDRVR hdrvr, LPACMDRIVERDETAILS a_DriverDetail); + inline DWORD OnFormatTagDetails(LPACMFORMATTAGDETAILS a_FormatTagDetails, const LPARAM a_Query); + inline DWORD OnFormatDetails(LPACMFORMATDETAILS a_FormatDetails, const LPARAM a_Query); + inline DWORD OnFormatSuggest(LPACMDRVFORMATSUGGEST a_FormatSuggest); + inline DWORD OnStreamOpen(LPACMDRVSTREAMINSTANCE a_StreamInstance); + inline DWORD OnStreamClose(LPACMDRVSTREAMINSTANCE a_StreamInstance); + inline DWORD OnStreamSize(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMSIZE the_StreamSize); + inline DWORD OnStreamPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader); + inline DWORD OnStreamUnPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader); + inline DWORD OnStreamConvert(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMHEADER a_StreamHeader); + + void GetMP3FormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const; + void GetPCMFormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const; + DWORD GetNumberEncodingFormats() const; + bool IsSmartOutput(const int frequency, const int bitrate, const int channels) const; + void BuildBitrateTable(); + + HMODULE my_hModule; + HICON my_hIcon; + ADbg my_debug; + AEncodeProperties my_EncodingProperties; + std::vector<bitrate_item> bitrate_table; + + static char VersionString[20]; +}; + +#endif // !defined(_ACM_H__INCLUDED_) +
Added: vendor/lame/current/ACM/ACMStream.cpp =================================================================== --- vendor/lame/current/ACM/ACMStream.cpp (rev 0) +++ vendor/lame/current/ACM/ACMStream.cpp 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,367 @@ +/** + * + * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows + * + * Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/*! + \author Steve Lhomme + \version $Id: ACMStream.cpp,v 1.10 2004/07/11 18:11:39 bouvigne Exp $ +*/ + +#if !defined(STRICT) +#define STRICT +#endif // STRICT + +#include <assert.h> +#include <windows.h> + +#include "adebug.h" + +#include "ACMStream.h" + +// static methods + +ACMStream * ACMStream::Create() +{ + ACMStream * Result; + + Result = new ACMStream; + + return Result; +} + +const bool ACMStream::Erase(const ACMStream * a_ACMStream) +{ + delete a_ACMStream; + return true; +} + +// class methods + +ACMStream::ACMStream() : + m_WorkingBufferUseSize(0), + gfp(NULL) +{ + /// \todo get the debug level from the registry +my_debug = new ADbg(DEBUG_LEVEL_CREATION); + if (my_debug != NULL) { + unsigned char DebugFileName[512]; + + my_debug->setPrefix("LAMEstream"); /// \todo get it from the registry +my_debug->setIncludeTime(true); /// \todo get it from the registry + +// Check in the registry if we have to Output Debug information +DebugFileName[0] = '\0'; + + HKEY OssKey; + if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\MUKOLI", 0, KEY_READ , &OssKey ) == ERROR_SUCCESS) { + DWORD DataType; + DWORD DebugFileNameSize = 512; + if (RegQueryValueEx( OssKey, "DebugFile", NULL, &DataType, DebugFileName, &DebugFileNameSize ) == ERROR_SUCCESS) { + if (DataType == REG_SZ) { + my_debug->setUseFile(true); + my_debug->setDebugFile((char *)DebugFileName); + my_debug->OutPut("Debug file is %s",(char *)DebugFileName); + } + } + } + my_debug->OutPut(DEBUG_LEVEL_FUNC_START, "ACMStream Creation (0X%08X)",this); + } + else { + ADbg debug; + debug.OutPut("ACMStream::ACMACMStream : Impossible to create my_debug"); + } + +} + +ACMStream::~ACMStream() +{ + // release memory - encoding is finished + if (gfp) lame_close( gfp ); + + if (my_debug != NULL) + { + my_debug->OutPut(DEBUG_LEVEL_FUNC_START, "ACMStream Deletion (0X%08X)",this); + delete my_debug; + } +} + +bool ACMStream::init(const int nSamplesPerSec, const int nOutputSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const vbr_mode mode) +{ + bool bResult = false; + + my_SamplesPerSec = nSamplesPerSec; + my_OutBytesPerSec = nOutputSamplesPerSec; + my_Channels = nChannels; + my_AvgBytesPerSec = nAvgBytesPerSec; + my_VBRMode = mode; + + bResult = true; + + return bResult; + +} + +bool ACMStream::open(const AEncodeProperties & the_Properties) +{ + bool bResult = false; + + // Init the MP3 Stream + // Init the global flags structure + gfp = lame_init(); + + // Set input sample frequency + lame_set_in_samplerate( gfp, my_SamplesPerSec ); + + // Set output sample frequency + lame_set_out_samplerate( gfp, my_OutBytesPerSec ); + + lame_set_num_channels( gfp, my_Channels ); + if (my_Channels == 1) + lame_set_mode( gfp, MONO ); + else + lame_set_mode( gfp, (MPEG_mode_e)the_Properties.GetChannelModeValue()) ; /// \todo Get the mode from the default configuration + +// lame_set_VBR( gfp, vbr_off ); /// \note VBR not supported for the moment + lame_set_VBR( gfp, my_VBRMode ); /// \note VBR not supported for the moment + + if (my_VBRMode == vbr_abr) + { + lame_set_VBR_q( gfp, 1 ); + + lame_set_VBR_mean_bitrate_kbps( gfp, (my_AvgBytesPerSec * 8 + 500) / 1000 ); + + if (24000 > lame_get_in_samplerate( gfp )) + { + // For MPEG-II + lame_set_VBR_min_bitrate_kbps( gfp, 8); + + lame_set_VBR_max_bitrate_kbps( gfp, 160); + } + else + { + // For MPEG-I + lame_set_VBR_min_bitrate_kbps( gfp, 32); + + lame_set_VBR_max_bitrate_kbps( gfp, 320); + } + } + + // Set bitrate + lame_set_brate( gfp, my_AvgBytesPerSec * 8 / 1000 ); + + /// \todo Get the mode from the default configuration + // Set copyright flag? + lame_set_copyright( gfp, the_Properties.GetCopyrightMode()?1:0 ); + // Do we have to tag it as non original + lame_set_original( gfp, the_Properties.GetOriginalMode()?1:0 ); + // Add CRC? + lame_set_error_protection( gfp, the_Properties.GetCRCMode()?1:0 ); + // Set private bit? + lame_set_extension( gfp, the_Properties.GetPrivateMode()?1:0 ); + // INFO tag support not possible in ACM - it requires rewinding + // output stream to the beginning after encoding is finished. + lame_set_bWriteVbrTag( gfp, 0 ); + + if (0 == lame_init_params( gfp )) + { + //LAME encoding call will accept any number of samples. + if ( 0 == lame_get_version( gfp ) ) + { + // For MPEG-II, only 576 samples per frame per channel + my_SamplesPerBlock = 576 * lame_get_num_channels( gfp ); + } + else + { + // For MPEG-I, 1152 samples per frame per channel + my_SamplesPerBlock = 1152 * lame_get_num_channels( gfp ); + } + } + + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "version =%d",lame_get_version( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Layer =3"); + switch ( lame_get_mode( gfp ) ) + { + case STEREO: my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "mode =Stereo" ); break; + case JOINT_STEREO: my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "mode =Joint-Stereo" ); break; + case DUAL_CHANNEL: my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "mode =Forced Stereo" ); break; + case MONO: my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "mode =Mono" ); break; + case NOT_SET: /* FALLTROUGH */ + default: my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "mode =Error (unknown)" ); break; + } + + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "sampling frequency =%.1f kHz", lame_get_in_samplerate( gfp ) /1000.0 ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "bitrate =%d kbps", lame_get_brate( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Vbr Min bitrate =%d kbps", lame_get_VBR_min_bitrate_kbps( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Vbr Max bitrate =%d kbps", lame_get_VBR_max_bitrate_kbps( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Quality Setting =%d", lame_get_quality( gfp ) ); + + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Low pass frequency =%d", lame_get_lowpassfreq( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Low pass width =%d", lame_get_lowpasswidth( gfp ) ); + + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "High pass frequency =%d", lame_get_highpassfreq( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "High pass width =%d", lame_get_highpasswidth( gfp ) ); + + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "No Short Blocks =%d", lame_get_no_short_blocks( gfp ) ); + + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "de-emphasis =%d", lame_get_emphasis( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "private flag =%d", lame_get_extension( gfp ) ); + + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "copyright flag =%d", lame_get_copyright( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "original flag =%d", lame_get_original( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "CRC =%s", lame_get_error_protection( gfp ) ? "on" : "off" ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Fast mode =%s", ( lame_get_quality( gfp ) )? "enabled" : "disabled" ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Force mid/side stereo =%s", ( lame_get_force_ms( gfp ) )?"enabled":"disabled" ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Padding Type =%d", lame_get_padding_type( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Disable Resorvoir =%d", lame_get_disable_reservoir( gfp ) ); + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "VBR =%s, VBR_q =%d, VBR method =", + ( lame_get_VBR( gfp ) !=vbr_off ) ? "enabled": "disabled", + lame_get_VBR_q( gfp ) ); + + switch ( lame_get_VBR( gfp ) ) + { + case vbr_off: my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "vbr_off" ); break; + case vbr_mt : my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "vbr_mt" ); break; + case vbr_rh : my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "vbr_rh" ); break; + case vbr_mtrh: my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "vbr_mtrh" ); break; + case vbr_abr: + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "vbr_abr (average bitrate %d kbps)", lame_get_VBR_mean_bitrate_kbps( gfp ) ); + break; + default: + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "error, unknown VBR setting"); + break; + } + + my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "Write VBR Header =%s\n", ( lame_get_bWriteVbrTag( gfp ) ) ?"Yes":"No"); + +#ifdef FROM_DLL +beConfig.format.LHV1.dwReSampleRate = my_OutBytesPerSec; // force the user resampling +#endif // FROM_DLL + + bResult = true; + + return bResult; +} + +bool ACMStream::close(LPBYTE pOutputBuffer, DWORD *pOutputSize) +{ + +bool bResult = false; + + int nOutputSamples = 0; + + nOutputSamples = lame_encode_flush( gfp, pOutputBuffer, 0 ); + + if ( nOutputSamples < 0 ) + { + // BUFFER_TOO_SMALL +*pOutputSize = 0; + } + else +{ + *pOutputSize = nOutputSamples; + + bResult = true; + } + + // lame will be closed in destructor + //lame_close( gfp ); + + return bResult; +} + +DWORD ACMStream::GetOutputSizeForInput(const DWORD the_SrcLength) const +{ +/* double OutputInputRatio; + + if (my_VBRMode == vbr_off) + OutputInputRatio = double(my_AvgBytesPerSec) / double(my_OutBytesPerSec * 2); + else // reserve the space for 320 kbps + OutputInputRatio = 40000.0 / double(my_OutBytesPerSec * 2); + + OutputInputRatio *= 1.15; // allow 15% more*/ + + DWORD Result; + +// Result = DWORD(double(the_SrcLength) * OutputInputRatio); + Result = DWORD(1.25*the_SrcLength + 7200); + +my_debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "Result = %d",Result); + + return Result; +} + +bool ACMStream::ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader) +{ + bool result; + +if (my_debug != NULL) +{ +my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "enter ACMStream::ConvertBuffer"); +} + + DWORD InSize = a_StreamHeader->cbSrcLength / 2, OutSize = a_StreamHeader->cbDstLength; // 2 for 8<->16 bits + +// Encode it +int dwSamples; + int nOutputSamples = 0; + + dwSamples = InSize / lame_get_num_channels( gfp ); + + if ( 1 == lame_get_num_channels( gfp ) ) + { + nOutputSamples = lame_encode_buffer(gfp,(PSHORT)a_StreamHeader->pbSrc,(PSHORT)a_StreamHeader->pbSrc,dwSamples,a_StreamHeader->pbDst,a_StreamHeader->cbDstLength); + } + else + { + nOutputSamples = lame_encode_buffer_interleaved(gfp,(PSHORT)a_StreamHeader->pbSrc,dwSamples,a_StreamHeader->pbDst,a_StreamHeader->cbDstLength); + } + + a_StreamHeader->cbSrcLengthUsed = a_StreamHeader->cbSrcLength; + a_StreamHeader->cbDstLengthUsed = nOutputSamples; + + result = a_StreamHeader->cbDstLengthUsed <= a_StreamHeader->cbDstLength; + + my_debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "UsedSize = %d / EncodedSize = %d, result = %d (%d <= %d)", InSize, OutSize, result, a_StreamHeader->cbDstLengthUsed, a_StreamHeader->cbDstLength); + +if (my_debug != NULL) +{ +my_debug->OutPut(DEBUG_LEVEL_FUNC_DEBUG, "ACMStream::ConvertBuffer result = %d (0x%02X 0x%02X)",result,a_StreamHeader->pbDst[0],a_StreamHeader->pbDst[1]); +} + + return result; +} + +unsigned int ACMStream::GetOutputSampleRate(int samples_per_sec, int bitrate, int channels) +{ + if (bitrate==0) + bitrate = (64000*channels)/8; + + /// \todo pass through the same LAME routine + unsigned int OutputFrequency; + double compression_ratio = double(samples_per_sec * 16 * channels / (bitrate * 8)); + if (compression_ratio > 13.) + OutputFrequency = map2MP3Frequency( (10. * bitrate * 8) / (16 * channels)); + else + OutputFrequency = map2MP3Frequency( 0.97 * samples_per_sec ); + + return OutputFrequency; +} +
Added: vendor/lame/current/ACM/ACMStream.h =================================================================== --- vendor/lame/current/ACM/ACMStream.h (rev 0) +++ vendor/lame/current/ACM/ACMStream.h 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,83 @@ +/** + * + * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows + * + * Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/*! + \author Steve Lhomme + \version $Id: ACMStream.h,v 1.4 2002/04/06 14:01:33 robux4 Exp $ +*/ + +#if !defined(_ACMSTREAM_H__INCLUDED_) +#define _ACMSTREAM_H__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include <mmreg.h> +#include <msacm.h> +#include <msacmdrv.h> + +#include "ADbg/ADbg.h" + +#include <config.h> +#include "util.h" + +#include "AEncodeProperties.h" + +class ACMStream +{ +public: + ACMStream( ); + virtual ~ACMStream( ); + + static ACMStream * Create(); + static const bool Erase(const ACMStream * a_ACMStream); + + bool init(const int nSamplesPerSec, const int nOutputSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const vbr_mode mode); + bool open(const AEncodeProperties & the_Properties); + bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize); + + DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const; + bool ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader); + + static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels); + +protected: + lame_global_flags * gfp; + + ADbg * my_debug; + int my_SamplesPerSec; + int my_Channels; + int my_AvgBytesPerSec; + int my_OutBytesPerSec; + vbr_mode my_VBRMode; + DWORD my_SamplesPerBlock; + +unsigned int m_WorkingBufferUseSize; + char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock + +inline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const; + +}; + +#endif // !defined(_ACMSTREAM_H__INCLUDED_) +
Added: vendor/lame/current/ACM/ADbg/ADbg.cpp =================================================================== --- vendor/lame/current/ACM/ADbg/ADbg.cpp (rev 0) +++ vendor/lame/current/ACM/ADbg/ADbg.cpp 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,181 @@ +/************************************************************************ +Project : C++ debugging class +File version : 0.4 + +BSD License post 1999 : + +Copyright (c) 2001, Steve Lhomme +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +- The name of the author may not be used to endorse or promote products derived +from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +OF SUCH DAMAGE. +************************************************************************/ + +#include <stdio.h> +#include <stdarg.h> +#include <windows.h> + +#include "ADbg.h" + +#if !defined(NDEBUG) + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +ADbg::ADbg(int level) +:my_level(level) +,my_time_included(false) +,my_use_file(false) +,my_debug_output(true) +,hFile(NULL) +{ + prefix[0] = '\0'; + OutPut(-1,"ADbg Creation at debug level = %d (0x%08X)",my_level,this); +} + +ADbg::~ADbg() +{ + unsetDebugFile(); + OutPut(-1,"ADbg Deletion (0x%08X)",this); +} + +inline int ADbg::_OutPut(const char * format,va_list params) const +{ + int result; + + char tst[1000]; + char myformat[256]; + + if (my_time_included) { + SYSTEMTIME time; + GetSystemTime(&time); + if (prefix[0] == '\0') + wsprintf(myformat,"%04d/%02d/%02d %02d:%02d:%02d.%03d UTC : %s\r\n", + time.wYear, + time.wMonth, + time.wDay, + time.wHour, + time.wMinute, + time.wSecond, + time.wMilliseconds, + format); + else + wsprintf(myformat,"%04d/%02d/%02d %02d:%02d:%02d.%03d UTC : %s - %s\r\n", + time.wYear, + time.wMonth, + time.wDay, + time.wHour, + time.wMinute, + time.wSecond, + time.wMilliseconds, + prefix, + format); + } else { + if (prefix[0] == '\0') + wsprintf( myformat, "%s\r\n", format); + else + wsprintf( myformat, "%s - %s\r\n", prefix, format); + } + + result = vsprintf(tst,myformat,params); + + if (my_debug_output) + OutputDebugString(tst); + + if (my_use_file && (hFile != NULL)) { + SetFilePointer( hFile, 0, 0, FILE_END ); + DWORD written; + WriteFile( hFile, tst, lstrlen(tst), &written, NULL ); + } + + return result; +} + +int ADbg::OutPut(int forLevel, const char * format,...) const +{ + int result=0; + + if (forLevel >= my_level) { + va_list tstlist; + int result; + + va_start(tstlist, format); + + result = _OutPut(format,tstlist); + + } + + return result; +} + +int ADbg::OutPut(const char * format,...) const +{ + va_list tstlist; + + va_start(tstlist, format); + + return _OutPut(format,tstlist); +} + +bool ADbg::setDebugFile(const char * NewFilename) { + bool result; + result = unsetDebugFile(); + + if (result) { + result = false; + + hFile = CreateFile(NewFilename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); + + if (hFile != INVALID_HANDLE_VALUE) { + SetFilePointer( hFile, 0, 0, FILE_END ); + + result = true; + + OutPut(-1,"Debug file Opening succeeded"); + + } + else + OutPut(-1,"Debug file %s Opening failed",NewFilename); + } + + return result; +} + +bool ADbg::unsetDebugFile() { + bool result = (hFile == NULL); + + if (hFile != NULL) { + result = (CloseHandle(hFile) != 0); + + if (result) { + OutPut(-1,"Debug file Closing succeeded"); + hFile = NULL; + } + } + + return result; +} + +#endif // !defined(NDEBUG)
Added: vendor/lame/current/ACM/ADbg/ADbg.dsp =================================================================== --- vendor/lame/current/ACM/ADbg/ADbg.dsp (rev 0) +++ vendor/lame/current/ACM/ADbg/ADbg.dsp 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="ADbg" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=ADbg - 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 "ADbg.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 "ADbg.mak" CFG="ADbg - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ADbg - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "ADbg - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ADbg - 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 Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE RSC /l 0x40c +# ADD RSC /l 0x40c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "ADbg - 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 Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE RSC /l 0x40c +# ADD RSC /l 0x40c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "ADbg - Win32 Release" +# Name "ADbg - Win32 Debug" +# Begin Group "Sources" + +# PROP Default_Filter "cpp" +# Begin Source File + +SOURCE=.\ADbg.cpp +# End Source File +# End Group +# Begin Group "Headers" + +# PROP Default_Filter "h" +# Begin Source File + +SOURCE=.\ADbg.h +# End Source File +# End Group +# End Target +# End Project
Added: vendor/lame/current/ACM/ADbg/ADbg.h =================================================================== --- vendor/lame/current/ACM/ADbg/ADbg.h (rev 0) +++ vendor/lame/current/ACM/ADbg/ADbg.h 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,133 @@ +/************************************************************************ +Project : C++ debugging class +File version : 0.4 + +BSD License post 1999 : + +Copyright (c) 2001, Steve Lhomme +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +- The name of the author may not be used to endorse or promote products derived +from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +OF SUCH DAMAGE. +************************************************************************/ + +#if !defined(_DBG_H__INCLUDED_) +#define _DBG_H__INCLUDED_ + +#include <windows.h> + +static const int MAX_PREFIX_LENGTH = 128; + +#if !defined(NDEBUG) +// define the working debugging class + +class ADbg +{ +public: + ADbg(int level = 0); + virtual ~ADbg(); + + /// \todo make an inline function to test the level first and the process + int OutPut(int level, const char * format,...) const; + + int OutPut(const char * format,...) const; + + inline int setLevel(const int level) { + return my_level = level; + } + + inline bool setIncludeTime(const bool included = true) { + return my_time_included = included; + } + + bool setDebugFile(const char * NewFilename); + bool unsetDebugFile(); + + inline bool setUseFile(const bool usefile = true) { + return my_use_file = usefile; + } + + inline const char * setPrefix(const char * string) { + return strncpy(prefix, string, MAX_PREFIX_LENGTH); + } + +private: + int my_level; + bool my_time_included; + bool my_use_file; + bool my_debug_output; + + int _OutPut(const char * format,va_list params) const; + + char prefix[MAX_PREFIX_LENGTH]; + + HANDLE hFile; +}; + +#else // !defined(NDEBUG) + +// define a class that does nothing (no output) + +class ADbg +{ +public: + ADbg(int level = 0){} + virtual ~ADbg() {} + + inline int OutPut(int level, const char * format,...) const { + return 0; + } + + inline int OutPut(const char * format,...) const { + return 0; + } + + inline int setLevel(const int level) { + return level; + } + + inline bool setIncludeTime(const bool included = true) { + return true; + } + + inline bool setDebugFile(const char * NewFilename) { + return true; + } + + inline bool unsetDebugFile() { + return true; + } + + inline bool setUseFile(const bool usefile = true) { + return true; + } + + inline const char * setPrefix(const char * string) { + return string; + } +}; + +#endif // !defined(NDEBUG) + +#endif // !defined(_DBG_H__INCLUDED_)
Added: vendor/lame/current/ACM/ADbg/ADbg_vc7.vcproj =================================================================== --- vendor/lame/current/ACM/ADbg/ADbg_vc7.vcproj (rev 0) +++ vendor/lame/current/ACM/ADbg/ADbg_vc7.vcproj 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,465 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="ADbg" + ProjectGUID="{4A9EBEED-ACCA-4548-B10A-90524B1CFCD1}" + SccProjectName="" + SccLocalPath=""> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + RuntimeLibrary="5" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Debug/ADbg.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="TRUE" + DebugInformationFormat="1"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile=".\Debug\ADbg.lib" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + Culture="1036"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="TRUE" + RuntimeLibrary="4" + EnableFunctionLevelLinking="TRUE" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Release/ADbg.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile=".\Release\ADbg.lib" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + Culture="1036"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="LAME debug|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + RuntimeLibrary="5" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Debug/ADbg.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="TRUE" + DebugInformationFormat="1"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile=".\Debug\ADbg.lib" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + Culture="1036"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="LAME release|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + RuntimeLibrary="5" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Debug/ADbg.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="TRUE" + DebugInformationFormat="1"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile=".\Debug\ADbg.lib" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + Culture="1036"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="LAME release Nasm|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="TRUE" + RuntimeLibrary="4" + EnableFunctionLevelLinking="TRUE" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Release/ADbg.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile=".\Release\ADbg.lib" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + Culture="1036"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="dll debug|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + RuntimeLibrary="5" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Debug/ADbg.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="TRUE" + DebugInformationFormat="1"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile=".\Debug\ADbg.lib" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + Culture="1036"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="dll release|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + RuntimeLibrary="5" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Debug/ADbg.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="TRUE" + DebugInformationFormat="1"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile=".\Debug\ADbg.lib" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + Culture="1036"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="dll release Nasm|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="TRUE" + RuntimeLibrary="4" + EnableFunctionLevelLinking="TRUE" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Release/ADbg.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile=".\Release\ADbg.lib" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + Culture="1036"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Sources" + Filter="cpp"> + <File + RelativePath="ADbg.cpp"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions=""/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + PreprocessorDefinitions=""/> + </FileConfiguration> + <FileConfiguration + Name="LAME debug|Win32"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions=""/> + </FileConfiguration> + <FileConfiguration + Name="LAME release|Win32"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions=""/> + </FileConfiguration> + <FileConfiguration + Name="LAME release Nasm|Win32"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + PreprocessorDefinitions=""/> + </FileConfiguration> + <FileConfiguration + Name="dll debug|Win32"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions=""/> + </FileConfiguration> + <FileConfiguration + Name="dll release|Win32"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions=""/> + </FileConfiguration> + <FileConfiguration + Name="dll release Nasm|Win32"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + PreprocessorDefinitions=""/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Headers" + Filter="h"> + <File + RelativePath="ADbg.h"> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject>
Added: vendor/lame/current/ACM/ADbg/Makefile.am =================================================================== --- vendor/lame/current/ACM/ADbg/Makefile.am (rev 0) +++ vendor/lame/current/ACM/ADbg/Makefile.am 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,10 @@ +## $Id: Makefile.am,v 1.2 2005/08/21 17:32:08 bouvigne Exp $ + +include $(top_srcdir)/Makefile.am.global + +EXTRA_DIST = \ + ADbg.cpp \ + ADbg.dsp \ + ADbg_vc7.vcproj \ + ADbg.h +
Added: vendor/lame/current/ACM/ADbg/Makefile.in =================================================================== --- vendor/lame/current/ACM/ADbg/Makefile.in (rev 0) +++ vendor/lame/current/ACM/ADbg/Makefile.in 2008-02-22 16:56:27 UTC (rev 9482) @@ -0,0 +1,353 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# global section for every Makefile.am +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.am.global +subdir = ACM/ADbg +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIG_DEFS = @CONFIG_DEFS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPUTYPE = @CPUTYPE@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FRONTEND_CFLAGS = @FRONTEND_CFLAGS@ +FRONTEND_LDADD = @FRONTEND_LDADD@ +FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +HAVE_NASM_FALSE = @HAVE_NASM_FALSE@ +HAVE_NASM_TRUE = @HAVE_NASM_TRUE@ +INCLUDES = @INCLUDES@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDADD = @LDADD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@ +LIB_MINOR_VERSION = @LIB_MINOR_VERSION@ +LIB_WITH_DECODER_FALSE = @LIB_WITH_DECODER_FALSE@ +LIB_WITH_DECODER_TRUE = @LIB_WITH_DECODER_TRUE@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEDEP = @MAKEDEP@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +NASM_FORMAT = @NASM_FORMAT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +RM_F = @RM_F@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +VERSION = @VERSION@ +WITH_BRHIST_FALSE = @WITH_BRHIST_FALSE@ +WITH_BRHIST_TRUE = @WITH_BRHIST_TRUE@ +WITH_FRONTEND = @WITH_FRONTEND@ +WITH_MP3RTP = @WITH_MP3RTP@ +WITH_MP3X = @WITH_MP3X@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = 1.5 foreign $(top_srcdir)/ansi2knr +EXTRA_DIST = \ + ADbg.cpp \ + ADbg.dsp \ + ADbg_vc7.vcproj \ + ADbg.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ACM/ADbg/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign ACM/ADbg/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/../.. + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.