shithub: aacenc

Download patch

ref: 54dec49e09eecaa5416e543cd32af317502f8c59
parent: 6c834f6664f6615423892aa5e73cd067d08eeef7
author: menno <menno>
date: Tue Feb 25 05:51:59 EST 2003

Frontend now doesn't use libsndfile anymore

--- a/frontend/faacgui.dsp
+++ b/frontend/faacgui.dsp
@@ -43,7 +43,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../include" /I "../common/libsndfile/src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../include" /I "../common/libsndfile/src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x413 /d "NDEBUG"
@@ -93,6 +93,10 @@
 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
 # Begin Source File
 
+SOURCE=.\input.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\maingui.c
 # End Source File
 # End Group
@@ -106,6 +110,10 @@
 # Begin Source File
 
 SOURCE=..\include\faac.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\input.h
 # End Source File
 # Begin Source File
 
--- a/frontend/faacgui.dsw
+++ b/frontend/faacgui.dsw
@@ -33,18 +33,6 @@
 
 ###############################################################################
 
-Project: "libsndfile"=..\common\libsndfile\Win32\libsndfile.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
 Global:
 
 Package=<5>
--- a/frontend/maingui.c
+++ b/frontend/maingui.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: maingui.c,v 1.18 2001/10/26 11:21:23 menno Exp $
+ * $Id: maingui.c,v 1.19 2003/02/25 10:51:59 menno Exp $
  */
 
 #include <windows.h>
@@ -24,7 +24,7 @@
 #include <commctrl.h>
 #include <stdlib.h>
 
-#include <sndfile.h>  /* http://www.zip.com.au/~erikd/libsndfile/ */
+#include "input.h"
 
 #include <faac.h>
 #include "resource.h"
@@ -89,19 +89,18 @@
 static void AwakeDialogControls(HWND hWnd)
 {
     char szTemp[64];
-    SNDFILE *infile;
-    SF_INFO sfinfo;
+    pcmfile_t *infile = NULL;
     unsigned int sampleRate, numChannels;
     char *pExt;
 
-    if ((infile = sf_open_read(inputFilename, &sfinfo)) == NULL)
+    if ((infile = wav_open_read(inputFilename)) == NULL)
         return;
 
     /* determine input file parameters */
-    sampleRate = sfinfo.samplerate;
-    numChannels = sfinfo.channels;
+    sampleRate = infile->samplerate;
+    numChannels = infile->channels;
 
-    sf_close(infile);
+    wav_close(infile);
 
     SetDlgItemText (hWnd, IDC_INPUTFILENAME, inputFilename);
 
@@ -126,18 +125,17 @@
 static DWORD WINAPI EncodeFile(LPVOID pParam)
 {
     HWND hWnd = (HWND) pParam;
-    SNDFILE *infile;
-    SF_INFO sfinfo;
+    pcmfile_t *infile = NULL;
 
     GetDlgItemText(hWnd, IDC_INPUTFILENAME, inputFilename, sizeof(inputFilename));
     GetDlgItemText(hWnd, IDC_OUTPUTFILENAME, outputFilename, sizeof(outputFilename));
 
     /* open the input file */
-    if ((infile = sf_open_read(inputFilename, &sfinfo)) != NULL)
+    if ((infile = wav_open_read(inputFilename)) != NULL)
     {
         /* determine input file parameters */
-        unsigned int sampleRate = sfinfo.samplerate;
-        unsigned int numChannels = sfinfo.channels;
+        unsigned int sampleRate = infile->samplerate;
+        unsigned int numChannels = infile->channels;
 
         unsigned long inputSamples;
         unsigned long maxOutputBytes;
@@ -172,7 +170,7 @@
             if (!faacEncSetConfiguration(hEncoder, config))
             {
                 faacEncClose(hEncoder);
-                sf_close(infile);
+                wav_close(infile);
 
                 MessageBox (hWnd, "faacEncSetConfiguration failed!", "Error", MB_OK | MB_ICONSTOP);
 
@@ -210,12 +208,12 @@
                     int bytesWritten;
                     UINT timeElapsed, timeEncoded;
 
-                    bytesInput = sf_read_short(infile, pcmbuf, inputSamples) * sizeof(short);
+                    bytesInput = wav_read_short(infile, pcmbuf, inputSamples) * sizeof(short);
 
-                    SendDlgItemMessage (hWnd, IDC_PROGRESS, PBM_SETPOS, (unsigned long)((float)totalBytesRead * 1024.0f / (sfinfo.samples*2*numChannels)), 0);
+                    SendDlgItemMessage (hWnd, IDC_PROGRESS, PBM_SETPOS, (unsigned long)((float)totalBytesRead * 1024.0f / (infile->samples*2*numChannels)), 0);
 
                     /* Percentage for Dialog Output */
-                    _itoa((int)((float)totalBytesRead * 100.0f / (sfinfo.samples*2*numChannels)),Percentage,10);
+                    _itoa((int)((float)totalBytesRead * 100.0f / (infile->samples*2*numChannels)),Percentage,10);
                     lstrcpy(HeaderText,"FAAC GUI: ");
                     lstrcat(HeaderText,Percentage);
                     lstrcat(HeaderText,"%");
@@ -275,7 +273,7 @@
             faacEncClose(hEncoder);
         }
 
-        sf_close(infile);
+        wav_close(infile);
         MessageBeep(1);
 
         SendDlgItemMessage(hWnd, IDC_PROGRESS, PBM_SETPOS, 0, 0);