ref: be1c1ef422e6e4989c87a494f620b620ce743e1e
parent: 038bd167b0e06eee85c388163a19086794e8f791
author: menno <menno>
date: Fri Oct 11 14:02:08 EDT 2002
Updated cooledit filter
binary files /dev/null b/plugins/cooledit/AudioCoding.bmp differ
--- a/plugins/cooledit/CRegistry.cpp
+++ b/plugins/cooledit/CRegistry.cpp
@@ -1,5 +1,5 @@
/*
-FAAD - codec plugin for Cooledit
+FAAC - codec plugin for Cooledit
Copyright (C) 2002 Antonio Foranna
This program is free software; you can redistribute it and/or modify
@@ -16,7 +16,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author can be contacted at:
-kreel@interfree.it
+kreel@tiscali.it
*/
//#include "stdafx.h"
@@ -25,6 +25,12 @@
#include <memory.h>
#include "CRegistry.h"
+
+
+// *****************************************************************************
+
+
+
CRegistry::CRegistry()
{
regKey=NULL;
@@ -33,20 +39,22 @@
CRegistry::~CRegistry()
{
- if(regKey)
- RegCloseKey(regKey);
- if(path)
- free(path);
+ closeReg();
}
+
+
+
// *****************************************************************************
-// *****************************************************************************
-// *****************************************************************************
+
+
#define setPath(SubKey) \
if(path) \
free(path); \
path=strdup(SubKey);
+// -----------------------------------------------------------------------------------------------
+
BOOL CRegistry::openReg(HKEY hKey, char *SubKey)
{
if(regKey)
@@ -63,7 +71,7 @@
return FALSE;
}
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
BOOL CRegistry::openCreateReg(HKEY hKey, char *SubKey)
{
@@ -91,7 +99,7 @@
}
}
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
void CRegistry::closeReg()
{
@@ -102,15 +110,18 @@
delete path;
path=NULL;
}
+
+
+
// *****************************************************************************
-// *****************************************************************************
-// *****************************************************************************
+
+
void CRegistry::DeleteRegVal(char *SubKey)
{
RegDeleteValue(regKey,SubKey);
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
void CRegistry::DeleteRegKey(char *SubKey)
{
@@ -117,10 +128,12 @@
RegDeleteKey(regKey,SubKey);
}
+
+
// *****************************************************************************
-// *****************************************************************************
-// *****************************************************************************
+
+
void CRegistry::setRegBool(char *keyStr , BOOL val)
{
BOOL tempVal;
@@ -129,8 +142,18 @@
tempVal!=val)
RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(BOOL));
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
+void CRegistry::setRegBool(char *keyStr , bool val)
+{
+bool tempVal;
+DWORD len;
+ if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
+ tempVal!=val)
+ RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(bool));
+}
+// -----------------------------------------------------------------------------------------------
+
void CRegistry::setRegByte(char *keyStr , BYTE val)
{
DWORD t=val;
@@ -140,7 +163,7 @@
tempVal!=val)
RegSetValueEx(regKey , keyStr , NULL , REG_DWORD , (BYTE *)&t , sizeof(DWORD));
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
void CRegistry::setRegWord(char *keyStr , WORD val)
{
@@ -151,7 +174,7 @@
tempVal!=val)
RegSetValueEx(regKey , keyStr , NULL , REG_DWORD , (BYTE *)&t , sizeof(DWORD));
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
void CRegistry::setRegDword(char *keyStr , DWORD val)
{
@@ -161,7 +184,7 @@
tempVal!=val)
RegSetValueEx(regKey , keyStr , NULL , REG_DWORD , (BYTE *)&val , sizeof(DWORD));
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
void CRegistry::setRegFloat(char *keyStr , float val)
{
@@ -171,7 +194,7 @@
tempVal!=val)
RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(float));
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
void CRegistry::setRegStr(char *keyStr , char *valStr)
{
@@ -193,7 +216,7 @@
delete tempVal;
}
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
void CRegistry::setRegValN(char *keyStr , BYTE *addr, DWORD size)
{
@@ -217,8 +240,6 @@
// *****************************************************************************
-// *****************************************************************************
-// *****************************************************************************
@@ -234,8 +255,22 @@
}
return tempVal;
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
+bool CRegistry::getSetRegBool(char *keyStr, bool val)
+{
+bool tempVal;
+DWORD len=sizeof(bool);
+
+ if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
+ {
+ RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(bool));
+ return val;
+ }
+ return tempVal;
+}
+// -----------------------------------------------------------------------------------------------
+
BYTE CRegistry::getSetRegByte(char *keyStr, BYTE val)
{
DWORD tempVal;
@@ -249,7 +284,7 @@
}
return (BYTE)tempVal;
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
WORD CRegistry::getSetRegWord(char *keyStr, WORD val)
{
@@ -264,7 +299,7 @@
}
return (WORD)tempVal;
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
DWORD CRegistry::getSetRegDword(char *keyStr, DWORD val)
{
@@ -278,7 +313,7 @@
}
return (DWORD)tempVal;
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
float CRegistry::getSetRegFloat(char *keyStr, float val)
{
@@ -292,7 +327,7 @@
}
return tempVal;
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
int CRegistry::getSetRegStr(char *keyStr, char *tempString, char *dest, int maxLen)
{
@@ -311,7 +346,7 @@
}
return tempLen;
}
-// *****************************************************************************
+// -----------------------------------------------------------------------------------------------
int CRegistry::getSetRegValN(char *keyStr, BYTE *tempAddr, BYTE *addr, DWORD size)
{
--- a/plugins/cooledit/CRegistry.h
+++ b/plugins/cooledit/CRegistry.h
@@ -14,6 +14,7 @@
void DeleteRegKey(char *SubKey);
void setRegBool(char *keyStr , BOOL val);
+ void setRegBool(char *keyStr , bool val);
void setRegByte(char *keyStr , BYTE val);
void setRegWord(char *keyStr , WORD val);
void setRegDword(char *keyStr , DWORD val);
@@ -22,6 +23,7 @@
void setRegValN(char *keyStr , BYTE *addr, DWORD size);
BOOL getSetRegBool(char *keyStr, BOOL var);
+ bool getSetRegBool(char *keyStr, bool var);
BYTE getSetRegByte(char *keyStr, BYTE var);
WORD getSetRegWord(char *keyStr, WORD var);
DWORD getSetRegDword(char *keyStr, DWORD var);
binary files /dev/null b/plugins/cooledit/Email.bmp differ
--- a/plugins/cooledit/FAAC.def
+++ b/plugins/cooledit/FAAC.def
@@ -12,5 +12,7 @@
FilterGetFileSize
FilterOptionsString
FilterGetOptions
- GetSuggestedSampleType @16
+ GetSuggestedSampleType
DIALOGMsgProc
+ FilterOptions
+ FilterSetOptions
--- a/plugins/cooledit/FAAC.dsp
+++ b/plugins/cooledit/FAAC.dsp
@@ -125,7 +125,7 @@
# End Source File
# Begin Source File
-SOURCE=.\defines.h
+SOURCE=.\Defines.h
# End Source File
# Begin Source File
@@ -137,16 +137,36 @@
# End Source File
# Begin Source File
-SOURCE=.\FILTERS.H
+SOURCE=.\Filters.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
+# Begin Source File
+
+SOURCE=.\Structs.h
+# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\AudioCoding.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Email.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Mail.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=".\mpeg4ip-v.bmp"
+# End Source File
# End Group
# End Target
# End Project
--- a/plugins/cooledit/FAAC.rc
+++ b/plugins/cooledit/FAAC.rc
@@ -26,11 +26,14 @@
// Dialog
//
-IDD_COMPRESSION DIALOG DISCARDABLE 0, 0, 184, 126
+IDD_ENCODER DIALOG DISCARDABLE 0, 0, 184, 126
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "MPEG4-AAC options"
FONT 8, "MS Sans Serif"
BEGIN
+ DEFPUSHBUTTON "&OK",IDOK,72,107,36,14
+ PUSHBUTTON "&Cancel",IDCANCEL,108,107,36,14
+ PUSHBUTTON "&About",IDC_BTN_ABOUT,144,107,36,14
CONTROL "Automatic configuration",IDC_CHK_AUTOCFG,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,4,4,90,10
CONTROL "MPEG4",IDC_RADIO_MPEG4,"Button",BS_AUTORADIOBUTTON |
@@ -49,19 +52,16 @@
WS_GROUP,59,29,42,10
CONTROL "ADTS",IDC_RADIO_ADTS,"Button",BS_AUTORADIOBUTTON,59,42,
41,9
- CONTROL "Allow Mid/Side",IDC_ALLOWMIDSIDE,"Button",
+ CONTROL "Allow Mid/Side",IDC_CHK_ALLOWMIDSIDE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,108,21,63,10
- CONTROL "Use TNS",IDC_USETNS,"Button",BS_AUTOCHECKBOX |
+ CONTROL "Use TNS",IDC_CHK_USETNS,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,108,33,45,10
- CONTROL "Use LFE channel",IDC_USELFE,"Button",BS_AUTOCHECKBOX |
- WS_DISABLED | WS_TABSTOP,108,46,67,10
+ CONTROL "Use LFE channel",IDC_CHK_USELFE,"Button",
+ BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,108,46,67,10
COMBOBOX IDC_CB_BITRATE,132,68,48,30,CBS_DROPDOWN | WS_VSCROLL |
WS_TABSTOP
COMBOBOX IDC_CB_BANDWIDTH,132,85,48,30,CBS_DROPDOWN | WS_VSCROLL |
WS_TABSTOP
- DEFPUSHBUTTON "OK",IDOK,72,107,36,14
- PUSHBUTTON "Cancel",IDCANCEL,108,107,36,14
- PUSHBUTTON "About",IDC_BTN_ABOUT,144,107,36,14
GROUPBOX "AAC type",IDC_STATIC,4,18,48,38
GROUPBOX "Profile",IDC_STATIC,4,62,48,59
LTEXT "Bitrate per channel",IDC_STATIC,59,73,60,8
@@ -69,7 +69,26 @@
GROUPBOX "Header",IDC_STATIC,55,18,48,38
END
+IDD_DECODER DIALOG DISCARDABLE 0, 0, 114, 76
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "MPEG4-AAC options"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "&OK",IDOK,70,25,36,14
+ PUSHBUTTON "&Cancel",IDCANCEL,70,40,36,14
+ PUSHBUTTON "&About",IDC_BTN_ABOUT,70,55,36,14
+ CONTROL "Main",IDC_RADIO_MAIN,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP,15,17,31,10
+ CONTROL "Low",IDC_RADIO_LOW,"Button",BS_AUTORADIOBUTTON,15,30,29,
+ 10
+ CONTROL "SSR",IDC_RADIO_SSR,"Button",BS_AUTORADIOBUTTON |
+ WS_DISABLED,15,41,31,10
+ CONTROL "LTP",IDC_RADIO_LTP,"Button",BS_AUTORADIOBUTTON,15,54,29,
+ 10
+ GROUPBOX "Profile",IDC_STATIC,7,7,48,62
+END
+
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
@@ -104,7 +123,7 @@
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
- IDD_COMPRESSION, DIALOG
+ IDD_ENCODER, DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 180
@@ -111,10 +130,79 @@
TOPMARGIN, 4
BOTTOMMARGIN, 121
END
+
+ IDD_DECODER, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 106
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 69
+ END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Italian (Italy) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
+#ifdef _WIN32
+LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUT DIALOG DISCARDABLE 0, 0, 191, 230
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION
+CAPTION "About"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "&OK",IDOK,134,208,50,14
+ CONTROL 104,IDC_AUDIOCODING,"Static",SS_BITMAP | SS_NOTIFY |
+ SS_SUNKEN,7,7,178,69
+ CONTROL 107,IDC_MPEG4IP,"Static",SS_BITMAP | SS_NOTIFY |
+ SS_SUNKEN,7,203,59,19
+ CONTROL 106,IDC_EMAIL,"Static",SS_BITMAP | SS_NOTIFY,77,204,43,
+ 18
+ LTEXT "Static",IDC_L_ABOUT,7,55,177,142
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_ABOUT, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 184
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 222
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDB_AUDIOCODING BITMAP DISCARDABLE "AudioCoding.bmp"
+IDB_EMAIL BITMAP DISCARDABLE "Email.bmp"
+IDB_MPEG4IP BITMAP DISCARDABLE "mpeg4ip-v.bmp"
+#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
--- /dev/null
+++ b/plugins/cooledit/FAAC.sln
@@ -1,0 +1,49 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FAAC", "FAAC.vcproj", "{088ABC53-EDEB-47C6-BF78-9A633054EA09}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aacInfoLib", "aacInfoLib.vcproj", "{C9F1F5AE-902D-4B87-B149-8DDB40074227}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaac", "..\..\libfaac\libfaac.vcproj", "{1BC93B83-B0D7-4A08-9461-0BCABB8A6E73}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "..\..\..\faad2\libfaad\libfaad.vcproj", "{F8F02EFC-27F1-4ED8-AD33-51BC1CB5EDAF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp4v2_st", "..\..\..\faad2\common\mp4v2\libmp4v2_st60.vcproj", "{95F5A44D-E9E4-4612-91D4-E9AF16542F62}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ {088ABC53-EDEB-47C6-BF78-9A633054EA09}.0 = {C9F1F5AE-902D-4B87-B149-8DDB40074227}
+ {088ABC53-EDEB-47C6-BF78-9A633054EA09}.1 = {95F5A44D-E9E4-4612-91D4-E9AF16542F62}
+ {088ABC53-EDEB-47C6-BF78-9A633054EA09}.2 = {F8F02EFC-27F1-4ED8-AD33-51BC1CB5EDAF}
+ {088ABC53-EDEB-47C6-BF78-9A633054EA09}.3 = {1BC93B83-B0D7-4A08-9461-0BCABB8A6E73}
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {088ABC53-EDEB-47C6-BF78-9A633054EA09}.Debug.ActiveCfg = Debug|Win32
+ {088ABC53-EDEB-47C6-BF78-9A633054EA09}.Debug.Build.0 = Debug|Win32
+ {088ABC53-EDEB-47C6-BF78-9A633054EA09}.Release.ActiveCfg = Release|Win32
+ {088ABC53-EDEB-47C6-BF78-9A633054EA09}.Release.Build.0 = Release|Win32
+ {C9F1F5AE-902D-4B87-B149-8DDB40074227}.Debug.ActiveCfg = Debug|Win32
+ {C9F1F5AE-902D-4B87-B149-8DDB40074227}.Debug.Build.0 = Debug|Win32
+ {C9F1F5AE-902D-4B87-B149-8DDB40074227}.Release.ActiveCfg = Release|Win32
+ {C9F1F5AE-902D-4B87-B149-8DDB40074227}.Release.Build.0 = Release|Win32
+ {1BC93B83-B0D7-4A08-9461-0BCABB8A6E73}.Debug.ActiveCfg = Debug|Win32
+ {1BC93B83-B0D7-4A08-9461-0BCABB8A6E73}.Debug.Build.0 = Debug|Win32
+ {1BC93B83-B0D7-4A08-9461-0BCABB8A6E73}.Release.ActiveCfg = Release|Win32
+ {1BC93B83-B0D7-4A08-9461-0BCABB8A6E73}.Release.Build.0 = Release|Win32
+ {F8F02EFC-27F1-4ED8-AD33-51BC1CB5EDAF}.Debug.ActiveCfg = Debug|Win32
+ {F8F02EFC-27F1-4ED8-AD33-51BC1CB5EDAF}.Debug.Build.0 = Debug|Win32
+ {F8F02EFC-27F1-4ED8-AD33-51BC1CB5EDAF}.Release.ActiveCfg = Release|Win32
+ {F8F02EFC-27F1-4ED8-AD33-51BC1CB5EDAF}.Release.Build.0 = Release|Win32
+ {95F5A44D-E9E4-4612-91D4-E9AF16542F62}.Debug.ActiveCfg = Debug|Win32
+ {95F5A44D-E9E4-4612-91D4-E9AF16542F62}.Debug.Build.0 = Debug|Win32
+ {95F5A44D-E9E4-4612-91D4-E9AF16542F62}.Release.ActiveCfg = Release|Win32
+ {95F5A44D-E9E4-4612-91D4-E9AF16542F62}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
--- /dev/null
+++ b/plugins/cooledit/FAAC.vcproj
@@ -1,0 +1,198 @@
+<?xml version="1.0" encoding = "Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.00"
+ Name="FAAC"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../faad2/common/faad,../../include,../../../faad2/include,../../../faad2/common/mp4v2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FAAC_EXPORTS"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="5"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/FAAC.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="ws2_32.lib odbc32.lib odbccp32.lib"
+ OutputFile="Debug/FAAC.flt"
+ LinkIncremental="2"
+ SuppressStartupBanner="TRUE"
+ ModuleDefinitionFile=".\FAAC.def"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\Debug/FAAC.pdb"
+ ImportLibrary=".\Debug/FAAC.lib"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="TRUE"
+ SuppressStartupBanner="TRUE"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/FAAC.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1040"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="../../../faad2/common/faad,../../include,../../../faad2/include,../../../faad2/common/mp4v2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FAAC_EXPORTS"
+ StringPooling="TRUE"
+ RuntimeLibrary="4"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/FAAC.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="ws2_32.lib odbc32.lib odbccp32.lib"
+ OutputFile="Release/FAAC.flt"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ ModuleDefinitionFile=".\FAAC.def"
+ ProgramDatabaseFile=".\Release/FAAC.pdb"
+ ImportLibrary=".\Release/FAAC.lib"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="TRUE"
+ SuppressStartupBanner="TRUE"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/FAAC.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1040"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ </Configuration>
+ </Configurations>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath=".\CRegistry.cpp">
+ </File>
+ <File
+ RelativePath=".\FAAC.def">
+ </File>
+ <File
+ RelativePath=".\FAAC.rc">
+ </File>
+ <File
+ RelativePath=".\Faac.cpp">
+ </File>
+ <File
+ RelativePath=".\Faad.cpp">
+ </File>
+ <File
+ RelativePath=".\Main.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath=".\CRegistry.h">
+ </File>
+ <File
+ RelativePath=".\Defines.h">
+ </File>
+ <File
+ RelativePath=".\Filters.h">
+ </File>
+ <File
+ RelativePath=".\Structs.h">
+ </File>
+ <File
+ RelativePath="..\..\include\faac.h">
+ </File>
+ <File
+ RelativePath="..\..\..\faad2\include\faad.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\AudioCoding.bmp">
+ </File>
+ <File
+ RelativePath=".\Email.bmp">
+ </File>
+ <File
+ RelativePath=".\Mail.bmp">
+ </File>
+ <File
+ RelativePath=".\mpeg4ip-v.bmp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- a/plugins/cooledit/Faac.cpp
+++ b/plugins/cooledit/Faac.cpp
@@ -1,5 +1,5 @@
/*
-FAAD - codec plugin for Cooledit
+FAAC - codec plugin for Cooledit
Copyright (C) 2002 Antonio Foranna
This program is free software; you can redistribute it and/or modify
@@ -16,80 +16,94 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author can be contacted at:
-kreel@interfree.it
+kreel@tiscali.it
*/
#include <windows.h>
#include <stdio.h> // FILE *
-#include "filters.h" // CoolEdit
#include "resource.h"
-#include "faac.h"
-#include "faad.h" // FAAD2 version
+#include "filters.h" // CoolEdit
+#include <faac.h>
+#include <faad.h> // FAAD2 version
#include <win32_ver.h> // mpeg4ip version
#include "CRegistry.h"
-#include "defines.h"
+#include "Defines.h" // my defines
+#include "Structs.h" // my structs
// *********************************************************************************************
+extern HINSTANCE hInst;
+
+// -----------------------------------------------------------------------------------------------
+
+extern BOOL DialogMsgProcDecoder(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam);
+extern void ReadCfgDec(MY_DEC_CFG *cfg);
+extern void WriteCfgDec(MY_DEC_CFG *cfg);
+
+// *********************************************************************************************
+
+#define RAW 0
+#define ADTS 1
+
+// *********************************************************************************************
+
typedef struct output_tag // any special vars associated with output file
{
-FILE *fFile;
-DWORD lSize;
-long lSamprate;
-WORD wBitsPerSample;
-WORD wChannels;
-char szNAME[256];
+FILE *aacFile;
+long Samprate;
+WORD BitsPerSample;
+WORD Channels;
+//DWORD src_size;
+//char *dst_name; // name of compressed file
faacEncHandle hEncoder;
unsigned char *bitbuf;
DWORD maxBytesOutput;
long samplesInput;
-BYTE bStopEnc;
} MYOUTPUT;
-
-// -----------------------------------------------------------------------------------------------
-
-typedef struct mc
-{
-bool AutoCfg;
-faacEncConfiguration EncCfg;
-} MYCFG;
-
// *********************************************************************************************
-// *********************************************************************************************
-// *********************************************************************************************
-void RD_Cfg(MYCFG *cfg)
+void ReadCfgEnc(MY_ENC_CFG *cfg)
{
CRegistry reg;
- reg.openCreateReg(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME);
- cfg->AutoCfg=reg.getSetRegDword("Auto",true) ? true : false;
- cfg->EncCfg.mpegVersion=reg.getSetRegDword("MPEG version",MPEG2);
- cfg->EncCfg.aacObjectType=reg.getSetRegDword("Profile",LOW);
- cfg->EncCfg.allowMidside=reg.getSetRegDword("MidSide",true);
- cfg->EncCfg.useTns=reg.getSetRegDword("TNS",true);
- cfg->EncCfg.useLfe=reg.getSetRegDword("LFE",false);
- cfg->EncCfg.bitRate=reg.getSetRegDword("BitRate",128000);
- cfg->EncCfg.bandWidth=reg.getSetRegDword("BandWidth",0);
- cfg->EncCfg.outputFormat=reg.getSetRegDword("Header",1);
+ if(reg.openCreateReg(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME "\\FAAC"))
+ {
+ cfg->AutoCfg=reg.getSetRegBool("Auto",true);
+ cfg->EncCfg.mpegVersion=reg.getSetRegDword("MPEG version",MPEG2);
+ cfg->EncCfg.aacObjectType=reg.getSetRegDword("Profile",LOW);
+ cfg->EncCfg.allowMidside=reg.getSetRegDword("MidSide",true);
+ cfg->EncCfg.useTns=reg.getSetRegDword("TNS",true);
+ cfg->EncCfg.useLfe=reg.getSetRegDword("LFE",false);
+ cfg->EncCfg.bitRate=reg.getSetRegDword("BitRate",0);
+ cfg->EncCfg.bandWidth=reg.getSetRegDword("BandWidth",0);
+ cfg->EncCfg.outputFormat=reg.getSetRegDword("Header",ADTS);
+ }
+ else
+ MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP);
}
+// -----------------------------------------------------------------------------------------------
-void WR_Cfg(MYCFG *cfg)
+void WriteCfgEnc(MY_ENC_CFG *cfg)
{
CRegistry reg;
- reg.openCreateReg(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME);
- reg.setRegDword("Auto",cfg->AutoCfg);
- reg.setRegDword("MPEG version",cfg->EncCfg.mpegVersion);
- reg.setRegDword("Profile",cfg->EncCfg.aacObjectType);
- reg.setRegDword("MidSide",cfg->EncCfg.allowMidside);
- reg.setRegDword("TNS",cfg->EncCfg.useTns);
- reg.setRegDword("LFE",cfg->EncCfg.useLfe);
- reg.setRegDword("BitRate",cfg->EncCfg.bitRate);
- reg.setRegDword("BandWidth",cfg->EncCfg.bandWidth);
- reg.setRegDword("Header",cfg->EncCfg.outputFormat);
+ if(reg.openCreateReg(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME "\\FAAC"))
+ {
+ reg.setRegBool("Auto",cfg->AutoCfg);
+ reg.setRegDword("MPEG version",cfg->EncCfg.mpegVersion);
+ reg.setRegDword("Profile",cfg->EncCfg.aacObjectType);
+ reg.setRegDword("MidSide",cfg->EncCfg.allowMidside);
+ reg.setRegDword("TNS",cfg->EncCfg.useTns);
+ reg.setRegDword("LFE",cfg->EncCfg.useLfe);
+ reg.setRegDword("BitRate",cfg->EncCfg.bitRate);
+ reg.setRegDword("BandWidth",cfg->EncCfg.bandWidth);
+ reg.setRegDword("Header",cfg->EncCfg.outputFormat);
+ }
+ else
+ MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP);
}
+// -----------------------------------------------------------------------------------------------
#define INIT_CB(hWnd,nID,list,IdSelected) \
{ \
@@ -97,6 +111,7 @@
SendMessage(GetDlgItem(hWnd, nID), CB_ADDSTRING, 0, (LPARAM)list[i]); \
SendMessage(GetDlgItem(hWnd, nID), CB_SETCURSEL, IdSelected, 0); \
}
+// -----------------------------------------------------------------------------------------------
#define DISABLE_LTP \
{ \
@@ -108,29 +123,80 @@
} \
EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE); \
}
+// -----------------------------------------------------------------------------------------------
// EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_SSR), Enabled);
-// EnableWindow(GetDlgItem(hWndDlg, IDC_USELFE), Enabled);
+// EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USELFE), Enabled);
#define DISABLE_CTRL(Enabled) \
{ \
- CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, !Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MPEG4), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MPEG2), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MAIN), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LOW), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_RAW), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_ADTS), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BITRATE), Enabled); \
- EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), Enabled); \
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4)) \
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled); \
- else \
- DISABLE_LTP \
+ CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, !Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MPEG4), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MPEG2), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_RAW), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_ADTS), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_ALLOWMIDSIDE), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USETNS), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BITRATE), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MAIN), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LOW), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled); \
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4)) \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled); \
+ else \
+ DISABLE_LTP \
}
+// -----------------------------------------------------------------------------------------------
+BOOL DialogMsgProcAbout(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
+{
+ switch(Message)
+ {
+ case WM_INITDIALOG:
+ {
+ char buf[512];
+ sprintf(buf,
+ APP_NAME " plugin " APP_VER " by Antonio Foranna\n\n"
+ "Engines used:\n"
+ "\tFAAC v%g\n"
+ "\tFAAD2 v" FAAD2_VERSION "\n"
+ "\t" PACKAGE " v" VERSION "\n\n"
+ "This code is given with FAAC package and does not contain executables.\n"
+ "This program is free software and can be distributed/modifyed under the terms of the GNU General Public License.\n"
+ "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.\n\n"
+ "Compiled on %s\n",
+ FAACENC_VERSION,
+ __DATE__
+ );
+ SetDlgItemText(hWndDlg, IDC_L_ABOUT, buf);
+ }
+ break;
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDOK:
+ EndDialog(hWndDlg, 0);
+ break;
+ case IDC_AUDIOCODING:
+ ShellExecute(hWndDlg, NULL, "http://www.audiocoding.com", NULL, NULL, SW_SHOW);
+ break;
+ case IDC_MPEG4IP:
+ ShellExecute(hWndDlg, NULL, "http://www.mpeg4ip.net", NULL, NULL, SW_SHOW);
+ break;
+ case IDC_EMAIL:
+ ShellExecute(hWndDlg, NULL, "mailto:kreel@tiscali.it", NULL, NULL, SW_SHOW);
+ break;
+ }
+ break;
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------------------------------
+
BOOL DIALOGMsgProc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
@@ -140,9 +206,9 @@
char buf[50];
char *BitRate[]={"Auto","8","18","20","24","32","40","48","56","64","96","112","128","160","192","256",0};
char *BandWidth[]={"Auto","Full","4000","8000","16000","22050","24000","48000",0};
- MYCFG cfg;
+ MY_ENC_CFG cfg;
- RD_Cfg(&cfg);
+ ReadCfgEnc(&cfg);
INIT_CB(hWndDlg,IDC_CB_BITRATE,BitRate,0);
INIT_CB(hWndDlg,IDC_CB_BANDWIDTH,BandWidth,0);
@@ -171,17 +237,17 @@
switch(cfg.EncCfg.outputFormat)
{
- case 0:
+ case RAW:
CheckDlgButton(hWndDlg,IDC_RADIO_RAW,TRUE);
break;
- case 1:
+ case ADTS:
CheckDlgButton(hWndDlg,IDC_RADIO_ADTS,TRUE);
break;
}
- CheckDlgButton(hWndDlg, IDC_ALLOWMIDSIDE, cfg.EncCfg.allowMidside);
- CheckDlgButton(hWndDlg, IDC_USETNS, cfg.EncCfg.useTns);
- CheckDlgButton(hWndDlg, IDC_USELFE, cfg.EncCfg.useLfe);
+ CheckDlgButton(hWndDlg, IDC_CHK_ALLOWMIDSIDE, cfg.EncCfg.allowMidside);
+ CheckDlgButton(hWndDlg, IDC_CHK_USETNS, cfg.EncCfg.useTns);
+ CheckDlgButton(hWndDlg, IDC_CHK_USELFE, cfg.EncCfg.useLfe);
switch(cfg.EncCfg.bitRate)
{
case 0:
@@ -214,7 +280,7 @@
case WM_CLOSE:
// Closing the Dialog behaves the same as Cancel
- PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L);
+ PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0);
break; // End of WM_CLOSE
case WM_COMMAND:
@@ -230,8 +296,7 @@
case IDOK:
{
char buf[50];
- HANDLE hCfg=(HANDLE)lParam;
- MYCFG cfg;
+ MY_ENC_CFG cfg;
cfg.AutoCfg=IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG) ? TRUE : FALSE;
cfg.EncCfg.mpegVersion=IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4) ? MPEG4 : MPEG2;
@@ -243,9 +308,9 @@
cfg.EncCfg.aacObjectType=SSR;
if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP))
cfg.EncCfg.aacObjectType=LTP;
- cfg.EncCfg.allowMidside=IsDlgButtonChecked(hWndDlg, IDC_ALLOWMIDSIDE);
- cfg.EncCfg.useTns=IsDlgButtonChecked(hWndDlg, IDC_USETNS);
- cfg.EncCfg.useLfe=IsDlgButtonChecked(hWndDlg, IDC_USELFE);
+ cfg.EncCfg.allowMidside=IsDlgButtonChecked(hWndDlg, IDC_CHK_ALLOWMIDSIDE);
+ cfg.EncCfg.useTns=IsDlgButtonChecked(hWndDlg, IDC_CHK_USETNS);
+ cfg.EncCfg.useLfe=IsDlgButtonChecked(hWndDlg, IDC_CHK_USELFE);
GetDlgItemText(hWndDlg, IDC_CB_BITRATE, buf, 50);
switch(*buf)
@@ -254,7 +319,7 @@
cfg.EncCfg.bitRate=0;
break;
default:
- cfg.EncCfg.bitRate=1000*GetDlgItemInt(hWndDlg, IDC_CB_BITRATE, 0, FALSE);
+ cfg.EncCfg.bitRate=GetDlgItemInt(hWndDlg, IDC_CB_BITRATE, 0, FALSE);
}
GetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, buf, 50);
switch(*buf)
@@ -268,10 +333,11 @@
default:
cfg.EncCfg.bandWidth=GetDlgItemInt(hWndDlg, IDC_CB_BANDWIDTH, 0, FALSE);
}
- cfg.EncCfg.outputFormat=IsDlgButtonChecked(hWndDlg,IDC_RADIO_RAW) ? 0 : 1;
+ cfg.EncCfg.outputFormat=IsDlgButtonChecked(hWndDlg,IDC_RADIO_RAW) ? RAW : ADTS;
- WR_Cfg(&cfg);
- EndDialog(hWndDlg, (DWORD)hCfg);
+ WriteCfgEnc(&cfg);
+
+ EndDialog(hWndDlg, 1);
}
break;
@@ -282,19 +348,7 @@
break;
case IDC_BTN_ABOUT:
- {
- char buf[512];
- sprintf(buf,
- APP_NAME " plugin " APP_VER " by Antonio Foranna\n\n"
- "This plugin uses:\n"
- "\tFAAC v%g and FAAD2 v" FAAD2_VERSION " (.aac files),\n"
- "\t" PACKAGE " v" VERSION " (.mp4 files).\n\n"
- "Compiled on %s\n",
- FAACENC_VERSION,
- __DATE__
- );
- MessageBox(hWndDlg, buf, "About", MB_OK);
- }
+ DialogBox((HINSTANCE)hInst,(LPCSTR)MAKEINTRESOURCE(IDD_ABOUT), (HWND)hWndDlg, (DLGPROC)DialogMsgProcAbout);
break;
case IDC_RADIO_MPEG4:
@@ -304,7 +358,7 @@
case IDC_RADIO_MPEG2:
EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE);
DISABLE_LTP
- break;
+ break;
}
break; // End of WM_COMMAND
default:
@@ -312,23 +366,74 @@
}
return TRUE;
-} // End of DIALOGSMsgProc
+}
+
// *********************************************************************************************
+// *********************************************************************************************
+// *********************************************************************************************
-DWORD FAR PASCAL FilterGetOptions(HWND hWnd, HINSTANCE hInst, long lSamprate, WORD wChannels, WORD wBitsPerSample, DWORD dwOptions) // return 0 if no options box
+#define ERROR_FGO(msg) \
+{ \
+ if(msg) \
+ MessageBox(hWnd, msg, APP_NAME " plugin", MB_OK|MB_ICONSTOP); \
+ return 0; \
+}
+// -----------------------------------------------------------------------------------------------
+
+DWORD FAR PASCAL FilterGetOptions(HWND hWnd, HINSTANCE hInst, long lSamprate, WORD wChannels, WORD wBitsPerSample, DWORD dwOptions)
{
-long nDialogReturn=0;
- nDialogReturn=(long)DialogBoxParam((HINSTANCE)hInst,(LPCSTR)MAKEINTRESOURCE(IDD_COMPRESSION), (HWND)hWnd, (DLGPROC)DIALOGMsgProc, dwOptions);
+CRegistry reg;
+long retVal;
+BOOL OpenDialog=FALSE;
- return nDialogReturn;
+ if(!reg.openCreateReg(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME "\\FAAD"))
+ ERROR_FGO("Can't open registry!")
+ else
+ if(OpenDialog=reg.getSetRegBool("OpenDialog",FALSE))
+ reg.setRegBool("OpenDialog",FALSE);
+
+ if(OpenDialog)
+ {
+ MY_DEC_CFG *Cfg;
+ if(!(Cfg=(MY_DEC_CFG *)malloc(sizeof(MY_DEC_CFG))))
+ ERROR_FGO("Memory allocation error");
+ ReadCfgDec(Cfg);
+ Cfg->DecCfg.defSampleRate=lSamprate;
+ switch(wBitsPerSample)
+ {
+ case 16:
+ Cfg->DecCfg.outputFormat=FAAD_FMT_16BIT;
+ break;
+ case 24:
+ Cfg->DecCfg.outputFormat=FAAD_FMT_24BIT;
+ break;
+ case 32:
+ Cfg->DecCfg.outputFormat=FAAD_FMT_32BIT;
+ break;
+ default:
+ ERROR_FGO("Invalid Bps");
+ }
+ Cfg->Channels=(BYTE)wChannels;
+ retVal=DialogBoxParam((HINSTANCE)hInst,(LPCSTR)MAKEINTRESOURCE(IDD_DECODER), (HWND)hWnd, (DLGPROC)DialogMsgProcDecoder, (DWORD)Cfg);
+ WriteCfgDec(Cfg);
+ FREE(Cfg);
+ }
+ else
+ retVal=DialogBoxParam((HINSTANCE)hInst,(LPCSTR)MAKEINTRESOURCE(IDD_ENCODER), (HWND)hWnd, (DLGPROC)DIALOGMsgProc, dwOptions);
+
+ if(retVal==-1)
+ ERROR_FGO("DialogBoxParam");
+
+ return retVal;
}
// *********************************************************************************************
+// GetSuggestedSampleType() is called if OpenFilterOutput() returns NULL
void FAR PASCAL GetSuggestedSampleType(LONG *lplSamprate, WORD *lpwBitsPerSample, WORD *wChannels)
{
*lplSamprate=0; // don't care
- *lpwBitsPerSample= *lpwBitsPerSample<=24 ? 0: 24;
- *wChannels= *wChannels<=2 ? 0 : 2;
+ *lpwBitsPerSample= *lpwBitsPerSample==16 ? 0: 16;
+ *wChannels= *wChannels<49 ? 0 : 48;
}
// *********************************************************************************************
@@ -339,12 +444,12 @@
MYOUTPUT *mo;
- mo=(MYOUTPUT *)GlobalLock(hOutput);
+ GLOBALLOCK(mo,hOutput,MYOUTPUT,return);
- if(mo->fFile)
+ if(mo->aacFile)
{
- fclose(mo->fFile);
- mo->fFile=0;
+ fclose(mo->aacFile);
+ mo->aacFile=0;
}
if(mo->hEncoder)
@@ -356,6 +461,7 @@
mo->bitbuf=0;
}
+// FREE(mi->dst_name);
GlobalUnlock(hOutput);
GlobalFree(hOutput);
@@ -373,41 +479,39 @@
} \
return 0; \
}
+// -----------------------------------------------------------------------------------------------
HANDLE FAR PASCAL OpenFilterOutput(LPSTR lpstrFilename,long lSamprate,WORD wBitsPerSample,WORD wChannels,long lSize, long far *lpChunkSize, DWORD dwOptions)
{
HANDLE hOutput;
MYOUTPUT *mo;
-MYCFG cfg;
-DWORD maxBytesOutput;
-DWORD samplesInput;
-int bytesEncoded;
-int tmp;
+MY_ENC_CFG cfg;
+DWORD samplesInput,
+ maxBytesOutput;
- hOutput=GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE,sizeof(MYOUTPUT));
- if(!hOutput)
+ if(wBitsPerSample!=16) // FAAC supports 16 bit audio only!
+ return 0;
+
+ if(!(hOutput=GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE|GMEM_ZEROINIT,sizeof(MYOUTPUT))))
ERROR_OFO("Memory allocation error: hOutput");
- mo=(MYOUTPUT *)GlobalLock(hOutput);
- memset(mo,0,sizeof(MYOUTPUT));
+ if(!(mo=(MYOUTPUT *)GlobalLock(hOutput)))
+ ERROR_OFO("GlobalLock(hOutput)");
// open the aac output file
- if(!(mo->fFile=fopen(lpstrFilename, "wb")))
+ if(!(mo->aacFile=fopen(lpstrFilename, "wb")))
ERROR_OFO("Can't create file");
// use bufferized stream
- setvbuf(mo->fFile,NULL,_IOFBF,32767);
+ setvbuf(mo->aacFile,NULL,_IOFBF,32767);
// open the encoder library
if(!(mo->hEncoder=faacEncOpen(lSamprate, wChannels, &samplesInput, &maxBytesOutput)))
- ERROR_OFO("Can't init library");
+ ERROR_OFO("Can't open library");
if(!(mo->bitbuf=(unsigned char*)malloc(maxBytesOutput*sizeof(unsigned char))))
ERROR_OFO("Memory allocation error: output buffer");
- *lpChunkSize=samplesInput*2;
-
-
- RD_Cfg(&cfg);
+ ReadCfgEnc(&cfg);
if(!cfg.AutoCfg)
{
faacEncConfigurationPtr myFormat=&cfg.EncCfg;
@@ -415,6 +519,8 @@
if(!myFormat->bitRate)
myFormat->bitRate=CurFormat->bitRate;
+ else
+ myFormat->bitRate*=1000;
switch(myFormat->bandWidth)
{
@@ -431,25 +537,16 @@
ERROR_OFO("Unsupported parameters");
}
- mo->lSize=lSize;
- mo->lSamprate=lSamprate;
- mo->wBitsPerSample=wBitsPerSample;
- mo->wChannels=wChannels;
- strcpy(mo->szNAME,lpstrFilename);
+ *lpChunkSize=samplesInput*2;
- mo->maxBytesOutput=maxBytesOutput;
+// mo->src_size=lSize;
+ mo->Samprate=lSamprate;
+ mo->BitsPerSample=wBitsPerSample;
+ mo->Channels=wChannels;
mo->samplesInput=samplesInput;
- mo->bStopEnc=0;
+ mo->maxBytesOutput=maxBytesOutput;
+// mi->dst_name=strdup(lpstrFilename);
- // init flushing process
- bytesEncoded=faacEncEncode(mo->hEncoder, 0, 0, mo->bitbuf, maxBytesOutput); // initializes the flushing process
- if(bytesEncoded>0)
- {
- tmp=fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
- if(tmp!=bytesEncoded)
- ERROR_OFO("fwrite");
- }
-
GlobalUnlock(hOutput);
return hOutput;
@@ -461,12 +558,10 @@
if(msg) \
MessageBox(0, msg, APP_NAME " plugin", MB_OK|MB_ICONSTOP); \
if(hOutput) \
- { \
- mo->bStopEnc=1; \
GlobalUnlock(hOutput); \
- } \
return 0; \
}
+// -----------------------------------------------------------------------------------------------
DWORD FAR PASCAL WriteFilterOutput(HANDLE hOutput, unsigned char far *buf, long lBytes)
{
@@ -477,27 +572,24 @@
int bytesEncoded;
MYOUTPUT far *mo;
- mo=(MYOUTPUT far *)GlobalLock(hOutput);
+ GLOBALLOCK(mo,hOutput,MYOUTPUT,return 0);
- if(!mo->bStopEnc) // Is this case possible?
+ // call the actual encoding routine
+ bytesEncoded=faacEncEncode(mo->hEncoder, (short *)buf, mo->samplesInput, mo->bitbuf, mo->maxBytesOutput);
+ if(bytesEncoded<1) // end of flushing process
{
- // call the actual encoding routine
- bytesEncoded=faacEncEncode(mo->hEncoder, (short *)buf, mo->samplesInput, mo->bitbuf, mo->maxBytesOutput);
- if(bytesEncoded<1) // end of flushing process
- {
- if(bytesEncoded<0)
- ERROR_WFO("faacEncEncode");
- bytesWritten=lBytes ? 1 : 0; // bytesWritten==0 stops CoolEdit...
- GlobalUnlock(hOutput);
- return bytesWritten;
- }
+ if(bytesEncoded<0)
+ ERROR_WFO("faacEncEncode");
+ bytesWritten=lBytes ? 1 : 0; // bytesWritten==0 stops CoolEdit. 1 is used when intializing flushing process
+ }
+ else
+ {
// write bitstream to aac file
- bytesWritten=fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
+ bytesWritten=fwrite(mo->bitbuf, 1, bytesEncoded, mo->aacFile);
if(bytesWritten!=bytesEncoded)
ERROR_WFO("fwrite");
-
- GlobalUnlock(hOutput);
}
-
-return bytesWritten;
+
+ GlobalUnlock(hOutput);
+ return bytesWritten;
}
--- a/plugins/cooledit/Faad.cpp
+++ b/plugins/cooledit/Faad.cpp
@@ -1,5 +1,5 @@
/*
-FAAD - codec plugin for Cooledit
+FAAC - codec plugin for Cooledit
Copyright (C) 2002 Antonio Foranna
This program is free software; you can redistribute it and/or modify
@@ -16,67 +16,71 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author can be contacted at:
-kreel@interfree.it
+kreel@tiscali.it
*/
#include <windows.h>
#include <stdio.h> // FILE *
+#include "resource.h"
#include "filters.h" // CoolEdit
-#include "defines.h" // my defines
#include <faac.h>
#include <faad.h>
#include <mp4.h>
-#ifdef __cplusplus
extern "C" {
-#endif
#include <aacinfo.h> // get_AAC_format()
-#ifdef __cplusplus
}
-#endif
+#include "CRegistry.h"
+#include "Defines.h" // my defines
+#include "Structs.h" // my structs
// *********************************************************************************************
-#define MAX_CHANNELS 2
-#define FAAD_STREAMSIZE (FAAD_MIN_STREAMSIZE*MAX_CHANNELS)
+extern HINSTANCE hInst;
// -----------------------------------------------------------------------------------------------
-#define FREE(ptr) \
-{ \
- if(ptr) \
- free(ptr); \
- ptr=0; \
-}
+extern BOOL DialogMsgProcAbout(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam);
// *********************************************************************************************
+#define MAX_CHANNELS 2
+#define FAAD_STREAMSIZE (FAAD_MIN_STREAMSIZE*MAX_CHANNELS)
+#define RAW 0
+#define ADIF 1
+#define ADTS 2
+
+// *********************************************************************************************
+
typedef struct input_tag // any special vars associated with input file
{
+//MP4
+MP4FileHandle mp4File;
+MP4SampleId sampleId,
+ numSamples;
+int track;
+BYTE type;
+
//AAC
FILE *aacFile;
DWORD src_size; // size of compressed file
DWORD tagsize;
DWORD bytes_read; // from file
-DWORD bytes_consumed; // by faadDecDecode
+DWORD bytes_consumed; // from buffer by faadDecDecode
long bytes_into_buffer;
unsigned char *buffer;
-//MP4
-MP4FileHandle mp4File;
-MP4SampleId sampleId,
- numSamples;
-int track;
-BYTE type;
+// Raw AAC
+DWORD bytesconsumed; // to decode current frame by faadDecDecode
// GLOBAL
faacDecHandle hDecoder;
faadAACInfo file_info;
DWORD len_ms; // length of file in milliseconds
-WORD wChannels;
-DWORD dwSamprate;
-WORD wBitsPerSample;
-// char *src_name; // name of compressed file
-DWORD dst_size; // size of decoded file. It's needed to set the length of progress bar
+WORD Channels;
+DWORD Samprate;
+WORD BitsPerSample;
+DWORD dst_size; // size of decoded file. Cooledit needs it to update its progress bar
+//char *src_name; // name of compressed file
bool IsAAC;
} MYINPUT;
// -----------------------------------------------------------------------------------------------
@@ -117,6 +121,7 @@
"Reserved",
"Reserved"
};
+
// *********************************************************************************************
int id3v2_tag(unsigned char *buffer)
@@ -137,24 +142,25 @@
int GetAACTrack(MP4FileHandle infile)
{
- // find AAC track
- int i, rc;
- int numTracks = MP4GetNumberOfTracks(infile, NULL, 0);
+// find AAC track
+int i, rc;
+int numTracks = MP4GetNumberOfTracks(infile, NULL, 0);
for (i = 0; i < numTracks; i++)
{
- MP4TrackId trackId = MP4FindTrackId(infile, i, NULL, 0);
- const char* trackType = MP4GetTrackType(infile, trackId);
+ MP4TrackId trackId = MP4FindTrackId(infile, i, NULL, 0);
+ const char* trackType = MP4GetTrackType(infile, trackId);
if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE))
{
- unsigned char *buff = NULL;
- unsigned __int32 buff_size = 0;
- unsigned char dummy2_8, dummy3_8, dummy4_8, dummy5_8, dummy6_8,
- dummy7_8, dummy8_8;
- unsigned long dummy1_32;
- MP4GetTrackESConfiguration(infile, trackId, (unsigned __int8 **)&buff, &buff_size);
+ unsigned char *buff = NULL;
+ unsigned __int32 buff_size = 0;
+ unsigned char dummy2_8, dummy3_8, dummy4_8, dummy5_8, dummy6_8,
+ dummy7_8, dummy8_8;
+ unsigned long dummy1_32;
+ MP4GetTrackESConfiguration(infile, trackId, (unsigned __int8 **)&buff, &buff_size);
+
if (buff)
{
rc = AudioSpecificConfig(buff, &dummy1_32, &dummy2_8, &dummy3_8, &dummy4_8,
@@ -171,7 +177,124 @@
// can't decode this
return -1;
}
+// *********************************************************************************************
+void ReadCfgDec(MY_DEC_CFG *cfg)
+{
+CRegistry reg;
+
+ if(reg.openCreateReg(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME "\\FAAD"))
+ {
+ cfg->DecCfg.defObjectType=reg.getSetRegByte("Profile",LOW);
+ cfg->DecCfg.defSampleRate=reg.getSetRegDword("SampleRate",44100);
+ cfg->DecCfg.outputFormat=reg.getSetRegByte("Bps",FAAD_FMT_16BIT);
+ cfg->Channels=reg.getSetRegByte("Channels",2);
+ }
+ else
+ MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP);
+}
+// -----------------------------------------------------------------------------------------------
+
+void WriteCfgDec(MY_DEC_CFG *cfg)
+{
+CRegistry reg;
+
+ if(reg.openCreateReg(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME "\\FAAD"))
+ {
+ reg.setRegByte("Profile",cfg->DecCfg.defObjectType);
+ reg.setRegDword("SampleRate",cfg->DecCfg.defSampleRate);
+ reg.setRegByte("Bps",cfg->DecCfg.outputFormat);
+ reg.setRegByte("Channels",cfg->Channels);
+ }
+ else
+ MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP);
+}
+// -----------------------------------------------------------------------------------------------
+
+// EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_SSR), Enabled);
+#define DISABLE_CTRL(Enabled) \
+{ \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_MAIN), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LOW), Enabled); \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled); \
+}
+// -----------------------------------------------------------------------------------------------
+
+static MY_DEC_CFG *CfgDecoder;
+
+BOOL DialogMsgProcDecoder(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
+{
+ switch(Message)
+ {
+ case WM_INITDIALOG:
+ {
+ if(!lParam)
+ {
+ MessageBox(hWndDlg,"Pointer==NULL",0,MB_OK|MB_ICONSTOP);
+ EndDialog(hWndDlg, 0);
+ return TRUE;
+ }
+ CfgDecoder=(MY_DEC_CFG *)lParam;
+
+ switch(CfgDecoder->DecCfg.defObjectType)
+ {
+ case MAIN:
+ CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
+ break;
+ case LOW:
+ CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE);
+ break;
+ case SSR:
+ CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE);
+ break;
+ case LTP:
+ CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE);
+ break;
+ }
+ }
+ break; // End of WM_INITDIALOG
+
+ case WM_CLOSE:
+ // Closing the Dialog behaves the same as Cancel
+ PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0);
+ break; // End of WM_CLOSE
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDOK:
+ {
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MAIN))
+ CfgDecoder->DecCfg.defObjectType=MAIN;
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LOW))
+ CfgDecoder->DecCfg.defObjectType=LOW;
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_SSR))
+ CfgDecoder->DecCfg.defObjectType=SSR;
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP))
+ CfgDecoder->DecCfg.defObjectType=LTP;
+
+ EndDialog(hWndDlg, (DWORD)CfgDecoder);
+ }
+ break;
+
+ case IDCANCEL:
+ // Ignore data values entered into the controls
+ // and dismiss the dialog window returning FALSE
+ EndDialog(hWndDlg, (DWORD)FALSE);
+ break;
+
+ case IDC_BTN_ABOUT:
+ DialogBox((HINSTANCE)hInst,(LPCSTR)MAKEINTRESOURCE(IDD_ABOUT), (HWND)hWndDlg, (DLGPROC)DialogMsgProcAbout);
+ break;
+ }
+ break; // End of WM_COMMAND
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
// *********************************************************************************************
// *********************************************************************************************
// *********************************************************************************************
@@ -190,17 +313,17 @@
long FAR PASCAL FilterGetFileSize(HANDLE hInput)
{
-DWORD dst_size;
+ if(!hInput)
+ return 0;
- if(hInput)
- {
- MYINPUT *mi;
- mi=(MYINPUT *)GlobalLock(hInput);
- dst_size=mi->dst_size;
-
- GlobalUnlock(hInput);
- }
+DWORD dst_size;
+MYINPUT *mi;
+ GLOBALLOCK(mi,hInput,MYINPUT,return 0);
+ dst_size=mi->dst_size;
+
+ GlobalUnlock(hInput);
+
return dst_size;
}
// *********************************************************************************************
@@ -213,32 +336,24 @@
return 0;
}
-char buf[20];
-MYINPUT *mi;
+MYINPUT *mi;
-mi=(MYINPUT *)GlobalLock(hInput);
+ GLOBALLOCK(mi,hInput,MYINPUT,return 0);
- lstrcpy(szString,"");
+ sprintf(szString,"MPEG%d - %lu bps\n", mi->file_info.version, mi->file_info.bitrate);
- if(mi->file_info.version==2)
- lstrcat(szString,"MPEG2 - ");
- else
- lstrcat(szString,"MPEG4 - ");
-
- sprintf(buf,"%lu bps\n",mi->file_info.bitrate);
- lstrcat(szString,buf);
-
if(mi->IsAAC) // AAC file --------------------------------------------------------------------
{
switch(mi->file_info.headertype)
{
- case 0:
- lstrcat(szString,"RAW\n");
- break;
- case 1:
+ case RAW:
+ lstrcpy(szString,"AAC\nRaw");
+ GlobalUnlock(hInput);
+ return 0; // call FilterGetOptions()
+ case ADIF:
lstrcat(szString,"ADIF\n");
break;
- case 2:
+ case ADTS:
lstrcat(szString,"ADTS\n");
break;
}
@@ -263,9 +378,24 @@
lstrcat(szString,mpeg4AudioNames[mi->type]);
GlobalUnlock(hInput);
+ return 1; // don't call FilterGetOptions()
+}
+// *********************************************************************************************
- return 1;
+DWORD FAR PASCAL FilterOptions(HANDLE hInput)
+{
+/*
+ FilterGetOptions() is called if this function and FilterSetOptions() are exported and FilterOptionsString() returns 0
+ FilterSetOptions() is called only if this function is exported and and it returns 0
+*/
+ return 0;
}
+// ---------------------------------------------------------------------------------------------
+
+DWORD FAR PASCAL FilterSetOptions(HANDLE hInput, DWORD dwOptions, LONG lSamprate, WORD wChannels, WORD wBPS)
+{
+ return dwOptions;
+}
// *********************************************************************************************
void FAR PASCAL CloseFilterInput(HANDLE hInput)
@@ -273,10 +403,21 @@
if(!hInput)
return;
-MYINPUT far *mi;
+MYINPUT *mi;
- mi=(MYINPUT far *)GlobalLock(hInput);
+ GLOBALLOCK(mi,hInput,MYINPUT,return);
+// Raw AAC file ----------------------------------------------------------------------------------
+ if(mi->file_info.headertype==RAW)
+ {
+ CRegistry reg;
+
+ if(reg.openCreateReg(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME "\\FAAD"))
+ reg.setRegBool("OpenDialog",FALSE);
+ else
+ MessageBox(0,"Can't open registry!",0,MB_OK|MB_ICONSTOP);
+ }
+
// AAC file --------------------------------------------------------------------------------------
if(mi->aacFile)
fclose(mi->aacFile);
@@ -309,7 +450,9 @@
} \
return 0; \
}
+// -----------------------------------------------------------------------------------------------
+extern DWORD FAR PASCAL ReadFilterInput(HANDLE hInput, unsigned char far *bufout, long lBytes);
// return handle that will be passed in to close, and write routines
HANDLE FAR PASCAL OpenFilterInput(LPSTR lpstrFilename, long far *lSamprate, WORD far *wBitsPerSample, WORD far *wChannels, HWND hWnd, long far *lChunkSize)
{
@@ -319,14 +462,16 @@
DWORD samplerate;
BYTE channels,
BitsPerSample=16;
+DWORD Bitrate4RawAAC=0;
+BYTE Channels4RawAAC=0;
- hInput=GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE|GMEM_ZEROINIT,sizeof(MYINPUT));
- if(!hInput)
+start_point:
+
+ if(!(hInput=GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE|GMEM_ZEROINIT,sizeof(MYINPUT))))
ERROR_OFI("Memory allocation error: hInput");
- mi=(MYINPUT *)GlobalLock(hInput);
- memset(mi,0,sizeof(MYINPUT));
+ if(!(mi=(MYINPUT *)GlobalLock(hInput)))
+ ERROR_OFI("GlobalLock(hInput)");
-
mi->IsAAC=strcmpi(lpstrFilename+lstrlen(lpstrFilename)-4,".aac")==0;
if(!mi->IsAAC) // MP4 file ---------------------------------------------------------------------
@@ -356,7 +501,6 @@
length=MP4GetTrackDuration(mi->mp4File, track);
mi->len_ms=(DWORD)MP4ConvertFromTrackDuration(mi->mp4File, track, length, MP4_MSECS_TIME_SCALE);
-// mi->file_info.bitrate=(int)MP4GetTrackIntegerProperty(mi->mp4File, track, "mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.avgBitrate");
mi->file_info.bitrate=MP4GetTrackBitRate(mi->mp4File, track);
mi->file_info.version=MP4GetTrackAudioType(mi->mp4File, track)==MP4_MPEG4_AUDIO_TYPE ? 4 : 2;
mi->numSamples=MP4GetTrackNumberOfSamples(mi->mp4File, track);
@@ -378,10 +522,9 @@
setvbuf(mi->aacFile,NULL,_IOFBF,32767);
// get size of file
- tmp=ftell(mi->aacFile);
fseek(mi->aacFile, 0, SEEK_END);
mi->src_size=ftell(mi->aacFile);
- fseek(mi->aacFile, tmp, SEEK_SET);
+ fseek(mi->aacFile, 0, SEEK_SET);
if(!(mi->buffer=(BYTE *)malloc(FAAD_STREAMSIZE)))
ERROR_OFI("Memory allocation error");
@@ -429,33 +572,86 @@
mi->tagsize=tagsize;
}
- if(!(mi->hDecoder=faacDecOpen()))
- ERROR_OFI("Can't open library");
-
if(get_AAC_format(lpstrFilename, &mi->file_info, &seek_table, &seek_table_length, 0))
{
FREE(seek_table);
- ERROR_OFI("Error retrieving information form input file");
+ ERROR_OFI("Error retrieving information from input file");
}
FREE(seek_table);
- if(mi->file_info.headertype==0)
- {
- config=faacDecGetCurrentConfiguration(mi->hDecoder);
- config->defObjectType=mi->file_info.object_type;
- config->defSampleRate=mi->file_info.sampling_rate;
- config->outputFormat=FAAD_FMT_16BIT;
- faacDecSetConfiguration(mi->hDecoder, config);
- }
+ if(!(mi->hDecoder=faacDecOpen()))
+ ERROR_OFI("Can't open library");
+ if(mi->file_info.headertype==RAW)
+ if(!*lSamprate && !*wBitsPerSample && !*wChannels)
+ {
+ CRegistry reg;
+
+ if(reg.openCreateReg(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME "\\FAAD"))
+ reg.setRegBool("OpenDialog",TRUE);
+ else
+ ERROR_OFI("Can't open registry!");
+ /*
+ CoolEdit resamples audio if the following code is activated
+ *wBitsPerSample=BitsPerSample;
+ *wChannels=2;
+ *lSamprate=44100;
+ */
+ GlobalUnlock(hInput);
+ return hInput;
+ }
+ else
+ {
+ MY_DEC_CFG Cfg;
+
+ ReadCfgDec(&Cfg);
+ config=faacDecGetCurrentConfiguration(mi->hDecoder);
+ config->defObjectType=Cfg.DecCfg.defObjectType;
+ config->defSampleRate=Cfg.DecCfg.defSampleRate;//*lSamprate; // doesn't work! Why???
+ config->outputFormat=Cfg.DecCfg.outputFormat;
+ faacDecSetConfiguration(mi->hDecoder, config);
+
+ if(Bitrate4RawAAC)
+ mi->file_info.bitrate=Bitrate4RawAAC*Channels4RawAAC;
+ else
+ {
+ DWORD Samples,
+ BytesConsumed;
+
+ if((mi->bytes_consumed=faacDecInit(mi->hDecoder, mi->buffer, &samplerate, &channels)) < 0)
+ ERROR_OFI("Can't init library");
+ mi->bytes_into_buffer-=mi->bytes_consumed;
+ if(!(Samples=ReadFilterInput(hInput,0,0)/sizeof(short)))
+ ERROR_OFI(0);
+ BytesConsumed=mi->bytesconsumed;
+ ReadFilterInput(hInput,0,0);
+ if(BytesConsumed>mi->bytesconsumed)
+ mi->bytesconsumed=BytesConsumed;
+ Bitrate4RawAAC=(mi->bytesconsumed*8*Cfg.DecCfg.defSampleRate)/Samples;
+ if(!Bitrate4RawAAC)
+ Bitrate4RawAAC=1000; // try to continue decoding
+ Channels4RawAAC=(BYTE)mi->Channels;
+ if(!Channels4RawAAC)
+ ERROR_OFI("Channels reported by decoder: 0");
+ if(Channels4RawAAC!=Cfg.Channels)
+ {
+ char buf[256]="";
+ sprintf(buf,"Channels reported by decoder: %d",mi->Channels);
+ MessageBox(0,buf,0,MB_OK|MB_ICONWARNING);
+ }
+ GlobalUnlock(hInput);
+ CloseFilterInput(hInput);
+ goto start_point;
+ }
+ }
+
if((mi->bytes_consumed=faacDecInit(mi->hDecoder, mi->buffer, &samplerate, &channels)) < 0)
ERROR_OFI("Can't init library");
mi->bytes_into_buffer-=mi->bytes_consumed;
-/*
- if(mi->bytes_consumed>0)
- faacDecInit reports there is an header to skip
- this operation will be done in ReadFilterInput
-*/
+
+ if(Channels4RawAAC)
+ channels=Channels4RawAAC;
+
mi->len_ms=(DWORD)((1000*((float)mi->src_size*8))/mi->file_info.bitrate);
} // END AAC file -----------------------------------------------------------------------------
@@ -472,7 +668,7 @@
BitsPerSample=32;
break;
default:
- ERROR_OFI("Invalid format");
+ ERROR_OFI("Invalid Bps");
}
if(mi->len_ms)
@@ -485,13 +681,12 @@
*wChannels=(WORD)channels;
*lChunkSize=(BitsPerSample/8)*1024*channels;
- mi->wChannels=(WORD)channels;
- mi->dwSamprate=samplerate;
- mi->wBitsPerSample=*wBitsPerSample;
+ mi->Channels=(WORD)channels;
+ mi->Samprate=samplerate;
+ mi->BitsPerSample=*wBitsPerSample;
// mi->src_name=strdup(lpstrFilename);
GlobalUnlock(hInput);
-
return hInput;
}
// *********************************************************************************************
@@ -504,21 +699,22 @@
GlobalUnlock(hInput); \
return 0; \
}
+// -----------------------------------------------------------------------------------------------
DWORD FAR PASCAL ReadFilterInput(HANDLE hInput, unsigned char far *bufout, long lBytes)
{
if(!hInput)
- ERROR_RFI("Memory allocation error: hInput");
-
+ return 0;
+
DWORD read,
tmp,
- shorts_decoded=0;
+ BytesDecoded=0;
unsigned char *buffer=0;
faacDecFrameInfo frameInfo;
char *sample_buffer=0;
MYINPUT *mi;
- mi=(MYINPUT *)GlobalLock(hInput);
+ GLOBALLOCK(mi,hInput,MYINPUT,return 0);
if(!mi->IsAAC) // MP4 file --------------------------------------------------------------------------
{
@@ -539,10 +735,10 @@
}
sample_buffer=(char *)faacDecDecode(mi->hDecoder,&frameInfo,buffer);
- shorts_decoded=frameInfo.samples*sizeof(short);
- memcpy(bufout,sample_buffer,shorts_decoded);
+ BytesDecoded=frameInfo.samples*sizeof(short);
+ memcpy(bufout,sample_buffer,BytesDecoded);
FREE(buffer);
- }while(!shorts_decoded && !frameInfo.error);
+ }while(!BytesDecoded && !frameInfo.error);
}
else // AAC file --------------------------------------------------------------------------
{
@@ -578,20 +774,25 @@
if(mi->bytes_read<mi->src_size)
ERROR_RFI("ReadFilterInput: buffer empty!")
else
- return 0;
+ ERROR_RFI(0)
sample_buffer=(char *)faacDecDecode(mi->hDecoder,&frameInfo,buffer);
- shorts_decoded=frameInfo.samples*sizeof(short);
- memcpy(bufout,sample_buffer,shorts_decoded);
- mi->bytes_consumed +=frameInfo.bytesconsumed;
+ BytesDecoded=frameInfo.samples*sizeof(short);
+ if(bufout)
+ memcpy(bufout,sample_buffer,BytesDecoded);
+ else // Data needed to decode Raw files
+ {
+ mi->bytesconsumed=frameInfo.bytesconsumed;
+ mi->Channels=frameInfo.channels;
+ }
+ mi->bytes_consumed+=frameInfo.bytesconsumed;
mi->bytes_into_buffer-=mi->bytes_consumed;
- }while(!shorts_decoded && !frameInfo.error);
+ }while(!BytesDecoded && !frameInfo.error);
} // END AAC file --------------------------------------------------------------------------
- GlobalUnlock(hInput);
-
if(frameInfo.error)
ERROR_RFI((char *)faacDecGetErrorMessage(frameInfo.error));
- return shorts_decoded;
+ GlobalUnlock(hInput);
+ return BytesDecoded;
}
--- a/plugins/cooledit/Main.cpp
+++ b/plugins/cooledit/Main.cpp
@@ -1,5 +1,5 @@
/*
-FAAD - codec plugin for Cooledit
+FAAC - codec plugin for Cooledit
Copyright (C) 2002 Antonio Foranna
This program is free software; you can redistribute it and/or modify
@@ -16,69 +16,72 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author can be contacted at:
-kreel@interfree.it
+kreel@tiscali.it
*/
#include <windows.h>
-#include "filters.h" //CoolEdit
-#include "defines.h"
+#include "filters.h" //CoolEdit
+#include "faac.h"
+#include "Defines.h" // my defines
+// Plugins of CoolEdit can be unloaded between each call of its exported funcs,
+// that's why no global variables can be used
-
+HINSTANCE hInst;
BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
{
- switch (fdwReason)
- {
- case DLL_PROCESS_ATTACH:
- /* Code from LibMain inserted here. Return TRUE to keep the
- DLL loaded or return FALSE to fail loading the DLL.
-
- You may have to modify the code in your original LibMain to
- account for the fact that it may be called more than once.
- You will get one DLL_PROCESS_ATTACH for each process that
- loads the DLL. This is different from LibMain which gets
- called only once when the DLL is loaded. The only time this
- is critical is when you are using shared data sections.
- If you are using shared data sections for statically
- allocated data, you will need to be careful to initialize it
- only once. Check your code carefully.
-
- Certain one-time initializations may now need to be done for
- each process that attaches. You may also not need code from
- your original LibMain because the operating system may now
- be doing it for you.
+ switch (fdwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ hInst=(HINSTANCE)hModule;
+ /* Code from LibMain inserted here. Return TRUE to keep the
+ DLL loaded or return FALSE to fail loading the DLL.
+
+ You may have to modify the code in your original LibMain to
+ account for the fact that it may be called more than once.
+ You will get one DLL_PROCESS_ATTACH for each process that
+ loads the DLL. This is different from LibMain which gets
+ called only once when the DLL is loaded. The only time this
+ is critical is when you are using shared data sections.
+ If you are using shared data sections for statically
+ allocated data, you will need to be careful to initialize it
+ only once. Check your code carefully.
+
+ Certain one-time initializations may now need to be done for
+ each process that attaches. You may also not need code from
+ your original LibMain because the operating system may now
+ be doing it for you.
*/
break;
-
- case DLL_THREAD_ATTACH:
- /* Called each time a thread is created in a process that has
- already loaded (attached to) this DLL. Does not get called
- for each thread that exists in the process before it loaded
- the DLL.
-
- Do thread-specific initialization here.
+
+ case DLL_THREAD_ATTACH:
+ /* Called each time a thread is created in a process that has
+ already loaded (attached to) this DLL. Does not get called
+ for each thread that exists in the process before it loaded
+ the DLL.
+ Do thread-specific initialization here.
*/
- break;
-
- case DLL_THREAD_DETACH:
- /* Same as above, but called when a thread in the process
+ break;
+
+ case DLL_THREAD_DETACH:
+ /* Same as above, but called when a thread in the process
exits.
-
Do thread-specific cleanup here.
*/
- break;
+ break;
+
+ case DLL_PROCESS_DETACH:
+ /* Code from _WEP inserted here. This code may (like the
+ LibMain) not be necessary. Check to make certain that the
+ operating system is not doing it for you.
+ */
+ break;
+ }
- case DLL_PROCESS_DETACH:
- /* Code from _WEP inserted here. This code may (like the
- LibMain) not be necessary. Check to make certain that the
- operating system is not doing it for you.
- */
- break;
- }
-
- /* The return value is only used for DLL_PROCESS_ATTACH; all other
- conditions are ignored. */
- return TRUE; // successful DLL_PROCESS_ATTACH
+ /* The return value is only used for DLL_PROCESS_ATTACH; all other
+ conditions are ignored.
+ */
+ return TRUE; // successful DLL_PROCESS_ATTACH
}
// Fill COOLQUERY structure with information regarding this file filter
@@ -90,7 +93,7 @@
lstrcpy(cq->szExt2,"MP4");
cq->lChunkSize=16384;
cq->dwFlags=QF_RATEADJUSTABLE|QF_CANLOAD|QF_CANSAVE|QF_HASOPTIONSBOX;
- cq->Mono8=0xFF; // supports all rates ???
+ cq->Mono8=0; // no support
cq->Mono16=0xFF;
cq->Mono24=0xFF;
cq->Mono32=0xFF;
@@ -98,7 +101,7 @@
cq->Stereo16=0xFF;
cq->Stereo24=0xFF;
cq->Stereo32=0xFF;
- cq->Quad8=0xFF;
+ cq->Quad8=0;
cq->Quad16=0xFF;
cq->Quad32=0xFF;
return C_VALIDLIBRARY;
--- a/plugins/cooledit/Readme.txt
+++ b/plugins/cooledit/Readme.txt
@@ -1,6 +1,6 @@
+-----------------------------------------------------------------+
| |
-| FAAD Readme |
+| FAAC Readme |
| ----------- |
| |
+-----------------------------------------------------------------+
@@ -12,17 +12,17 @@
----------------------------------------------------------------------------
-FAAD is a codec plugin for Cooledit
+FAAC is a codec plugin for Cooledit
to import .aac/.mp4 files and to export in AAC format.
To use it:
----------
-In visual studio set "Active Configuration = FAAD - win32 Release" and compile,
-copy FAAC.flt into CoolEdit folder
-delete flt.dat
+1) put FAAC and FAAD2 packages into the same folder;
+2) open the project, set "Active Configuration = FAAC - win32 Release" and compile;
+3) copy FAAC.flt into CoolEdit folder and delete flt.dat
----------------------------------------------------------------------------
For suggestions, bugs report, etc., you can contact me at
-kreel@interfree.it
+kreel@tiscali.it
--- /dev/null
+++ b/plugins/cooledit/Structs.h
@@ -1,0 +1,14 @@
+typedef struct mec
+{
+bool AutoCfg;
+faacEncConfiguration EncCfg;
+} MY_ENC_CFG;
+// -----------------------------------------------------------------------------------------------
+
+typedef struct mdc
+{
+bool AutoCfg;
+BYTE Channels;
+DWORD BitRate;
+faacDecConfiguration DecCfg;
+} MY_DEC_CFG;
--- /dev/null
+++ b/plugins/cooledit/aacInfoLib.vcproj
@@ -1,0 +1,128 @@
+<?xml version="1.0" encoding = "Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.00"
+ Name="aacInfoLib"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../faad2/common/faad"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="5"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/aacInfoLib.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Debug\aacInfoLib.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1040"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="../../../faad2/common/faad"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="4"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/aacInfoLib.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Release\aacInfoLib.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1040"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="..\..\..\faad2\common\faad\aacinfo.c">
+ </File>
+ <File
+ RelativePath="..\..\..\faad2\common\faad\filestream.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath="..\..\..\faad2\common\faad\aacinfo.h">
+ </File>
+ <File
+ RelativePath="..\..\..\faad2\common\faad\filestream.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- a/plugins/cooledit/defines.h
+++ b/plugins/cooledit/defines.h
@@ -1,3 +1,23 @@
#define APP_NAME "MPEG4-AAC"
-#define APP_VER "v2.0 beta4"
+#define APP_VER "v2.0"
#define REGISTRY_PROGRAM_NAME "SOFTWARE\\4N\\CoolEdit\\AAC-MPEG4"
+
+// -----------------------------------------------------------------------------------------------
+
+#define FREE(ptr) \
+{ \
+ if(ptr) \
+ free(ptr); \
+ ptr=0; \
+}
+
+// -----------------------------------------------------------------------------------------------
+
+#define GLOBALLOCK(ptr,handle,type,ret) \
+{ \
+ if(!(ptr=(type *)GlobalLock(handle))) \
+ { \
+ MessageBox(0, "GlobalLock", APP_NAME " plugin", MB_OK|MB_ICONSTOP); \
+ ret; \
+ } \
+}
binary files /dev/null b/plugins/cooledit/mpeg4ip-v.bmp differ
--- a/plugins/cooledit/resource.h
+++ b/plugins/cooledit/resource.h
@@ -1,9 +1,13 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
-// Used by FAAD.rc
+// Used by FAAC.rc
//
-#define IDD_COMPRESSION 101
-#define IDB_LOGO 104
+#define IDD_ENCODER 101
+#define IDD_DECODER 102
+#define IDD_ABOUT 103
+#define IDB_AUDIOCODING 104
+#define IDB_EMAIL 106
+#define IDB_MPEG4IP 107
#define IDC_RADIO_MPEG4 1000
#define IDC_RADIO_MPEG2 1001
#define IDC_RADIO_LOW 1002
@@ -10,24 +14,27 @@
#define IDC_RADIO_MAIN 1003
#define IDC_RADIO_SSR 1004
#define IDC_RADIO_LTP 1005
-#define IDC_ALLOWMIDSIDE 1006
-#define IDC_USETNS 1007
-#define IDC_USELFE 1008
-#define IDC_CB_BANDWIDTH 1009
-#define IDC_CB_BITRATE 1010
-#define IDC_CHK_AUTOCFG 1011
-#define IDC_BTN_ABOUT 1012
-#define IDC_IMG_LOGO 1013
-#define IDC_RADIO_RAW 1013
-#define IDC_RADIO_ADTS 1014
+#define IDC_RADIO_RAW 1006
+#define IDC_RADIO_ADTS 1007
+#define IDC_CB_BANDWIDTH 1008
+#define IDC_CB_BITRATE 1009
+#define IDC_CHK_ALLOWMIDSIDE 1010
+#define IDC_CHK_USETNS 1011
+#define IDC_CHK_USELFE 1012
+#define IDC_CHK_AUTOCFG 1013
+#define IDC_BTN_ABOUT 1014
+#define IDC_L_ABOUT 1015
+#define IDC_AUDIOCODING 1016
+#define IDC_EMAIL 1017
+#define IDC_MPEG4IP 1018
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 105
+#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1015
+#define _APS_NEXT_CONTROL_VALUE 1019
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif