shithub: aacenc

Download patch

ref: 2673a116d5373d9b6e4e6996d11257002486f12d
parent: 5b66a8ca04e73b7c495eb23ab546ee02863ac366
author: menno <menno>
date: Tue Mar 6 16:02:33 EST 2001

-added profile selection
-some cleanup

--- a/frontend/faac.dsp
+++ b/frontend/faac.dsp
@@ -51,7 +51,7 @@
 LINK32=xilink6.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
 # ADD LINK32 libsndfile.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# SUBTRACT LINK32 /profile
+# SUBTRACT LINK32 /profile /nodefaultlib
 
 !ELSEIF  "$(CFG)" == "faac - Win32 Debug"
 
@@ -75,7 +75,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 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libsndfile.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 libsndfiled.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
 
 !ENDIF 
 
--- a/frontend/faacgui.dsp
+++ b/frontend/faacgui.dsp
@@ -54,7 +54,7 @@
 LINK32=xilink6.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
 # ADD LINK32 libsndfile.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
-# SUBTRACT LINK32 /profile
+# SUBTRACT LINK32 /profile /nodefaultlib
 
 !ELSEIF  "$(CFG)" == "faacgui - Win32 Debug"
 
@@ -80,7 +80,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 odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libsndfile.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 libsndfiled.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
 
 !ENDIF 
 
--- a/frontend/faacgui.rc
+++ b/frontend/faacgui.rc
@@ -64,8 +64,8 @@
                     WS_EX_STATICEDGE
     CONTROL         "Allow Mid/Side",IDC_ALLOWMIDSIDE,"Button",
                     BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,13,78,71,10
-    EDITTEXT        IDC_BITRATE,142,73,69,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_BANDWIDTH,142,95,69,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_BITRATE,138,77,31,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_BANDWIDTH,138,95,31,14,ES_AUTOHSCROLL
     DEFPUSHBUTTON   "Encode",IDOK,75,154,50,14,WS_DISABLED
     PUSHBUTTON      "Quit",IDCANCEL,141,154,50,14
     EDITTEXT        IDC_INPUTFILENAME,61,12,161,14,ES_AUTOHSCROLL
@@ -78,13 +78,13 @@
     LTEXT           "-",IDC_INPUTPARAMS,32,66,55,8
     LTEXT           "In:",IDC_STATIC,14,66,12,8
     CONTROL         "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,
-                    124,252,10
-    GROUPBOX        "Output Format",IDC_STATIC,94,62,153,57
-    CTEXT           "- - -",IDC_TIME,7,140,252,8
-    LTEXT           "Bandwidth:",IDC_STATIC,101,98,37,8
-    LTEXT           "Bitrate:",IDC_STATIC,101,76,37,8
-    LTEXT           "bps/ch",IDC_STATIC,218,76,24,8
-    LTEXT           "Hz",IDC_STATIC,218,98,10,8
+                    126,252,10
+    GROUPBOX        "Output Format",IDC_STATIC,94,62,165,59
+    CTEXT           "- - -",IDC_TIME,7,142,252,8
+    LTEXT           "Bandwidth:",IDC_STATIC,97,98,37,8
+    LTEXT           "Bitrate:",IDC_STATIC,97,80,37,8
+    LTEXT           "bps/ch",IDC_STATIC,173,80,24,8
+    LTEXT           "Hz",IDC_STATIC,173,98,10,8
     CONTROL         "Use LFE channel",IDC_USELFE,"Button",BS_AUTOCHECKBOX | 
                     BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP,13,111,71,10
     CONTROL         "Use TNS",IDC_USETNS,"Button",BS_AUTOCHECKBOX | 
@@ -92,6 +92,11 @@
     CONTROL         "Use LTP",IDC_USELTP,"Button",BS_AUTOCHECKBOX | 
                     BS_LEFTTEXT | WS_TABSTOP,13,100,71,10
     RTEXT           "-",IDC_COMPILEDATE,196,160,63,8
