ref: b5e3eb770b7171e177583462d777d4ff10d6e9e9
parent: 8757a20d2b93d63236b8e7bb85df85596b75b238
author: menno <menno>
date: Tue Oct 16 09:24:41 EDT 2001
Bugfixes by 4N
--- 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.1 2001/10/11 09:53:44 menno Exp $
+ * $Id: aacinfo.c,v 1.3 2001/10/29 10:01:31 menno Exp $
*/
#include <windows.h>
--- a/plugins/cooledit/aacinfo.h
+++ b/plugins/cooledit/aacinfo.h
@@ -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.h,v 1.1 2001/10/11 09:53:44 menno Exp $
+ * $Id: aacinfo.h,v 1.7 2002/08/22 22:58:57 menno Exp $
*/
typedef struct {
--- a/plugins/cooledit/faac.c
+++ b/plugins/cooledit/faac.c
@@ -5,9 +5,8 @@
#include "faac.h"
-#define PI_VER "v1.0beta"
+#define PI_VER "v1.0 beta2"
-
extern void config_init();
extern void config_read(DWORD *dwOptions);
extern void config_write(DWORD dwOptions);
@@ -28,10 +27,20 @@
unsigned char *bitbuf;
DWORD maxBytesOutput;
long samplesInput;
- BOOL bStopEnc;
+ 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)
{
@@ -82,7 +91,7 @@
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_SSR), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), Enabled);
@@ -107,7 +116,8 @@
CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE);
break;
case 3:
- CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE);
+ CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE);
+ DISABLE_LTP
break;
}
@@ -130,9 +140,11 @@
{
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);
@@ -155,7 +167,7 @@
break;
}
}
- break; // End of WM_INITDIALOG
+ break; // End of WM_INITDIALOG
case WM_CLOSE:
// Closing the Dialog behaves the same as Cancel
@@ -172,7 +184,7 @@
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_SSR), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), Enabled);
@@ -179,6 +191,11 @@
// 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;
@@ -186,6 +203,7 @@
{
DWORD retVal=0;
faacEncConfiguration faacEncCfg;
+
if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4))
{
faacEncCfg.mpegVersion=MPEG4;
@@ -259,6 +277,15 @@
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_MPEG2:
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE);
+ DISABLE_LTP
+ break;
}
break; // End of WM_COMMAND
default: return FALSE;
@@ -266,6 +293,8 @@
return TRUE;
} // End of DIALOGSMsgProc
+
+
__declspec(dllexport) DWORD FAR PASCAL FilterGetOptions(HWND hWnd, HINSTANCE hInst, long lSamprate, WORD wChannels, WORD wBitsPerSample, DWORD dwOptions) // return 0 if no options box
{
long nDialogReturn=0;
@@ -406,7 +435,7 @@
myFormat->allowMidside=(dwOptions>>26)&1;
myFormat->useTns=(dwOptions>>25)&1;
myFormat->useLfe=(dwOptions>>24)&1;
- switch((dwOptions>>1)&31)
+ switch((dwOptions>>19)&31)
{
case 0:
myFormat->bitRate=8000;
@@ -494,10 +523,13 @@
if(bytesEncoded<1) // end of flushing process
{
if(bytesEncoded<0)
+ {
MessageBox(0, "faacEncEncode() failed", "FAAC interface", MB_OK);
- mo->bStopEnc=1;
+ mo->bStopEnc=1;
+ }
+ bytesWritten=lBytes ? 1 : 0; // bytesWritten==0 stops CoolEdit...
GlobalUnlock(hOutput);
- return 0;
+ return bytesWritten;
}
// write bitstream to aac file
bytesWritten=fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
--- a/plugins/cooledit/resource.h
+++ b/plugins/cooledit/resource.h
@@ -4,21 +4,12 @@
//
#define IDD_COMPRESSION 101
#define IDB_LOGO 104
-#define IDC_RADIO1 1000
#define IDC_RADIO_MPEG4 1000
-#define IDC_RADIO2 1001
#define IDC_RADIO_MPEG2 1001
-#define IDC_RADIO4 1002
#define IDC_RADIO_LOW 1002
-#define IDC_RADIO3 1003
#define IDC_RADIO_MAIN 1003
-#define IDC_RADIO5 1004
#define IDC_RADIO_SSR 1004
-#define IDC_RADIO6 1005
#define IDC_RADIO_LTP 1005
-#define IDC_RADIO7 1006
-#define IDC_RADIO8 1007
-#define IDC_RADIO9 1008
#define IDC_ALLOWMIDSIDE 1011
#define IDC_USETNS 1012
#define IDC_USELFE 1013
--- a/plugins/winamp/AACINFO.C
+++ b/plugins/winamp/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.1 2001/10/11 09:53:44 menno Exp $
+ * $Id: AACINFO.C,v 1.2 2001/10/16 13:24:23 menno Exp $
*/
#include <windows.h>
--- a/plugins/winamp/AACINFO.H
+++ b/plugins/winamp/AACINFO.H
@@ -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.H,v 1.1 2001/10/11 09:53:44 menno Exp $
+ * $Id: AACINFO.H,v 1.2 2001/10/16 13:24:28 menno Exp $
*/
typedef struct {
--- a/plugins/winamp/FAAC.rc
+++ b/plugins/winamp/FAAC.rc
@@ -57,8 +57,8 @@
WS_TABSTOP
EDITTEXT IDC_E_BROWSE,57,103,94,14,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BTN_BROWSE,156,103,18,14,BS_BITMAP
- DEFPUSHBUTTON "OK",IDOK,65,123,36,14
- PUSHBUTTON "Cancel",IDCANCEL,101,123,36,14
+ DEFPUSHBUTTON "OK",IDOK,66,123,36,14
+ PUSHBUTTON "Cancel",IDCANCEL,102,123,36,14
PUSHBUTTON "About",IDC_BTN_ABOUT,138,123,36,14
GROUPBOX "AAC type",IDC_STATIC,4,18,48,38
GROUPBOX "Profile",IDC_STATIC,4,63,48,59
--- a/plugins/winamp/Out_faac.c
+++ b/plugins/winamp/Out_faac.c
@@ -2,17 +2,30 @@
#include <shlobj.h>
#include <stdio.h> // FILE *
#include "resource.h"
-#include <faac.h>
+#include "faac.h"
#include "out.h"
-#define PI_VER "v1.0beta"
+#define PI_VER "v1.0 beta2"
-
extern void config_read();
extern void config_write();
-int getwrittentime();
+void Config(HWND);
+void About(HWND);
+void Init();
+void Quit();
+int Open(int, int, int, int, int);
+void Close();
+int Write(char*, int);
+int CanWrite();
+int IsPlaying();
+int Pause(int);
+void SetVolume(int);
+void SetPan(int);
+void Flush(int);
+int GetOutputTime();
+int GetWrittenTime();
typedef struct output_tag // any special vars associated with output file
@@ -30,7 +43,7 @@
unsigned char *bitbuf;
DWORD maxBytesOutput;
long samplesInput;
- BOOL bStopEnc;
+ BYTE bStopEnc;
unsigned char *inbuf;
DWORD full_size; // size of decoded file needed to set the length of progress bar
@@ -41,11 +54,10 @@
DWORD bytes_Enc;
} MYOUTPUT;
-Out_Module out;
char config_AACoutdir[MAX_PATH]="";
DWORD dwOptions;
static MYOUTPUT mo0,
- *mo=&mo0; // this is done to drag'n'drop code from CoolEdit plugin
+ *mo=&mo0; // this is done to copy'n'paste code from CoolEdit plugin
static HBITMAP hBmBrowse=NULL;
static int srate, numchan, bps;
volatile int writtentime, w_offset;
@@ -52,7 +64,36 @@
static int last_pause=0;
+Out_Module out = {
+ OUT_VER,
+ "Freeware AAC encoder " PI_VER,
+ 34,
+ NULL, // hmainwindow
+ NULL, // hdllinstance
+ Config,
+ About,
+ Init,
+ Quit,
+ Open,
+ Close,
+ Write,
+ CanWrite,
+ IsPlaying,
+ Pause,
+ SetVolume,
+ SetPan,
+ Flush,
+ GetWrittenTime,
+ GetWrittenTime
+};
+__declspec( dllexport ) Out_Module * winampGetOutModule()
+{
+ return &out;
+}
+
+
+
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ulReason, LPVOID lpReserved)
{
switch(ulReason)
@@ -117,6 +158,8 @@
return TRUE; // successful DLL_PROCESS_ATTACH
}
+
+
static int CALLBACK WINAPI BrowseCallbackProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if (uMsg == BFFM_INITIALIZED)
@@ -127,6 +170,16 @@
return 0;
}
+#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); \
+}
static BOOL CALLBACK DIALOGMsgProc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
{
@@ -171,7 +224,7 @@
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_SSR), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), Enabled);
@@ -197,6 +250,7 @@
break;
case 3:
CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE);
+ DISABLE_LTP
break;
}
@@ -219,9 +273,11 @@
{
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);
@@ -261,7 +317,7 @@
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_SSR), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), Enabled);
@@ -268,6 +324,10 @@
// 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;
@@ -311,21 +371,24 @@
retVal|=MPEG2<<29;
}
if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MAIN))
- faacEncCfg.aacObjectType=0;
+ {
+ faacEncCfg.aacObjectType=MAIN;
+ retVal|=MAIN<<27;
+ }
if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LOW))
{
faacEncCfg.aacObjectType=LOW;
- retVal|=1<<27;
+ retVal|=LOW<<27;
}
if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_SSR))
{
- faacEncCfg.aacObjectType=2;
- retVal|=2<<27;
+ faacEncCfg.aacObjectType=SSR;
+ retVal|=SSR<<27;
}
if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP))
{
- faacEncCfg.aacObjectType=3;
- retVal|=3<<27;
+ faacEncCfg.aacObjectType=LTP;
+ retVal|=LTP<<27;
}
faacEncCfg.allowMidside=IsDlgButtonChecked(hWndDlg, IDC_ALLOWMIDSIDE) == BST_CHECKED ? 1 : 0;
@@ -366,6 +429,15 @@
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_MPEG2:
+ EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE);
+ DISABLE_LTP
+ break;
}
break; // End of WM_COMMAND
default: return FALSE;
@@ -375,7 +447,7 @@
-void config(HWND hWnd)
+void Config(HWND hWnd)
{
dwOptions=DialogBox(out.hDllInstance, MAKEINTRESOURCE(IDD_COMPRESSION), hWnd, DIALOGMsgProc);
// dwOptions=DialogBoxParam((HINSTANCE)out.hDllInstance,(LPCSTR)MAKEINTRESOURCE(IDD_COMPRESSION), (HWND)hWnd, (DLGPROC)DIALOGMsgProc, dwOptions);
@@ -382,7 +454,7 @@
config_write();
}
-void about(HWND hwnd)
+void About(HWND hwnd)
{
char buf[256];
sprintf(buf,"AAC-MPEG4 encoder plug-in %s\nThis plugin uses FAAC encoder engine v%g\n\nCompiled on %s\n",
@@ -390,17 +462,14 @@
FAACENC_VERSION,
__DATE__);
MessageBox(hwnd, buf, "About", MB_OK);
-/* MessageBox(hwnd,"AAC-MPEG4 encoder plug-in " PI_VER "\n"
- "This plugin uses FAAC encoder engine v1.5\n\n"
- "Compiled on " __DATE__ "\n","About",MB_OK);*/
}
-void init()
+void Init()
{
config_read();
}
-void quit()
+void Quit()
{
}
@@ -420,7 +489,7 @@
}
}
-int open(int lSamprate, int wChannels, int wBitsPerSample, int bufferlenms, int prebufferms)
+int Open(int lSamprate, int wChannels, int wBitsPerSample, int bufferlenms, int prebufferms)
{
//HANDLE hOutput;
faacEncHandle hEncoder;
@@ -474,7 +543,7 @@
if (p[0]) while (p[1]) p++;
if (!config_AACoutdir[0] || config_AACoutdir[0] == ' ')
- config(out.hMainWindow);
+ Config(out.hMainWindow);
if (!config_AACoutdir[0])
wsprintf(lpstrFilename,"%s.aac",temp2);
else if (p[0]=='\\')
@@ -512,7 +581,7 @@
return -1;
}
- if(!(mo->inbuf=(unsigned char*)malloc(sizeof(short)*1024*wChannels)))
+ if(!(mo->inbuf=(unsigned char*)malloc(samplesInput*sizeof(short))))
{
MessageBox(0, "Memory allocation error: output buffer", "FAAC interface", MB_OK);
faacEncClose(hEncoder);
@@ -521,43 +590,23 @@
return -1;
}
-// *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);
mo->hEncoder=hEncoder;
mo->bitbuf=bitbuf;
mo->maxBytesOutput=maxBytesOutput;
- mo->samplesInput=samplesInput*(sizeof(short));
+ mo->samplesInput=samplesInput;
mo->bStopEnc=0;
-// GlobalUnlock(hOutput);
-/* }
- else
- {
- MessageBox(0, "hOutput=NULL", "FAAC interface", MB_OK);
- faacEncClose(hEncoder);
- fclose(outfile);
- free(bitbuf);
- free(mo->inbuf);
- return -1;
- }*/
if(dwOptions && !(dwOptions&1))
{
- faacEncConfigurationPtr myFormat;
+ faacEncConfigurationPtr myFormat;
myFormat=faacEncGetCurrentConfiguration(hEncoder);
myFormat->mpegVersion=(dwOptions>>29)&7;
@@ -565,7 +614,6 @@
myFormat->allowMidside=(dwOptions>>26)&1;
myFormat->useTns=(dwOptions>>25)&1;
myFormat->useLfe=(dwOptions>>24)&1;
-
switch((dwOptions>>19)&31)
{
case 0:
@@ -659,9 +707,11 @@
return 0;
}
-void close()
+void Close()
{
- if(mo->bytes_into_buffer)
+// Following code crashes winamp. why???
+
+if(mo->bytes_into_buffer)
{
int bytesEncoded;
bytesEncoded=faacEncEncode(mo->hEncoder, (short *)mo->inbuf, mo->bytes_into_buffer/sizeof(short), mo->bitbuf, mo->maxBytesOutput);
@@ -681,29 +731,18 @@
// CloseHandle(outfile);
}
-int write(char *buf, int len)
+int Write(char *buf, int len)
{
int bytesWritten;
int bytesEncoded;
int k,i,shift=0;
-// int t;
- writtentime += len;
-
-// WriteFile(outfile,buf,len,&t,NULL);
-
-
-/* if(hOutput)
- {
- MYOUTPUT far *mo;
- mo=(MYOUTPUT far *)GlobalLock(hOutput);*/
-
+ writtentime += len;
+
if(!mo->bStopEnc)
{
-// if(writtentime>mo->lSize)
-// return 0;
- if(mo->bytes_into_buffer+len<mo->samplesInput)
+ if(mo->bytes_into_buffer+len<mo->samplesInput*sizeof(short))
{
memcpy(mo->inbuf+mo->bytes_into_buffer, buf, len);
mo->bytes_into_buffer+=len;
@@ -710,80 +749,81 @@
return 0;
}
else
- {
- memcpy(mo->inbuf+mo->bytes_into_buffer, buf, mo->samplesInput-mo->bytes_into_buffer);
- shift=mo->samplesInput-mo->bytes_into_buffer;
- mo->bytes_into_buffer+=shift;
- len-=shift;
- buf+=shift;
+ if(mo->bytes_into_buffer)
+ {
+ shift=mo->samplesInput*sizeof(short)-mo->bytes_into_buffer;
+ memcpy(mo->inbuf+mo->bytes_into_buffer, buf, shift);
+ mo->bytes_into_buffer+=shift;
+ buf+=shift;
+ len-=shift;
- bytesEncoded=faacEncEncode(mo->hEncoder, (short *)mo->inbuf, mo->samplesInput/sizeof(short), mo->bitbuf, mo->maxBytesOutput);
- mo->bytes_into_buffer=0;
+ bytesEncoded=faacEncEncode(mo->hEncoder, (short *)mo->inbuf, mo->samplesInput, mo->bitbuf, mo->maxBytesOutput);
+ mo->bytes_into_buffer=0;
+ if(bytesEncoded<1) // end of flushing process
+ {
+ if(bytesEncoded<0)
+ {
+ MessageBox(0, "faacEncEncode() failed", "FAAC interface", MB_OK);
+ mo->bStopEnc=1;
+ }
+ bytesWritten=len ? 0 : -1;
+ 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;
+ return -1;
+ }
+ }
+
+// call the actual encoding routine
+ k=len/(mo->samplesInput*sizeof(short));
+ for(i=0; i<k; i++)
+ {
+ bytesEncoded+=faacEncEncode(mo->hEncoder, ((short *)buf)+i*mo->samplesInput, 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=len ? 0 : -1;
+ 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 -1;
}
}
- if(mo->bytes_into_buffer)
- {
- if(bytesEncoded<0)
- MessageBox(0, "bytes_into_buffer>0", "FAAC interface", MB_OK);
- mo->bStopEnc=1;
-// GlobalUnlock(hOutput);
- return -1;
- }
-
-// call the actual encoding routine
- k=len/mo->samplesInput;
- for(i=0; i<k; i++)
- bytesEncoded+=faacEncEncode(mo->hEncoder, (short *)(buf+i*mo->samplesInput), mo->samplesInput/sizeof(short), mo->bitbuf, mo->maxBytesOutput);
- memcpy(mo->inbuf+mo->bytes_into_buffer, buf, len%mo->samplesInput);
- mo->bytes_into_buffer+=len%mo->samplesInput;
- if(bytesEncoded<1) // end of flushing process
- {
- if(bytesEncoded<0)
- MessageBox(0, "faacEncEncode() failed", "FAAC interface", MB_OK);
- mo->bStopEnc=1;
-// GlobalUnlock(hOutput);
- return -1;
- }
-// 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 -1;
- }
-
-// GlobalUnlock(hOutput);
+ mo->bytes_into_buffer=len%(mo->samplesInput*sizeof(short));
+ memcpy(mo->inbuf, buf+k*mo->samplesInput*sizeof(short), mo->bytes_into_buffer);
}
-// }
-
- Sleep(0);
- return 0;
+ Sleep(0);
+ return 0;
}
-int canwrite()
+int CanWrite()
{
return last_pause ? 0 : 16*1024*1024;
// return last_pause ? 0 : mo->samplesInput;
-// return mo->samplesInput;
}
-int isplaying()
+int IsPlaying()
{
return 0;
}
-int pause(int pause)
+int Pause(int pause)
{
int t=last_pause;
last_pause=pause;
@@ -790,23 +830,23 @@
return t;
}
-void setvolume(int volume)
+void SetVolume(int volume)
{
}
-void setpan(int pan)
+void SetPan(int pan)
{
}
-void flush(int t)
+void Flush(int t)
{
int a;
w_offset=0;
- a = t - getwrittentime();
+ a = t - GetWrittenTime();
w_offset=a;
}
-int getwrittentime()
+int GetWrittenTime()
{
int t=srate*numchan,l;
int ms=writtentime;
@@ -819,32 +859,4 @@
if (bps == 16) ms/=2;
return ms + w_offset;
-}
-
-Out_Module out = {
- OUT_VER,
- "Freeware AAC encoder " PI_VER,
- 33,
- 0, // hmainwindow
- 0, // hdllinstance
- config,
- about,
- init,
- quit,
- open,
- close,
- write,
- canwrite,
- isplaying,
- pause,
- setvolume,
- setpan,
- flush,
- getwrittentime,
- getwrittentime
-};
-
-__declspec( dllexport ) Out_Module * winampGetOutModule()
-{
- return &out;
}
--- a/plugins/winamp/RESOURCE.H
+++ b/plugins/winamp/RESOURCE.H
@@ -5,22 +5,12 @@
#define IDD_COMPRESSION 101
#define IDB_LOGO 104
#define IDB_BROWSE 106
-#define IDB_OPEN 107
-#define IDC_RADIO1 1000
#define IDC_RADIO_MPEG4 1000
-#define IDC_RADIO2 1001
#define IDC_RADIO_MPEG2 1001
-#define IDC_RADIO4 1002
#define IDC_RADIO_LOW 1002
-#define IDC_RADIO3 1003
#define IDC_RADIO_MAIN 1003
-#define IDC_RADIO5 1004
#define IDC_RADIO_SSR 1004
-#define IDC_RADIO6 1005
#define IDC_RADIO_LTP 1005
-#define IDC_RADIO7 1006
-#define IDC_RADIO8 1007
-#define IDC_RADIO9 1008
#define IDC_ALLOWMIDSIDE 1011
#define IDC_USETNS 1012
#define IDC_USELFE 1013