ref: 0557336a25dd337e46f5462c75aad68b77803cba
parent: 5cea228a755a35b79ebc20b211dc4ee236c19fd9
author: menno <menno>
date: Wed Apr 17 14:43:24 EDT 2002
Updated cooledit plugin to use the FAAD2 decoder Thanks to Antonio
--- a/plugins/cooledit/FAAD.DSP
+++ b/plugins/cooledit/FAAD.DSP
@@ -43,7 +43,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /G4 /MT /W3 /GX /O2 /I "../../include" /I "../../../faad/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /G4 /MT /W3 /GX /O2 /I "../../include" /I "../../../faad2/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -53,7 +53,7 @@
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /incremental:yes /machine:I386 /out:"Release\FAAC.flt"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /incremental:yes /machine:I386 /out:"Release\FAAD2.flt"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "FAAD - Win32 Debug"
@@ -70,7 +70,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /G4 /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../../../faad/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /G4 /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../../../faad2/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -80,8 +80,8 @@
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug\FAAC.flt"
-# SUBTRACT LINK32 /pdb:none
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug\FAAD2.flt"
+# SUBTRACT LINK32 /pdb:none /nodefaultlib
!ENDIF
@@ -130,7 +130,7 @@
# End Source File
# Begin Source File
-SOURCE=..\..\..\faad\include\faad.h
+SOURCE=..\..\..\faad2\include\faad.h
# End Source File
# Begin Source File
--- a/plugins/cooledit/FAAD.rc
+++ b/plugins/cooledit/FAAD.rc
@@ -7,9 +7,8 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
-//#include "afxres.h"
+#include "afxres.h"
-
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -52,12 +51,10 @@
WS_TABSTOP,59,33,45,10
CONTROL "Use LFE channel",IDC_USELFE,"Button",BS_AUTOCHECKBOX |
WS_DISABLED | WS_TABSTOP,59,46,67,10
- EDITTEXT IDC_CB_BITRATE,124,68,40,14,ES_AUTOHSCROLL
- EDITTEXT IDC_CB_BANDWIDTH,124,85,40,14,ES_AUTOHSCROLL
-// COMBOBOX IDC_CB_BITRATE,124,68,40,59,CBS_DROPDOWNLIST |
-// WS_VSCROLL | WS_TABSTOP
-// COMBOBOX IDC_CB_BANDWIDTH,124,85,40,59,CBS_DROPDOWN | WS_VSCROLL |
-// WS_TABSTOP
+ COMBOBOX IDC_CB_BITRATE,124,68,48,30,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_CB_BANDWIDTH,124,85,48,30,CBS_DROPDOWN | WS_VSCROLL |
+ WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,64,108,36,14
PUSHBUTTON "Cancel",IDCANCEL,100,108,36,14
PUSHBUTTON "About",IDC_BTN_ABOUT,136,108,36,14
@@ -64,8 +61,7 @@
GROUPBOX "AAC type",IDC_STATIC,4,18,48,38
GROUPBOX "Profile",IDC_STATIC,4,63,48,59
LTEXT "Bitrate per channel",IDC_STATIC,59,73,60,8
- LTEXT "Bandwidth",IDC_STATIC,59,89,57,8
- CONTROL IDC_IMG_LOGO,"Static",SS_BITMAP,136,4,36,23
+ LTEXT "Bandwidth (0=full)",IDC_STATIC,59,89,57,8
END
@@ -114,24 +110,6 @@
#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
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-IDB_LOGO BITMAP DISCARDABLE "Logo.bmp"
-#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
--- a/plugins/cooledit/aacinfo.c
+++ b/plugins/cooledit/aacinfo.c
@@ -16,7 +16,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: aacinfo.c,v 1.3 2001/10/29 10:01:31 menno Exp $
+ * $Id: aacinfo.c,v 1.4 2002/04/17 18:43:24 menno Exp $
*/
#include <windows.h>
@@ -25,7 +25,7 @@
#define ADIF_MAX_SIZE 30 /* Should be enough */
#define ADTS_MAX_SIZE 10 /* Should be enough */
-const int sample_rates[] = {96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000};
+static const int sample_rates[] = {96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000};
static int read_ADIF_header(HANDLE file, faadAACInfo *info)
{
--- a/plugins/cooledit/faac.c
+++ b/plugins/cooledit/faac.c
@@ -5,7 +5,7 @@
#include "faac.h"
-#define PI_VER "v1.0 beta2"
+#define PI_VER "v2.0 beta1"
extern void config_init();
extern void config_read(DWORD *dwOptions);
@@ -14,285 +14,285 @@
typedef struct output_tag // any special vars associated with output file
{
- FILE *fFile;
- DWORD lSize;
- long lSamprate;
- WORD wBitsPerSample;
- WORD wChannels;
-// DWORD dwDataOffset;
-// BOOL bWrittenHeader;
- char szNAME[256];
+ FILE *fFile;
+ DWORD lSize;
+ long lSamprate;
+ WORD wBitsPerSample;
+ WORD wChannels;
+// DWORD dwDataOffset;
+// BOOL bWrittenHeader;
+ char szNAME[256];
- faacEncHandle hEncoder;
- unsigned char *bitbuf;
- DWORD maxBytesOutput;
- long samplesInput;
- BYTE bStopEnc;
-}MYOUTPUT;
+ faacEncHandle hEncoder;
+ unsigned char *bitbuf;
+ DWORD maxBytesOutput;
+ long samplesInput;
+ BYTE bStopEnc;
+} MYOUTPUT;
+#define DISABLE_LTP \
+{ \
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG2) && \
+ IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP)) \
+ { \
+ CheckDlgButton(hWndDlg,IDC_RADIO_LTP,FALSE); \
+ CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE); \
+ } \
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE); \
+}
__declspec(dllexport) BOOL FAR PASCAL DIALOGMsgProc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
{
DWORD dwOptions=(DWORD)lParam;
-char szTemp[64];
-
- switch(Message)
- {
- case WM_INITDIALOG:
- {
- char buf[10];
- int br;
-
-// if(!((dwOptions>>23)&1))
- {
- config_init();
- config_read(&dwOptions);
- }
-
- if(dwOptions)
- {
- char Enabled=!(dwOptions&1);
- CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, dwOptions&1);
- 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_SSR), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), Enabled);
-// EnableWindow(GetDlgItem(hWndDlg, IDC_USELFE), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BITRATE), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), Enabled);
-
- if(((dwOptions>>29)&7)==MPEG4)
- CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE);
- else
- CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,TRUE);
-
- switch((dwOptions>>27)&3)
- {
- case 0:
- CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
- CheckDlgButton(hWndDlg,IDC_RADIO_LOW,FALSE);
- break;
- case 1:
- CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE);
- CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,FALSE);
- break;
- case 2:
- CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE);
- break;
- case 3:
- CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE);
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG2) &&
- IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP))
- {
- CheckDlgButton(hWndDlg,IDC_RADIO_LTP,FALSE);
- CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
- CheckDlgButton(hWndDlg,IDC_RADIO_LOW,FALSE);
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE);
- }
- break;
- }
+ switch(Message)
+ {
+ case WM_INITDIALOG:
+ {
+ char buf[10];
- CheckDlgButton(hWndDlg, IDC_ALLOWMIDSIDE, (dwOptions>>26)&1);
- CheckDlgButton(hWndDlg, IDC_USETNS, (dwOptions>>25)&1);
- CheckDlgButton(hWndDlg, IDC_USELFE, (dwOptions>>24)&1);
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"8");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"18");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"20");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"24");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"32");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"40");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"48");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"56");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"64");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"96");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"112");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"128");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"160");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"192");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"256");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_SETCURSEL, 8, 0);
- for(br=0; br<=((dwOptions>>16)&255) ; br++)
- {
- if(br == ((dwOptions>>16)&255))
- sprintf(szTemp, "%d", br*1000);
- }
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"0");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"4000");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"8000");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"16000");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"22050");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"24000");
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, 0, 0);
- SetDlgItemText(hWndDlg, IDC_CB_BITRATE, szTemp);
+// if(!((dwOptions>>23)&1))
+ {
+ config_init();
+ config_read(&dwOptions);
+ }
- for(br=0; br<=((dwOptions>>1)&0x0000ffff) ; br++)
- {
- if(br == ((dwOptions>>1)&0x0000ffff))
- sprintf(szTemp, "%d", br);
- }
+ if(dwOptions)
+ {
+ char Enabled=!(dwOptions&1);
+ CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, dwOptions&1);
+ 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_SSR), Enabled);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), Enabled);
+// EnableWindow(GetDlgItem(hWndDlg, IDC_USELFE), Enabled);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BITRATE), Enabled);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), Enabled);
- SetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, szTemp);
+ if(((dwOptions>>29)&7)==MPEG4)
+ CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE);
+ else
+ CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,TRUE);
- break;
- } // End dwOptions
-
- CheckDlgButton(hWndDlg, IDC_ALLOWMIDSIDE, TRUE);
- CheckDlgButton(hWndDlg, IDC_USETNS, TRUE);
- CheckDlgButton(hWndDlg, IDC_USELFE, FALSE);
-
- switch((long)lParam)
- {
- case IDC_RADIO_MPEG4:
- CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE);
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), !IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG));
- break;
- case IDC_RADIO_MPEG2:
- CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,TRUE);
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP))
- {
- CheckDlgButton(hWndDlg,IDC_RADIO_LTP,FALSE);
- CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
- CheckDlgButton(hWndDlg,IDC_RADIO_LOW,FALSE);
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE);
- }
- break;
- case IDC_RADIO_MAIN:
- CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
- break;
- case IDC_RADIO_LOW:
- CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE);
- break;
- case IDC_RADIO_SSR:
- CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE);
- break;
- case IDC_RADIO_LTP:
- CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE);
- break;
- case IDC_CHK_AUTOCFG:
- CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, !IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG));
- break;
- default:
- CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE);
- CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
- break;
- }
+ switch((dwOptions>>27)&3)
+ {
+ case 0:
+ CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
+ break;
+ case 1:
+ CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE);
+ break;
+ case 2:
+ CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE);
+ break;
+ case 3:
+ CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE);
+ DISABLE_LTP
+ break;
}
- break; // End of WM_INITDIALOG
- case WM_CLOSE:
-// Closing the Dialog behaves the same as Cancel
- PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L);
- break; // End of WM_CLOSE
+ CheckDlgButton(hWndDlg, IDC_ALLOWMIDSIDE, (dwOptions>>26)&1);
+ CheckDlgButton(hWndDlg, IDC_USETNS, (dwOptions>>25)&1);
+ CheckDlgButton(hWndDlg, IDC_USELFE, (dwOptions>>24)&1);
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case IDC_CHK_AUTOCFG:
- {
- char Enabled=!IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG);
- 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_SSR), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), Enabled);
-// EnableWindow(GetDlgItem(hWndDlg, IDC_USELFE), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BITRATE), Enabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), Enabled);
+ SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_SETCURSEL, (dwOptions>>19)&31, 0);
+// SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, (dwOptions>>1)&0x0000ffff, 0);
+ sprintf(buf,"%lu",(dwOptions>>1)&0x0000ffff);
+ SetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, buf);
+ break;
+ } // End dwOptions
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4))
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled);
- else
- {
- CheckDlgButton(hWndDlg,IDC_RADIO_LTP,FALSE);
- CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
- CheckDlgButton(hWndDlg,IDC_RADIO_LOW,FALSE);
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE);
- }
- break;
- }
- break;
+ CheckDlgButton(hWndDlg, IDC_ALLOWMIDSIDE, TRUE);
+ CheckDlgButton(hWndDlg, IDC_USETNS, TRUE);
+ CheckDlgButton(hWndDlg, IDC_USELFE, FALSE);
- case IDOK:
- {
- DWORD retVal=0;
- faacEncConfiguration faacEncCfg;
+ switch((long)lParam)
+ {
+ case IDC_RADIO_MPEG4:
+ CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), !IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG));
+ break;
+ case IDC_RADIO_MPEG2:
+ CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,TRUE);
+ DISABLE_LTP
+ break;
+ case IDC_RADIO_MAIN:
+ CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
+ break;
+ case IDC_RADIO_LOW:
+ CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE);
+ break;
+ case IDC_RADIO_SSR:
+ CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE);
+ break;
+ case IDC_RADIO_LTP:
+ CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE);
+ break;
+ case IDC_CHK_AUTOCFG:
+ CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, !IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG));
+ break;
+ default:
+ CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE);
+ CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
+ break;
+ }
+ }
+ break; // End of WM_INITDIALOG
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4))
- {
- faacEncCfg.mpegVersion=MPEG4;
- retVal|=MPEG4<<29;
- }
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG2))
- {
- faacEncCfg.mpegVersion=MPEG2;
- retVal|=MPEG2<<29;
- }
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MAIN))
- {
- faacEncCfg.aacObjectType=MAIN;
- retVal|=MAIN<<27;
- }
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LOW))
- {
- faacEncCfg.aacObjectType=LOW;
- retVal|=LOW<<27;
- }
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_SSR))
- {
- faacEncCfg.aacObjectType=SSR;
- retVal|=SSR<<27;
- }
- if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP))
- {
- faacEncCfg.aacObjectType=LTP;
- retVal|=LTP<<27;
- }
+ case WM_CLOSE:
+ // Closing the Dialog behaves the same as Cancel
+ PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L);
+ break; // End of WM_CLOSE
- faacEncCfg.allowMidside=IsDlgButtonChecked(hWndDlg, IDC_ALLOWMIDSIDE) == BST_CHECKED ? 1 : 0;
- retVal|=faacEncCfg.allowMidside<<26;
- faacEncCfg.useTns=IsDlgButtonChecked(hWndDlg, IDC_USETNS) == BST_CHECKED ? 1 : 0;
- retVal|=faacEncCfg.useTns<<25;
- faacEncCfg.useLfe=IsDlgButtonChecked(hWndDlg, IDC_USELFE) == BST_CHECKED ? 1 : 0;
- retVal|=faacEncCfg.useLfe<<24;
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDC_CHK_AUTOCFG:
+ {
+ char Enabled=!IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG);
+ 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_SSR), Enabled);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), Enabled);
+// EnableWindow(GetDlgItem(hWndDlg, IDC_USELFE), 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
+ break;
+ }
+ break;
- GetDlgItemText(hWndDlg, IDC_CB_BITRATE, szTemp, sizeof(szTemp));
- faacEncCfg.bitRate = atoi(szTemp);
- retVal|=((faacEncCfg.bitRate/1000)&255)<<16;
- GetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, szTemp, sizeof(szTemp));
- faacEncCfg.bandWidth = atoi(szTemp);
- retVal|=(faacEncCfg.bandWidth&0x0000ffff)<<1;
+ case IDOK:
+ {
+ DWORD retVal=0;
+ faacEncConfiguration faacEncCfg;
- if(IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG))
- retVal|=1;
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4))
+ {
+ faacEncCfg.mpegVersion=MPEG4;
+ retVal|=MPEG4<<29;
+ }
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG2))
+ {
+ faacEncCfg.mpegVersion=MPEG2;
+ retVal|=MPEG2<<29;
+ }
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MAIN))
+ {
+ faacEncCfg.aacObjectType=MAIN;
+ retVal|=MAIN<<27;
+ }
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LOW))
+ {
+ faacEncCfg.aacObjectType=LOW;
+ retVal|=LOW<<27;
+ }
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_SSR))
+ {
+ faacEncCfg.aacObjectType=SSR;
+ retVal|=SSR<<27;
+ }
+ if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP))
+ {
+ faacEncCfg.aacObjectType=LTP;
+ retVal|=LTP<<27;
+ }
- config_write(retVal);
+ faacEncCfg.allowMidside=IsDlgButtonChecked(hWndDlg, IDC_ALLOWMIDSIDE) == BST_CHECKED ? 1 : 0;
+ retVal|=faacEncCfg.allowMidside<<26;
+ faacEncCfg.useTns=IsDlgButtonChecked(hWndDlg, IDC_USETNS) == BST_CHECKED ? 1 : 0;
+ retVal|=faacEncCfg.useTns<<25;
+ faacEncCfg.useLfe=IsDlgButtonChecked(hWndDlg, IDC_USELFE) == BST_CHECKED ? 1 : 0;
+ retVal|=faacEncCfg.useLfe<<24;
-// retVal|=1<<23; // CFG has been written
+ faacEncCfg.bitRate=GetDlgItemInt(hWndDlg, IDC_CB_BITRATE, 0, FALSE);
+ retVal|=(SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_GETCURSEL, 0, 0)&31)<<19;
+ //retVal|=faacEncCfg.bitRate;
+ faacEncCfg.bandWidth=GetDlgItemInt(hWndDlg, IDC_CB_BANDWIDTH, 0, FALSE);
+// retVal|=(SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_GETCURSEL, 0, 0)&0x0000ffff)<<1;
+ retVal|=(faacEncCfg.bandWidth&0x0000ffff)<<1;
+
+ if(IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG))
+ retVal|=1;
- EndDialog(hWndDlg, retVal);
- }
- break;
+ config_write(retVal);
+
+// retVal|=1<<23; // CFG has been written
- case IDCANCEL:
-// Ignore data values entered into the controls
-// and dismiss the dialog window returning FALSE
- EndDialog(hWndDlg, FALSE);
- break;
+ EndDialog(hWndDlg, retVal);
+ }
+ break;
- case IDC_BTN_ABOUT:
- {
- char buf[256];
- sprintf(buf,"AAC-MPEG4 encoder plug-in %s\nThis plugin uses FAAC encoder engine v%g\n\nCompiled on %s\n",
- PI_VER,
- FAACENC_VERSION,
- __DATE__
+ case IDCANCEL:
+ // Ignore data values entered into the controls
+ // and dismiss the dialog window returning FALSE
+ EndDialog(hWndDlg, FALSE);
+ break;
+
+ case IDC_BTN_ABOUT:
+ {
+ char buf[256];
+ sprintf(buf, "AAC-MPEG4 plugin %s by 4N\n"
+ "This plugin uses FAAC encoder engine v%g and FAAD2 decoder engine\n\n"
+ "Compiled on %s\n",
+ PI_VER,
+ FAACENC_VERSION,
+ __DATE__
);
- MessageBox(hWndDlg, buf, "About", MB_OK);
- }
- break;
+ MessageBox(hWndDlg, buf, "About", MB_OK);
+ }
+ break;
- case IDC_RADIO_MPEG4:
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), !IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG));
- break;
+ case IDC_RADIO_MPEG4:
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), !IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG));
+ break;
- case IDC_RADIO_MPEG2:
- EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE);
- CheckDlgButton(hWndDlg,IDC_RADIO_LTP,FALSE);
- CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
- break;
- }
- break; // End of WM_COMMAND
- default: return FALSE;
- }
- return TRUE;
+ case IDC_RADIO_MPEG2:
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE);
+ DISABLE_LTP
+ break;
+ }
+ break; // End of WM_COMMAND
+ default: return FALSE;
+ }
+ return TRUE;
} // End of DIALOGSMsgProc
@@ -302,20 +302,21 @@
long nDialogReturn=0;
FARPROC lpfnDIALOGMsgProc;
- lpfnDIALOGMsgProc=GetProcAddress(hInst,(LPCSTR)MAKELONG(20,0));
- nDialogReturn=(long)DialogBoxParam((HINSTANCE)hInst,(LPCSTR)MAKEINTRESOURCE(IDD_COMPRESSION), (HWND)hWnd, (DLGPROC)lpfnDIALOGMsgProc, dwOptions);
+ lpfnDIALOGMsgProc=GetProcAddress(hInst,(LPCSTR)MAKELONG(20,0));
+ nDialogReturn=(long)DialogBoxParam((HINSTANCE)hInst,(LPCSTR)MAKEINTRESOURCE(IDD_COMPRESSION), (HWND)hWnd, (DLGPROC)lpfnDIALOGMsgProc, dwOptions);
- return nDialogReturn;
+ return nDialogReturn;
}
-__declspec(dllexport) DWORD FAR PASCAL FilterWriteFirstSpecialData(HANDLE hInput, SPECIALDATA * psp)
+__declspec(dllexport) DWORD FAR PASCAL FilterWriteFirstSpecialData(HANDLE hInput,
+ SPECIALDATA * psp)
{
- return 0;
+ return 0;
}
__declspec(dllexport) DWORD FAR PASCAL FilterWriteNextSpecialData(HANDLE hInput, SPECIALDATA * psp)
{
- return 0;
+ return 0;
// only has 1 special data! Otherwise we would use psp->hSpecialData
// as either a counter to know which item to retrieve next, or as a
// structure with other state information in it.
@@ -322,150 +323,189 @@
}
__declspec(dllexport) DWORD FAR PASCAL FilterWriteSpecialData(HANDLE hOutput,
- LPCSTR szListType, LPCSTR szType, char * pData,DWORD dwSize)
+ LPCSTR szListType, LPCSTR szType, char * pData,DWORD dwSize)
{
- return 0;
+ return 0;
}
__declspec(dllexport) void FAR PASCAL CloseFilterOutput(HANDLE hOutput)
{
- if(hOutput)
- {
- MYOUTPUT *mo;
- mo=(MYOUTPUT *)GlobalLock(hOutput);
+ if(hOutput)
+ {
+ MYOUTPUT *mo;
+ mo=(MYOUTPUT *)GlobalLock(hOutput);
- if(mo->fFile)
- {
- fclose(mo->fFile);
- mo->fFile=0;
- }
+ if(mo->fFile)
+ {
+ fclose(mo->fFile);
+ mo->fFile=0;
+ }
- if(mo->hEncoder)
- faacEncClose(mo->hEncoder);
+ if(mo->hEncoder)
+ faacEncClose(mo->hEncoder);
- if(mo->bitbuf)
- {
- free(mo->bitbuf);
- mo->bitbuf=0;
- }
+ if(mo->bitbuf)
+ {
+ free(mo->bitbuf);
+ mo->bitbuf=0;
+ }
- GlobalUnlock(hOutput);
- GlobalFree(hOutput);
- }
+ GlobalUnlock(hOutput);
+ GlobalFree(hOutput);
+ }
}
__declspec(dllexport) HANDLE FAR PASCAL OpenFilterOutput(LPSTR lpstrFilename,long lSamprate,WORD wBitsPerSample,WORD wChannels,long lSize, long far *lpChunkSize, DWORD dwOptions)
{
-HANDLE hOutput;
-faacEncHandle hEncoder;
-FILE *outfile;
-unsigned char *bitbuf;
-DWORD maxBytesOutput;
-long samplesInput;
-int bytesEncoded;
-int br;
- char szTemp[64];
+HANDLE hOutput;
+faacEncHandle hEncoder;
+FILE *outfile;
+unsigned char *bitbuf;
+DWORD maxBytesOutput;
+long samplesInput;
+int bytesEncoded;
-// if(!((dwOptions>>23)&1))
+// if(!((dwOptions>>23)&1))
{
- config_init();
- config_read(&dwOptions);
+ config_init();
+ config_read(&dwOptions);
}
-// open the aac output file
+// open the aac output file
if(!(outfile=fopen(lpstrFilename, "wb")))
{
- MessageBox(0, "Can't create file", "FAAC interface", MB_OK);
- return 0;
+ MessageBox(0, "Can't create file", "FAAC interface", MB_OK);
+ return 0;
}
-// open the encoder library
+// open the encoder library
if(!(hEncoder=faacEncOpen(lSamprate, wChannels, &samplesInput, &maxBytesOutput)))
{
- MessageBox(0, "Can't init library", "FAAC interface", MB_OK);
- fclose(outfile);
- return 0;
+ MessageBox(0, "Can't init library", "FAAC interface", MB_OK);
+ fclose(outfile);
+ return 0;
}
if(!(bitbuf=(unsigned char*)malloc(maxBytesOutput*sizeof(unsigned char))))
{
- MessageBox(0, "Memory allocation error: output buffer", "FAAC interface", MB_OK);
- faacEncClose(hEncoder);
- fclose(outfile);
- return 0;
+ MessageBox(0, "Memory allocation error: output buffer", "FAAC interface", MB_OK);
+ faacEncClose(hEncoder);
+ fclose(outfile);
+ return 0;
}
*lpChunkSize=samplesInput*2;
- hOutput=GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE,sizeof(MYOUTPUT));
- if(hOutput)
- {
- MYOUTPUT *mo;
- mo=(MYOUTPUT *)GlobalLock(hOutput);
- mo->fFile=outfile;
- mo->lSize=lSize;
- mo->lSamprate=lSamprate;
- mo->wBitsPerSample=wBitsPerSample;
- mo->wChannels=wChannels;
-// mo->dwDataOffset=0; // ???
-// mo->bWrittenHeader=0;
- strcpy(mo->szNAME,lpstrFilename);
+ hOutput=GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE,sizeof(MYOUTPUT));
+ if(hOutput)
+ {
+ MYOUTPUT *mo;
+ mo=(MYOUTPUT *)GlobalLock(hOutput);
+ mo->fFile=outfile;
+ mo->lSize=lSize;
+ mo->lSamprate=lSamprate;
+ mo->wBitsPerSample=wBitsPerSample;
+ mo->wChannels=wChannels;
+// mo->dwDataOffset=0; // ???
+// mo->bWrittenHeader=0;
+ strcpy(mo->szNAME,lpstrFilename);
- mo->hEncoder=hEncoder;
- mo->bitbuf=bitbuf;
- mo->maxBytesOutput=maxBytesOutput;
- mo->samplesInput=samplesInput;
- mo->bStopEnc=0;
+ mo->hEncoder=hEncoder;
+ mo->bitbuf=bitbuf;
+ mo->maxBytesOutput=maxBytesOutput;
+ mo->samplesInput=samplesInput;
+ mo->bStopEnc=0;
- GlobalUnlock(hOutput);
- }
+ GlobalUnlock(hOutput);
+ }
else
{
- MessageBox(0, "hOutput=NULL", "FAAC interface", MB_OK);
- faacEncClose(hEncoder);
- fclose(outfile);
- free(bitbuf);
- return 0;
+ MessageBox(0, "hOutput=NULL", "FAAC interface", MB_OK);
+ faacEncClose(hEncoder);
+ fclose(outfile);
+ free(bitbuf);
+ return 0;
}
if(dwOptions && !(dwOptions&1))
{
- faacEncConfigurationPtr myFormat;
- myFormat=faacEncGetCurrentConfiguration(hEncoder);
+ faacEncConfigurationPtr myFormat;
+ myFormat=faacEncGetCurrentConfiguration(hEncoder);
- myFormat->mpegVersion=(dwOptions>>29)&7;
- myFormat->aacObjectType=(dwOptions>>27)&3;
- myFormat->allowMidside=(dwOptions>>26)&1;
- myFormat->useTns=(dwOptions>>25)&1;
- myFormat->useLfe=(dwOptions>>24)&1;
+ myFormat->mpegVersion=(dwOptions>>29)&7;
+ myFormat->aacObjectType=(dwOptions>>27)&3;
+ myFormat->allowMidside=(dwOptions>>26)&1;
+ myFormat->useTns=(dwOptions>>25)&1;
+ myFormat->useLfe=(dwOptions>>24)&1;
+ switch((dwOptions>>19)&31)
+ {
+ case 0:
+ myFormat->bitRate=8000;
+ break;
+ case 1:
+ myFormat->bitRate=18000;
+ break;
+ case 2:
+ myFormat->bitRate=20000;
+ break;
+ case 3:
+ myFormat->bitRate=24000;
+ break;
+ case 4:
+ myFormat->bitRate=32000;
+ break;
+ case 5:
+ myFormat->bitRate=40000;
+ break;
+ case 6:
+ myFormat->bitRate=48000;
+ break;
+ case 7:
+ myFormat->bitRate=56000;
+ break;
+ case 8:
+ myFormat->bitRate=64000;
+ break;
+ case 9:
+ myFormat->bitRate=96000;
+ break;
+ case 10:
+ myFormat->bitRate=112000;
+ break;
+ case 11:
+ myFormat->bitRate=128000;
+ break;
+ case 12:
+ myFormat->bitRate=160000;
+ break;
+ case 13:
+ myFormat->bitRate=192000;
+ break;
+ case 14:
+ myFormat->bitRate=256000;
+ break;
+ }
+ myFormat->bandWidth=(dwOptions>>1)&0x0000ffff;
+ if(!myFormat->bandWidth)
+ myFormat->bandWidth=lSamprate/2;
- for(br=0; br<=((dwOptions>>16)&255) ; br++)
- {
- if(br == ((dwOptions>>16)&255))
- myFormat->bitRate=br*1000;
- }
-
- myFormat->bandWidth=(dwOptions>>1)&0x0000ffff;
- if(!myFormat->bandWidth)
- myFormat->bandWidth=lSamprate/2;
-
- if(!faacEncSetConfiguration(hEncoder, myFormat))
- {
- MessageBox(0, "Unsupported parameters", "FAAC interface", MB_OK);
- faacEncClose(hEncoder);
- fclose(outfile);
- free(bitbuf);
- GlobalFree(hOutput);
- return 0;
- }
+ if(!faacEncSetConfiguration(hEncoder, myFormat))
+ {
+ MessageBox(0, "Unsupported parameters", "FAAC interface", MB_OK);
+ faacEncClose(hEncoder);
+ fclose(outfile);
+ free(bitbuf);
+ GlobalFree(hOutput);
+ return 0;
+ }
}
// init flushing process
- bytesEncoded=faacEncEncode(hEncoder, 0, 0, bitbuf, maxBytesOutput); // initializes the flushing process
- if(bytesEncoded>0)
- fwrite(bitbuf, 1, bytesEncoded, outfile);
+ bytesEncoded=faacEncEncode(hEncoder, 0, 0, bitbuf, maxBytesOutput); // initializes the flushing process
+ if(bytesEncoded>0)
+ fwrite(bitbuf, 1, bytesEncoded, outfile);
- return hOutput;
+ return hOutput;
}
__declspec(dllexport) DWORD FAR PASCAL WriteFilterOutput(HANDLE hOutput, unsigned char far *buf, long lBytes)
@@ -473,39 +513,39 @@
int bytesWritten;
int bytesEncoded;
- if(hOutput)
- {
- MYOUTPUT far *mo;
- mo=(MYOUTPUT far *)GlobalLock(hOutput);
+ if(hOutput)
+ {
+ MYOUTPUT far *mo;
+ mo=(MYOUTPUT far *)GlobalLock(hOutput);
- if(!mo->bStopEnc)
- {
+ if(!mo->bStopEnc)
+ {
// 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)
- {
- MessageBox(0, "faacEncEncode() failed", "FAAC interface", MB_OK);
- mo->bStopEnc=1;
- }
- bytesWritten=lBytes ? 1 : 0; // bytesWritten==0 stops CoolEdit...
- GlobalUnlock(hOutput);
- return bytesWritten;
- }
+ bytesEncoded=faacEncEncode(mo->hEncoder, (short *)buf, mo->samplesInput, mo->bitbuf, mo->maxBytesOutput);
+ if(bytesEncoded<1) // end of flushing process
+ {
+ if(bytesEncoded<0)
+ {
+ MessageBox(0, "faacEncEncode() failed", "FAAC interface", MB_OK);
+ mo->bStopEnc=1;
+ }
+ bytesWritten=lBytes ? 1 : 0; // bytesWritten==0 stops CoolEdit...
+ GlobalUnlock(hOutput);
+ return bytesWritten;
+ }
// write bitstream to aac file
- bytesWritten=fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
- if(bytesWritten!=bytesEncoded)
- {
- MessageBox(0, "bytesWritten and bytesEncoded are different", "FAAC interface", MB_OK);
- mo->bStopEnc=1;
- GlobalUnlock(hOutput);
- return 0;
- }
+ bytesWritten=fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
+ if(bytesWritten!=bytesEncoded)
+ {
+ MessageBox(0, "bytesWritten and bytesEncoded are different", "FAAC interface", MB_OK);
+ mo->bStopEnc=1;
+ GlobalUnlock(hOutput);
+ return 0;
+ }
- GlobalUnlock(hOutput);
- }
- }
+ GlobalUnlock(hOutput);
+ }
+ }
- return bytesWritten;
+ return bytesWritten;
}
--- a/plugins/cooledit/faad.c
+++ b/plugins/cooledit/faad.c
@@ -172,7 +172,8 @@
DWORD tmp;
//int shift;
FILE *infile;
-DWORD samplerate, channels;
+DWORD samplerate;
+unsigned char channels;
DWORD pos; // into the file. Needed to obtain length of file
DWORD read;
int *seek_table;
@@ -269,6 +270,7 @@
config = faacDecGetCurrentConfiguration(hDecoder);
// config->defObjectType = MAIN;
config->defSampleRate = 44100;
+ config->outputFormat=FAAD_FMT_16BIT;
faacDecSetConfiguration(hDecoder, config);
if((mi->bytes_consumed=faacDecInit(hDecoder, buffer, &samplerate, &channels)) < 0)
@@ -310,7 +312,7 @@
return 0;
}
- mi->len_ms=1000*((mi->lSize*8)/mi->file_info.bitrate);
+ mi->len_ms=(DWORD)((1000*((float)mi->lSize*8))/mi->file_info.bitrate);
if(mi->len_ms)
mi->full_size=(DWORD)(mi->len_ms*((float)mi->dwSamprate/1000)*mi->wChannels*(16/8));
else
@@ -342,8 +344,9 @@
DWORD read,
tmp,
shorts_decoded=0;
-long result=0;
unsigned char *buffer;
+faacDecFrameInfo frameInfo;
+char *sample_buffer=0;
if(hInput)
{
@@ -354,7 +357,7 @@
do
{
- if(mi->bytes_consumed>0 && mi->bytes_into_buffer>=0)
+ if(mi->bytes_consumed>0)
{
if(mi->bytes_into_buffer)
memcpy(buffer,buffer+mi->bytes_consumed,mi->bytes_into_buffer);
@@ -375,6 +378,8 @@
else
if(mi->bytes_into_buffer)
memset(buffer+mi->bytes_into_buffer, 0, mi->bytes_consumed);
+
+ mi->bytes_consumed=0;
}
if(mi->bytes_into_buffer<1)
@@ -383,17 +388,18 @@
else
return 0;
- result=faacDecDecode(mi->hDecoder, buffer, &(mi->bytes_consumed), (short*)bufout, &shorts_decoded);
+ 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;
mi->bytes_into_buffer-=mi->bytes_consumed;
- }while(!shorts_decoded || result==FAAD_OK_CHUPDATE);
+ }while(!shorts_decoded && !frameInfo.error);
GlobalUnlock(hInput);
}
- if(result==FAAD_FATAL_ERROR || result==FAAD_ERROR)
- ERROR_ReadFilterInput("ReadFilterInput: FAAD_FATAL_ERROR or FAAD_ERROR");
+ if(frameInfo.error)
+ ERROR_ReadFilterInput(faacDecGetErrorMessage(frameInfo.error));
-/* if(shorts_decoded>1024*MAX_CHANNELS)
- return 0;*/
- return shorts_decoded*sizeof(short);
+ return shorts_decoded;
}
--- a/plugins/cooledit/faad.def
+++ b/plugins/cooledit/faad.def
@@ -1,21 +1,17 @@
-LIBRARY Cool32*FAAC
-
-HEAPSIZE 2048
-
EXPORTS
- QueryCoolFilter @2
- OpenFilterOutput @3
- CloseFilterOutput @4
- WriteFilterOutput @5
- OpenFilterInput @6
- CloseFilterInput @7
- ReadFilterInput @8
- FilterUnderstandsFormat @9
- FilterGetOptions @14
- FilterGetFileSize @16
- FilterOptionsString @17
- DIALOGMsgProc @20
- FilterGetFirstSpecialData @31
- FilterGetNextSpecialData @32
- FilterWriteSpecialData @33
+ QueryCoolFilter @2
+ OpenFilterOutput @3
+ CloseFilterOutput @4
+ WriteFilterOutput @5
+ OpenFilterInput @6
+ CloseFilterInput @7
+ ReadFilterInput @8
+ FilterUnderstandsFormat @9
+ FilterGetOptions @14
+ FilterGetFileSize @16
+ FilterOptionsString @17
+ DIALOGMsgProc @20
+ FilterGetFirstSpecialData @31
+ FilterGetNextSpecialData @32
+ FilterWriteSpecialData @33
--- a/plugins/cooledit/faad.dsw
+++ b/plugins/cooledit/faad.dsw
@@ -24,7 +24,7 @@
###############################################################################
-Project: "id3lib"=..\common\id3lib\prj\id3lib.dsp - Package Owner=<4>
+Project: "id3lib"=..\..\..\faad2\common\id3lib\prj\id3lib.dsp - Package Owner=<4>
Package=<5>
{{{
@@ -48,7 +48,7 @@
###############################################################################
-Project: "libfaad"=..\libfaad\libfaad.dsp - Package Owner=<4>
+Project: "libfaad"=..\..\..\faad2\libfaad\libfaad.dsp - Package Owner=<4>
Package=<5>
{{{
--- a/plugins/cooledit/resource.h
+++ b/plugins/cooledit/resource.h
@@ -10,14 +10,14 @@
#define IDC_RADIO_MAIN 1003
#define IDC_RADIO_SSR 1004
#define IDC_RADIO_LTP 1005
-#define IDC_ALLOWMIDSIDE 1011
-#define IDC_USETNS 1012
-#define IDC_USELFE 1013
-#define IDC_CB_BANDWIDTH 1015
-#define IDC_CB_BITRATE 1017
-#define IDC_CHK_AUTOCFG 1020
-#define IDC_BTN_ABOUT 1021
-#define IDC_IMG_LOGO 1022
+#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
// Next default values for new objects
//
@@ -25,7 +25,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1025
+#define _APS_NEXT_CONTROL_VALUE 1014
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif