~ubuntu-branches/ubuntu/oneiric/faac/oneiric

« back to all changes in this revision

Viewing changes to frontend/maingui.c

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-01-06 22:47:35 UTC
  • mfrom: (0.1.3 hoary) (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080106224735-jhb3ptzjfm2j7n89
Tags: 1.26-0.1ubuntu1
* Sync from debian-multimedia
* Ubuntu Changes:
 - Maintainer Spec
 - Versioned mp4v2 dep

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * License along with this library; if not, write to the Free Software
17
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 *
19
 
 * $Id: maingui.c,v 1.20 2003/03/27 17:11:33 knik Exp $
 
19
 * $Id: maingui.c,v 1.21 2007/03/19 19:57:40 menno Exp $
20
20
 */
21
21
 
22
22
#include <windows.h>
93
93
    unsigned int sampleRate, numChannels;
94
94
    char *pExt;
95
95
 
96
 
    if ((infile = wav_open_read(inputFilename)) == NULL)
 
96
    if ((infile = wav_open_read(inputFilename, 0)) == NULL)
97
97
        return;
98
98
 
99
99
    /* determine input file parameters */
131
131
    GetDlgItemText(hWnd, IDC_OUTPUTFILENAME, outputFilename, sizeof(outputFilename));
132
132
 
133
133
    /* open the input file */
134
 
    if ((infile = wav_open_read(inputFilename)) != NULL)
 
134
    if ((infile = wav_open_read(inputFilename, 0)) != NULL)
135
135
    {
136
136
        /* determine input file parameters */
137
137
        unsigned int sampleRate = infile->samplerate;
203
203
 
204
204
                unsigned int bytesInput = 0;
205
205
                DWORD numberOfBytesWritten = 0;
206
 
                short *pcmbuf;
 
206
                int *pcmbuf;
207
207
                unsigned char *bitbuf;
208
208
                char HeaderText[50];
209
209
                char Percentage[5];
210
210
 
211
 
                pcmbuf = (short*)LocalAlloc(0, inputSamples*sizeof(short));
 
211
                pcmbuf = (short*)LocalAlloc(0, inputSamples*sizeof(int));
212
212
                bitbuf = (unsigned char*)LocalAlloc(0, maxOutputBytes*sizeof(unsigned char));
213
213
 
214
214
                SendDlgItemMessage(hWnd, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, 1024));
219
219
                    int bytesWritten;
220
220
                    UINT timeElapsed, timeEncoded;
221
221
 
222
 
                    bytesInput = wav_read_short(infile, pcmbuf, inputSamples) * sizeof(short);
 
222
                    bytesInput = wav_read_int24(infile, pcmbuf, inputSamples, NULL) * sizeof(int);
223
223
 
224
 
                    SendDlgItemMessage (hWnd, IDC_PROGRESS, PBM_SETPOS, (unsigned long)((float)totalBytesRead * 1024.0f / (infile->samples*2*numChannels)), 0);
 
224
                    SendDlgItemMessage (hWnd, IDC_PROGRESS, PBM_SETPOS, (unsigned long)((float)totalBytesRead * 1024.0f / (infile->samples*sizeof(int)*numChannels)), 0);
225
225
 
226
226
                    /* Percentage for Dialog Output */
227
 
                    _itoa((int)((float)totalBytesRead * 100.0f / (infile->samples*2*numChannels)),Percentage,10);
 
227
                    _itoa((int)((float)totalBytesRead * 100.0f / (infile->samples*sizeof(int)*numChannels)),Percentage,10);
228
228
                    lstrcpy(HeaderText,"FAAC GUI: ");
229
229
                    lstrcat(HeaderText,Percentage);
230
230
                    lstrcat(HeaderText,"%");
233
233
                    totalBytesRead += bytesInput;
234
234
 
235
235
                    timeElapsed = (GetTickCount () - startTime) / 10;
236
 
                    timeEncoded = 100.0 * totalBytesRead / (sampleRate * numChannels * sizeof (short));
 
236
                    timeEncoded = 100.0 * totalBytesRead / (sampleRate * numChannels * sizeof (int));
237
237
 
238
238
                    if (timeElapsed > (lastUpdated + 20))
239
239
                    {
259
259
                    /* call the actual encoding routine */
260
260
                    bytesWritten = faacEncEncode(hEncoder,
261
261
                        pcmbuf,
262
 
                        bytesInput/2,
 
262
                        bytesInput/sizeof(int),
263
263
                        bitbuf,
264
264
                        maxOutputBytes);
265
265
 
334
334
 
335
335
        SendMessage(GetDlgItem(hWnd, IDC_MPEGVERSION), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"MPEG4");
336
336
        SendMessage(GetDlgItem(hWnd, IDC_MPEGVERSION), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"MPEG2");
337
 
        SendMessage(GetDlgItem(hWnd, IDC_MPEGVERSION), CB_SETCURSEL, 1, 0);
 
337
        SendMessage(GetDlgItem(hWnd, IDC_MPEGVERSION), CB_SETCURSEL, 0, 0);
338
338
 
339
 
        SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"Main");
 
339
//        SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"Main");
340
340
        SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"Low Complexity");
341
 
        SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"LTP");
342
 
        SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_SETCURSEL, 1, 0);
 
341
//        SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)"LTP");
 
342
        SendMessage(GetDlgItem(hWnd, IDC_OBJECTTYPE), CB_SETCURSEL, 0, 0);
343
343
 
344
344
        CheckDlgButton(hWnd, IDC_ALLOWMIDSIDE, TRUE);
345
345
        CheckDlgButton(hWnd, IDC_USELFE, FALSE);