+    GROUPBOX        "AAC Profile",IDC_STATIC,203,71,50,46
+    CONTROL         "Main",IDC_MAIN,"Button",BS_AUTORADIOBUTTON,210,92,31,10
+    CONTROL         "LC",IDC_LC,"Button",BS_AUTORADIOBUTTON,210,81,25,10
+    CONTROL         "SSR",IDC_SSR,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,
+                    210,103,31,10
 END
 
 
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: main.c,v 1.9 2001/03/05 11:33:37 menno Exp $
+ * $Id: main.c,v 1.10 2001/03/06 21:02:33 menno Exp $
  */
 
 #ifdef _WIN32
@@ -76,6 +76,7 @@
 	{
 		printf("USAGE: %s -options infile outfile\n", argv[0]);
 		printf("Options:\n");
+		printf("  -pX   AAC profile, X=L gives LC, X=M gives MAIN\n");
 		printf("  -nm   Don\'t use mid/side coding\n");
 		printf("  -tns  Use TNS coding\n");
 		printf("  -ltp  Use LTP coding\n");
@@ -119,6 +120,12 @@
 		for (i = 1; i < argc-2; i++) {
 			if ((argv[i][0] == '-') || (argv[i][0] == '/')) {
 				switch(argv[i][1]) {
+				case 'p': case 'P':
+					if ((argv[i][2] == 'l') || (argv[i][2] == 'L'))
+						myFormat->aacProfile = MAIN;
+					else if ((argv[i][2] == 'm') || (argv[i][2] == 'M'))
+						myFormat->aacProfile = LOW;
+				break;
 				case 't': case 'T':
 					if ((argv[i][2] == 'n') || (argv[i][2] == 'N'))
 						myFormat->useTns = 1;
--- a/frontend/maingui.c
+++ b/frontend/maingui.c
@@ -16,13 +16,13 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: maingui.c,v 1.9 2001/03/05 15:55:40 menno Exp $
+ * $Id: maingui.c,v 1.10 2001/03/06 21:02:33 menno Exp $
  */
 
 #include <windows.h>
 #include <commdlg.h>
 #include <commctrl.h>
-#include <stdio.h>
+#include <stdlib.h>
 
 #include <sndfile.h>  /* http://www.zip.com.au/~erikd/libsndfile/ */
 
@@ -34,11 +34,11 @@
 
 static HINSTANCE hInstance;
 
-static char inputFilename[_MAX_PATH], outputFilename [_MAX_PATH];
+static char inputFilename[_MAX_PATH], outputFilename[_MAX_PATH];
 
 static BOOL Encoding = FALSE;
 
-static BOOL SelectFileName (HWND hParent, char *filename, BOOL forReading)
+static BOOL SelectFileName(HWND hParent, char *filename, BOOL forReading)
 {
 	OPENFILENAME ofn;
 
@@ -95,7 +95,6 @@
 	SF_INFO sfinfo;
 	unsigned int sampleRate, numChannels;
 	char *pExt;
-	faacEncHandle hEncoder;
 
 	if ((infile = sf_open_read(inputFilename, &sfinfo)) == NULL)
 		return;
@@ -106,8 +105,6 @@
 
 	sf_close(infile);
 
-	// // //
-
 	SetDlgItemText (hWnd, IDC_INPUTFILENAME, inputFilename);
 
 	strncpy(outputFilename, inputFilename, sizeof(outputFilename) - 5);
@@ -114,8 +111,8 @@
 
 	pExt = strrchr(outputFilename, '.');
 
-	if (pExt == NULL) strcat(outputFilename, ".aac");
-	else strcpy(pExt, ".aac");
+	if (pExt == NULL) lstrcat(outputFilename, ".aac");
+	else lstrcpy(pExt, ".aac");
 
 	EnableWindow(GetDlgItem(hWnd, IDC_OUTPUTFILENAME), TRUE);
 	EnableWindow(GetDlgItem(hWnd, IDC_SELECT_OUTPUTFILE), TRUE);
@@ -125,31 +122,7 @@
 	wsprintf(szTemp, "%iHz %ich", sampleRate, numChannels);
 	SetDlgItemText(hWnd, IDC_INPUTPARAMS, szTemp);
 
-	// // //
-
-	hEncoder = faacEncOpen(sampleRate, numChannels);
-	if (hEncoder)
-	{
-		faacEncConfigurationPtr config;
-
-		EnableWindow(GetDlgItem(hWnd, IDOK), TRUE);
-
-		config = faacEncGetCurrentConfiguration(hEncoder);
-
-		config->allowMidside = IsDlgButtonChecked(hWnd, IDC_ALLOWMIDSIDE) == BST_CHECKED ? 1 : 0;
-		config->useTns = IsDlgButtonChecked(hWnd, IDC_USETNS) == BST_CHECKED ? 1 : 0;
-		config->useLtp = IsDlgButtonChecked(hWnd, IDC_USELTP) == BST_CHECKED ? 1 : 0;
-		GetDlgItemText(hWnd, IDC_BITRATE, szTemp, sizeof(szTemp));
-		config->bitRate = atoi(szTemp);
-		GetDlgItemText(hWnd, IDC_BANDWIDTH, szTemp, sizeof(szTemp));
-		config->bandWidth = atoi(szTemp);
-
-		faacEncSetConfiguration(hEncoder, config);
-
-		faacEncClose(hEncoder);
-	} else {
-		MessageBeep(1);
-	}
+	EnableWindow(GetDlgItem(hWnd, IDOK), TRUE);
 }
 
 static DWORD WINAPI EncodeFile(LPVOID pParam)
@@ -182,6 +155,9 @@
 			config->useTns = IsDlgButtonChecked(hWnd, IDC_USETNS) == BST_CHECKED ? 1 : 0;
 			config->useLfe = IsDlgButtonChecked(hWnd, IDC_USELFE) == BST_CHECKED ? 1 : 0;
 			config->useLtp = IsDlgButtonChecked(hWnd, IDC_USELTP) == BST_CHECKED ? 1 : 0;
+			config->aacProfile = IsDlgButtonChecked(hWnd, IDC_LC) == BST_CHECKED ? LOW : 0;
+			config->aacProfile = IsDlgButtonChecked(hWnd, IDC_MAIN) == BST_CHECKED ? MAIN : 0;
+			config->aacProfile = IsDlgButtonChecked(hWnd, IDC_SSR) == BST_CHECKED ? SSR : 0;
 			GetDlgItemText(hWnd, IDC_BITRATE, szTemp, sizeof(szTemp));
 			config->bitRate = atoi(szTemp);
 			GetDlgItemText(hWnd, IDC_BANDWIDTH, szTemp, sizeof(szTemp));
@@ -235,9 +211,9 @@
 					
 					/* Percentage for Dialog Output */
 					_itoa((int)((float)totalBytesRead * 100.0f / (sfinfo.samples*2*numChannels)),Percentage,10);
-					strcpy(HeaderText,"FAAC GUI: ");
-					strcat(HeaderText,Percentage);
-					strcat(HeaderText,"%");
+					lstrcpy(HeaderText,"FAAC GUI: ");
+					lstrcat(HeaderText,Percentage);
+					lstrcat(HeaderText,"%");
 					SendMessage(hWnd,WM_SETTEXT,0,(long)HeaderText);
 					
 					totalBytesRead += bytesInput;
@@ -316,6 +292,7 @@
 
 		inputFilename [0] = 0x00;
 
+		CheckDlgButton(hWnd, IDC_MAIN, TRUE);
 		CheckDlgButton(hWnd, IDC_ALLOWMIDSIDE, TRUE);
 		CheckDlgButton(hWnd, IDC_USELFE, FALSE);
 		CheckDlgButton(hWnd, IDC_USETNS, TRUE);
--- a/frontend/resource.h
+++ b/frontend/resource.h
@@ -17,6 +17,9 @@
 #define IDC_USETNS                      1012
 #define IDC_USELTP                      1013
 #define IDC_COMPILEDATE                 1018
+#define IDC_MAIN                        1019
+#define IDC_LC                          1020
+#define IDC_SSR                         1021
 
 // Next default values for new objects
 // 
@@ -24,7 +27,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        103
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1019
+#define _APS_NEXT_CONTROL_VALUE         1020
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
--- a/libfaac/psych.c
+++ b/libfaac/psych.c
@@ -16,11 +16,15 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: psych.c,v 1.8 2001/03/06 14:01:36 menno Exp $
+ * $Id: psych.c,v 1.9 2001/03/06 21:02:33 menno Exp $
  */
 
 #include <malloc.h>
+#include <memory.h>
 #include <math.h>
+#ifdef _DEBUG
+#include <stdio.h>
+#endif
 
 #include "psych.h"
 #include "coder.h"