shithub: aacenc

Download patch

ref: ba4a9a4055cf652475e2befa88720e0d0c0c8a50
parent: 1a6bd6cbe1228ec224e35870cac5420de00903f0
author: menno <menno>
date: Sun May 26 14:31:22 EDT 2002

Fixes in faac winamp plugin

--- a/plugins/winamp/AACINFO.C
+++ /dev/null
@@ -1,249 +1,0 @@
-/*
- * FAAC - Freeware Advanced Audio Decoder
- * Copyright (C) 2001 Menno Bakker
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * 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.2 2001/10/16 13:24:23 menno Exp $
- */
-
-#include <windows.h>
-#include "aacinfo.h"
-
-#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 int read_ADIF_header(HANDLE file, FAACAACInfo *info)
-{
-	unsigned long tmp;
-	int bitstream;
-	unsigned char buffer[ADIF_MAX_SIZE];
-	int skip_size = 0;
-	int sf_idx;
-
-	/* Get ADIF header data */
-	
-	info->headertype = 1;
-
-	ReadFile(file, buffer, ADIF_MAX_SIZE, &tmp, 0);
-
-	/* copyright string */	
-	if(buffer[4] & 128)
-		skip_size += 9; /* skip 9 bytes */
-
-	bitstream = buffer[4 + skip_size] & 16;
-	info->bitrate = ((unsigned int)(buffer[4 + skip_size] & 0x0F)<<19)|
-		((unsigned int)buffer[5 + skip_size]<<11)|
-		((unsigned int)buffer[6 + skip_size]<<3)|
-		((unsigned int)buffer[7 + skip_size] & 0xE0);
-
-	if (bitstream == 0) {
-		info->object_type = ((buffer[9 + skip_size]&0x01)<<1)|((buffer[10 + skip_size]&0x80)>>7);
-		sf_idx = (buffer[10 + skip_size]&0x78)>>3;
-		info->channels = ((buffer[10 + skip_size]&0x07)<<1)|((buffer[11 + skip_size]&0x80)>>7);
-	} else {
-		info->object_type = (buffer[7 + skip_size] & 0x18)>>3;
-		sf_idx = ((buffer[7 + skip_size] & 0x07)<<1)|((buffer[8 + skip_size] & 0x80)>>7);
-		info->channels = (buffer[8 + skip_size]&0x78)>>3;
-	}
-	info->sampling_rate = sample_rates[sf_idx];
-
-	return 0;
-}
-
-static int read_ADTS_header(HANDLE file, FAACAACInfo *info, int *seek_table,
-							int tagsize)
-{
-	/* Get ADTS header data */
-	unsigned char buffer[ADTS_MAX_SIZE];
-	int frames, t_framelength = 0, frame_length, sr_idx, ID;
-	int second = 0, pos;
-	float frames_per_sec = 0;
-	unsigned long bytes;
-
-	info->headertype = 2;
-
-	/* Seek to the first frame */
-	SetFilePointer(file, tagsize, NULL, FILE_BEGIN);
-
-	/* Read all frames to ensure correct time and bitrate */
-	for(frames=0; /* */; frames++)
-	{
-		/* 12 bit SYNCWORD */
-		ReadFile(file, buffer, ADTS_MAX_SIZE, &bytes, 0);
-		if(bytes != ADTS_MAX_SIZE)
-		{
-			/* Bail out if no syncword found */
-			break;
-		}
-
-		if (!((buffer[0] == 0xFF)&&((buffer[1] & 0xF6) == 0xF0)))
-			break;
-
-		pos = SetFilePointer(file, 0, NULL, FILE_CURRENT) - ADTS_MAX_SIZE;
-
-		if(!frames)
-		{
-			/* fixed ADTS header is the same for every frame, so we read it only once */ 
-			/* Syncword found, proceed to read in the fixed ADTS header */ 
-			ID = buffer[1] & 0x08;
-			info->object_type = (buffer[2]&0xC0)>>6;
-			sr_idx = (buffer[2]&0x3C)>>2;
-			info->channels = ((buffer[2]&0x01)<<2)|((buffer[3]&0xC0)>>6);
-
-			frames_per_sec = sample_rates[sr_idx] / 1024.f;
-		}
-
-		/* ...and the variable ADTS header */
-		if (ID == 0) {
-			info->version = 4;
-			frame_length = (((unsigned int)buffer[4]) << 5) |
-				((unsigned int)buffer[5] >> 3);
-		} else { /* MPEG-2 */
-			info->version = 2;
-			frame_length = ((((unsigned int)buffer[3] & 0x3)) << 11)
-				| (((unsigned int)buffer[4]) << 3) | (buffer[5] >> 5);
-		}
-
-		t_framelength += frame_length;
-
-		if (frames > second*frames_per_sec)
-		{
-			seek_table[second] = pos;
-			second++;
-		}
-
-		SetFilePointer(file, frame_length - ADTS_MAX_SIZE, NULL, FILE_CURRENT);
-	}
-
-	info->sampling_rate = sample_rates[sr_idx];
-	info->bitrate = (int)(((t_framelength / frames) * (info->sampling_rate/1024.0)) +0.5)*8;
-	info->length = (int)((float)(frames/frames_per_sec))*1000;
-
-	return 0;
-}
-
-static int f_id3v2_tag(HANDLE file)
-{
-	unsigned char buffer[10];
-	unsigned long tmp;
-
-	ReadFile(file, buffer, 10, &tmp, 0);
-
-	if (StringComp(buffer, "ID3", 3) == 0) {
-		unsigned long tagsize;
-
-		/* high bit is not used */
-		tagsize = (buffer[6] << 21) | (buffer[7] << 14) |
-			(buffer[8] <<  7) | (buffer[9] <<  0);
-
-		tagsize += 10;
-
-		SetFilePointer(file, tagsize, NULL, FILE_BEGIN);
-
-		return tagsize;
-	} else {
-		SetFilePointer(file, 0, NULL, FILE_BEGIN);
-
-		return 0;
-	}
-}
-
-int get_AAC_format(char *filename, FAACAACInfo *info, int *seek_table)
-{
-	unsigned int tagsize;
-	HANDLE file;
-	unsigned long file_len;
-	unsigned char adxx_id[5];
-	unsigned long tmp;
-
-	if(StringComp(filename, "http://", 7) == 0)
-	{
-		info->version = 2;
-		info->length = 0;
-		info->bitrate = 128000;
-		info->sampling_rate = 44100;
-		info->channels = 2;
-		info->headertype = 0;
-		info->object_type = 1;
-
-		return 0;
-	}
-
-	file = CreateFile(filename, GENERIC_READ,
-		FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
-		OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0);
-	if (file == INVALID_HANDLE_VALUE)
-		return -1;
-
-	file_len = GetFileSize(file, NULL);
-
-	tagsize = f_id3v2_tag(file); /* Skip the tag, if it's there */
-	file_len -= tagsize;
-
-	ReadFile(file, adxx_id, 4, &tmp, 0);
-	SetFilePointer(file, tagsize, NULL, FILE_BEGIN);
-
-	adxx_id[5-1] = 0;
-
-	info->length = 0;
-
-	if(StringComp(adxx_id, "ADIF", 4) == 0)
-	{
-		read_ADIF_header(file, info);
-	}
-	else
-	{
-		if ((adxx_id[0] == 0xFF)&&((adxx_id[1] & 0xF6) == 0xF0))
-		{
-//			SetFilePointer(file, tagsize, NULL, FILE_BEGIN);
-			read_ADTS_header(file, info, seek_table, tagsize);
-		}
-		else
-		{
-			/* Unknown/headerless AAC file, assume format: */
-			info->version = 2;
-			info->bitrate = 128000;
-			info->sampling_rate = 44100;
-			info->channels = 2;
-			info->headertype = 0;
-			info->object_type = 1;
-		}
-	}
-
-	if (info->length == 0)
-		info->length = (int)((file_len/(((info->bitrate*8)/1024)*16))*1000);
-
-	CloseHandle(file);
-
-	return 0;
-}
-
-int StringComp(char const *str1, char const *str2, unsigned long len)
-{
-	signed int c1 = 0, c2 = 0;
-
-	while (len--) {
-		c1 = *str1++;
-		c2 = *str2++;
-
-		if (c1 == 0 || c1 != c2)
-			break;
-	}
-
-	return c1 - c2;
-}
--- /dev/null
+++ b/plugins/winamp/AACINFO.Cpp
@@ -1,0 +1,249 @@
+/*
+ * FAAC - Freeware Advanced Audio Decoder
+ * Copyright (C) 2001 Menno Bakker
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.Cpp,v 1.1 2002/05/26 18:31:22 menno Exp $
+ */
+
+#include <windows.h>
+#include "aacinfo.h"
+
+#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 int read_ADIF_header(HANDLE file, FAACAACInfo *info)
+{
+	unsigned long tmp;
+	int bitstream;
+	unsigned char buffer[ADIF_MAX_SIZE];
+	int skip_size = 0;
+	int sf_idx;
+
+	/* Get ADIF header data */
+	
+	info->headertype = 1;
+
+	ReadFile(file, buffer, ADIF_MAX_SIZE, &tmp, 0);
+
+	/* copyright string */	
+	if(buffer[4] & 128)
+		skip_size += 9; /* skip 9 bytes */
+
+	bitstream = buffer[4 + skip_size] & 16;
+	info->bitrate = ((unsigned int)(buffer[4 + skip_size] & 0x0F)<<19)|
+		((unsigned int)buffer[5 + skip_size]<<11)|
+		((unsigned int)buffer[6 + skip_size]<<3)|
+		((unsigned int)buffer[7 + skip_size] & 0xE0);
+
+	if (bitstream == 0) {
+		info->object_type = ((buffer[9 + skip_size]&0x01)<<1)|((buffer[10 + skip_size]&0x80)>>7);
+		sf_idx = (buffer[10 + skip_size]&0x78)>>3;
+		info->channels = ((buffer[10 + skip_size]&0x07)<<1)|((buffer[11 + skip_size]&0x80)>>7);
+	} else {
+		info->object_type = (buffer[7 + skip_size] & 0x18)>>3;
+		sf_idx = ((buffer[7 + skip_size] & 0x07)<<1)|((buffer[8 + skip_size] & 0x80)>>7);
+		info->channels = (buffer[8 + skip_size]&0x78)>>3;
+	}
+	info->sampling_rate = sample_rates[sf_idx];
+
+	return 0;
+}
+
+static int read_ADTS_header(HANDLE file, FAACAACInfo *info, int *seek_table,
+							int tagsize)
+{
+	/* Get ADTS header data */
+	unsigned char buffer[ADTS_MAX_SIZE];
+	int frames, t_framelength = 0, frame_length, sr_idx, ID;
+	int second = 0, pos;
+	float frames_per_sec = 0;
+	unsigned long bytes;
+
+	info->headertype = 2;
+
+	/* Seek to the first frame */
+	SetFilePointer(file, tagsize, NULL, FILE_BEGIN);
+
+	/* Read all frames to ensure correct time and bitrate */
+	for(frames=0; /* */; frames++)
+	{
+		/* 12 bit SYNCWORD */
+		ReadFile(file, buffer, ADTS_MAX_SIZE, &bytes, 0);
+		if(bytes != ADTS_MAX_SIZE)
+		{
+			/* Bail out if no syncword found */
+			break;
+		}
+
+		if (!((buffer[0] == 0xFF)&&((buffer[1] & 0xF6) == 0xF0)))
+			break;
+
+		pos = SetFilePointer(file, 0, NULL, FILE_CURRENT) - ADTS_MAX_SIZE;
+
+		if(!frames)
+		{
+			/* fixed ADTS header is the same for every frame, so we read it only once */ 
+			/* Syncword found, proceed to read in the fixed ADTS header */ 
+			ID = buffer[1] & 0x08;
+			info->object_type = (buffer[2]&0xC0)>>6;
+			sr_idx = (buffer[2]&0x3C)>>2;
+			info->channels = ((buffer[2]&0x01)<<2)|((buffer[3]&0xC0)>>6);
+
+			frames_per_sec = sample_rates[sr_idx] / 1024.f;
+		}
+
+		/* ...and the variable ADTS header */
+		if (ID == 0) {
+			info->version = 4;
+			frame_length = (((unsigned int)buffer[4]) << 5) |
+				((unsigned int)buffer[5] >> 3);
+		} else { /* MPEG-2 */
+			info->version = 2;
+			frame_length = ((((unsigned int)buffer[3] & 0x3)) << 11)
+				| (((unsigned int)buffer[4]) << 3) | (buffer[5] >> 5);
+		}
+
+		t_framelength += frame_length;
+
+		if (frames > second*frames_per_sec)
+		{
+			seek_table[second] = pos;
+			second++;
+		}
+
+		SetFilePointer(file, frame_length - ADTS_MAX_SIZE, NULL, FILE_CURRENT);
+	}
+
+	info->sampling_rate = sample_rates[sr_idx];
+	info->bitrate = (int)(((t_framelength / frames) * (info->sampling_rate/1024.0)) +0.5)*8;
+	info->length = (int)((float)(frames/frames_per_sec))*1000;
+
+	return 0;
+}
+
+static int f_id3v2_tag(HANDLE file)
+{
+	unsigned char buffer[10];
+	unsigned long tmp;
+
+	ReadFile(file, buffer, 10, &tmp, 0);
+
+	if (StringComp((const char *)buffer, "ID3", 3) == 0) {
+		unsigned long tagsize;
+
+		/* high bit is not used */
+		tagsize = (buffer[6] << 21) | (buffer[7] << 14) |
+			(buffer[8] <<  7) | (buffer[9] <<  0);
+
+		tagsize += 10;
+
+		SetFilePointer(file, tagsize, NULL, FILE_BEGIN);
+
+		return tagsize;
+	} else {
+		SetFilePointer(file, 0, NULL, FILE_BEGIN);
+
+		return 0;
+	}
+}
+
+int get_AAC_format(char *filename, FAACAACInfo *info, int *seek_table)
+{
+	unsigned int tagsize;
+	HANDLE file;
+	unsigned long file_len;
+	unsigned char adxx_id[5];
+	unsigned long tmp;
+
+	if(StringComp(filename, "http://", 7) == 0)
+	{
+		info->version = 2;
+		info->length = 0;
+		info->bitrate = 128000;
+		info->sampling_rate = 44100;
+		info->channels = 2;
+		info->headertype = 0;
+		info->object_type = 1;
+
+		return 0;
+	}
+
+	file = CreateFile(filename, GENERIC_READ,
+		FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
+		OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0);
+	if (file == INVALID_HANDLE_VALUE)
+		return -1;
+
+	file_len = GetFileSize(file, NULL);
+
+	tagsize = f_id3v2_tag(file); /* Skip the tag, if it's there */
+	file_len -= tagsize;
+
+	ReadFile(file, adxx_id, 4, &tmp, 0);
+	SetFilePointer(file, tagsize, NULL, FILE_BEGIN);
+
+	adxx_id[5-1] = 0;
+
+	info->length = 0;
+
+	if(StringComp((const char *)adxx_id, "ADIF", 4) == 0)
+	{
+		read_ADIF_header(file, info);
+	}
+	else
+	{
+		if ((adxx_id[0] == 0xFF)&&((adxx_id[1] & 0xF6) == 0xF0))
+		{
+//			SetFilePointer(file, tagsize, NULL, FILE_BEGIN);
+			read_ADTS_header(file, info, seek_table, tagsize);
+		}
+		else
+		{
+			/* Unknown/headerless AAC file, assume format: */
+			info->version = 2;
+			info->bitrate = 128000;
+			info->sampling_rate = 44100;
+			info->channels = 2;
+			info->headertype = 0;
+			info->object_type = 1;
+		}
+	}
+
+	if (info->length == 0)
+		info->length = (int)((file_len/(((info->bitrate*8)/1024)*16))*1000);
+
+	CloseHandle(file);
+
+	return 0;
+}
+
+int StringComp(char const *str1, char const *str2, unsigned long len)
+{
+	signed int c1 = 0, c2 = 0;
+
+	while (len--) {
+		c1 = *str1++;
+		c2 = *str2++;
+
+		if (c1 == 0 || c1 != c2)
+			break;
+	}
+
+	return c1 - c2;
+}
--- a/plugins/winamp/Config.c
+++ /dev/null
@@ -1,47 +1,0 @@
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-static char app_name[] = "Freeware AAC encoder";
-static char INI_FILE[MAX_PATH];
-extern char config_AACoutdir[MAX_PATH];
-extern DWORD dwOptions;
-
-static void _r_s(char *name,char *data, int mlen)
-{
-char buf[2048];
- strcpy(buf,data);
- GetPrivateProfileString(app_name,name,buf,data,mlen,INI_FILE);
-}
-
-#define RS(x) (_r_s(#x,x,sizeof(x)))
-#define WS(x) (WritePrivateProfileString(app_name,#x,x,INI_FILE))
-
-
-
-static void config_init()
-{
-	char *p=INI_FILE;
-	GetModuleFileName(NULL,INI_FILE,sizeof(INI_FILE));
-	while (*p) p++;
-	while (p >= INI_FILE && *p != '.') p--;
-	strcpy(p+1,"ini");
-}
-
-void config_read()
-{
-char Options[512];
- config_init();
- RS(config_AACoutdir);
- RS(Options);
- dwOptions=atoi(Options);
-}
-
-void config_write()
-{
-char Options[512];
- WS(config_AACoutdir);
- sprintf(Options,"%lu",dwOptions);
- WS(Options);
-}
--- /dev/null
+++ b/plugins/winamp/Config.cpp
@@ -1,0 +1,47 @@
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static char app_name[] = "Freeware AAC encoder";
+static char INI_FILE[MAX_PATH];
+extern char config_AACoutdir[MAX_PATH];
+extern DWORD dwOptions;
+
+static void _r_s(char *name,char *data, int mlen)
+{
+char buf[2048];
+ strcpy(buf,data);
+ GetPrivateProfileString(app_name,name,buf,data,mlen,INI_FILE);
+}
+
+#define RS(x) (_r_s(#x,x,sizeof(x)))
+#define WS(x) (WritePrivateProfileString(app_name,#x,x,INI_FILE))
+
+
+
+static void config_init()
+{
+	char *p=INI_FILE;
+	GetModuleFileName(NULL,INI_FILE,sizeof(INI_FILE));
+	while (*p) p++;
+	while (p >= INI_FILE && *p != '.') p--;
+	strcpy(p+1,"ini");
+}
+
+void config_read()
+{
+char Options[512];
+ config_init();
+ RS(config_AACoutdir);
+ RS(Options);
+ dwOptions=atoi(Options);
+}
+
+void config_write()
+{
+char Options[512];
+ WS(config_AACoutdir);
+ sprintf(Options,"%lu",dwOptions);
+ WS(Options);
+}
--- a/plugins/winamp/FAAC.rc
+++ b/plugins/winamp/FAAC.rc
@@ -7,9 +7,8 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-//#include "afxres.h"
+#include "afxres.h"
 
-
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
 
@@ -27,7 +26,7 @@
 // Dialog
 //
 
-IDD_COMPRESSION DIALOG DISCARDABLE  0, 0, 178, 142
+IDD_COMPRESSION DIALOG DISCARDABLE  0, 0, 186, 142
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "AAC-MPEG4 options"
 FONT 8, "MS Sans Serif"
@@ -47,27 +46,29 @@
     CONTROL         "LTP",IDC_RADIO_LTP,"Button",BS_AUTORADIOBUTTON,12,109,
                     29,10
     CONTROL         "Allow Mid/Side",IDC_ALLOWMIDSIDE,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,59,21,63,10
+                    BS_AUTOCHECKBOX | WS_TABSTOP,107,21,63,10
     CONTROL         "Use TNS",IDC_USETNS,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,59,33,45,10
+                    WS_TABSTOP,107,34,45,10
     CONTROL         "Use LFE channel",IDC_USELFE,"Button",BS_AUTOCHECKBOX | 
-                    WS_DISABLED | WS_TABSTOP,59,46,67,10
-    EDITTEXT        IDC_CB_BITRATE,126,68,40,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_CB_BANDWIDTH,126,85,40,14,ES_AUTOHSCROLL
-//    COMBOBOX        IDC_CB_BITRATE,126,68,40,59,CBS_DROPDOWNLIST | 
-//                    WS_VSCROLL | WS_TABSTOP
-//    COMBOBOX        IDC_CB_BANDWIDTH,126,85,40,59,CBS_DROPDOWN | WS_VSCROLL | 
-//                    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,66,123,36,14
-    PUSHBUTTON      "Cancel",IDCANCEL,102,123,36,14
-    PUSHBUTTON      "About",IDC_BTN_ABOUT,138,123,36,14
+                    WS_DISABLED | WS_TABSTOP,107,47,67,10
+    COMBOBOX        IDC_CB_BITRATE,134,68,48,30,CBS_DROPDOWNLIST | 
+                    WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_CB_BANDWIDTH,134,85,48,30,CBS_DROPDOWN | WS_VSCROLL | 
+                    WS_TABSTOP
+    EDITTEXT        IDC_E_BROWSE,57,103,100,14,ES_AUTOHSCROLL
+    PUSHBUTTON      "Browse",IDC_BTN_BROWSE,164,103,18,14,BS_BITMAP | 
+                    BS_FLAT
+    DEFPUSHBUTTON   "OK",IDOK,109,123,36,14
+    PUSHBUTTON      "Cancel",IDCANCEL,146,123,36,14
     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         104,"Static",IDC_IMG_LOGO,138,4,36,23,SS_BITMAP
+    LTEXT           "Bandwidth (0=full)",IDC_STATIC,59,89,57,8
+    CONTROL         "Raw",IDC_RADIO_RAW,"Button",BS_AUTORADIOBUTTON | 
+                    WS_GROUP,59,30,42,10
+    CONTROL         "ADTS",IDC_RADIO_ADTS,"Button",BS_AUTORADIOBUTTON,59,42,
+                    41,9
+    GROUPBOX        "Header",IDC_STATIC,55,18,48,38
 END
 
 
@@ -108,7 +109,7 @@
     IDD_COMPRESSION, DIALOG
     BEGIN
         LEFTMARGIN, 4
-        RIGHTMARGIN, 174
+        RIGHTMARGIN, 182
         TOPMARGIN, 4
         BOTTOMMARGIN, 137
     END
@@ -133,7 +134,6 @@
 // Bitmap
 //
 
-IDB_LOGO                BITMAP  DISCARDABLE     "Logo.bmp"
 IDB_BROWSE              BITMAP  DISCARDABLE     "Open.bmp"
 #endif    // Italian (Italy) resources
 /////////////////////////////////////////////////////////////////////////////
binary files a/plugins/winamp/Logo.bmp /dev/null differ
--- a/plugins/winamp/OUT.H
+++ b/plugins/winamp/OUT.H
@@ -1,5 +1,11 @@
 #define OUT_VER 0x10
-
+/*
+#ifdef __cplusplus
+extern "C" {
+#endif
+*/
+	
+	
 typedef struct 
 {
 	int version;				// module version (OUT_VER)
@@ -50,3 +56,8 @@
 } Out_Module;
 
 
+/*
+#ifdef __cplusplus
+}
+#endif
+*/
\ No newline at end of file
--- /dev/null
+++ b/plugins/winamp/OUT_FAAC.DEF
@@ -1,0 +1,2 @@
+EXPORTS
+	winampGetOutModule
--- a/plugins/winamp/Out_faac.c
+++ /dev/null
@@ -1,805 +1,0 @@
-#include <windows.h>
-#include <shlobj.h>
-#include <stdio.h>  // FILE *
-#include "resource.h"
-#include "faac.h"
-#include "out.h"
-
-
-#define PI_VER "v1.0 beta2"
-
-extern void config_read();
-extern void config_write();
-
-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
-{
- 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;
-
- unsigned char *inbuf;
- DWORD full_size; // size of decoded file needed to set the length of progress bar
- DWORD tagsize;
- DWORD bytes_read; // from file
- DWORD bytes_consumed; // by faadDecDecode
- DWORD bytes_into_buffer;
- DWORD bytes_Enc;
-} MYOUTPUT;
-
-char config_AACoutdir[MAX_PATH]="";
-DWORD dwOptions;
-static MYOUTPUT mo0,
-                *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;
-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)
-	{
-		case DLL_PROCESS_ATTACH:
-			DisableThreadLibraryCalls(hInst);
-			if(!hBmBrowse)
-				hBmBrowse=LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BROWSE));
-			/* 	Code from LibMain inserted here.  Return TRUE to keep the
-				DLL loaded or return FALSE to fail loading the DLL.
- 
-				You may have to modify the code in your original LibMain to
-				account for the fact that it may be called more than once.
-				You will get one DLL_PROCESS_ATTACH for each process that
-				loads the DLL. This is different from LibMain which gets
-				called only once when the DLL is loaded. The only time this
-				is critical is when you are using shared data sections.
-				If you are using shared data sections for statically
-				allocated data, you will need to be careful to initialize it
-				only once. Check your code carefully.
- 
-				Certain one-time initializations may now need to be done for
-				each process that attaches. You may also not need code from
-				your original LibMain because the operating system may now
-				be doing it for you.
-			*/
-			break;
- 
-		case DLL_THREAD_ATTACH:
-			/* 	Called each time a thread is created in a process that has
-				already loaded (attached to) this DLL. Does not get called
-				for each thread that exists in the process before it loaded
-				the DLL.
- 
-				Do thread-specific initialization here.
-			*/
-			break;
- 
-		case DLL_THREAD_DETACH:
-			/* 	Same as above, but called when a thread in the process
-				exits.
- 
-				Do thread-specific cleanup here.
-			*/
-			break;
- 
-		case DLL_PROCESS_DETACH:
-			if(hBmBrowse)
-			{
-				DeleteObject(hBmBrowse);
-				hBmBrowse=NULL;
-			}
-			/* 	Code from _WEP inserted here.  This code may (like the
-				LibMain) not be necessary.  Check to make certain that the
-				operating system is not doing it for you.
-			*/
-			break;
-	}
- 
-	/* 	The return value is only used for DLL_PROCESS_ATTACH; all other
-		conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-
-
-
-static int CALLBACK WINAPI BrowseCallbackProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
-{
-	if (uMsg == BFFM_INITIALIZED)
-	{
-		SetWindowText(hwnd,"Select Directory");
-		SendMessage(hwnd,BFFM_SETSELECTION,(WPARAM)1,(LPARAM)config_AACoutdir);
-	}
-	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)
-{
-	switch(Message)
-	{
-		case WM_INITDIALOG:
-		{
-			char buf[10];
-			int br;
-			char szTemp[64];
-
-			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);
-							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;
-					}
-
-				CheckDlgButton(hWndDlg, IDC_ALLOWMIDSIDE, (dwOptions>>26)&1);
-				CheckDlgButton(hWndDlg, IDC_USETNS, (dwOptions>>25)&1);
-				CheckDlgButton(hWndDlg, IDC_USELFE, (dwOptions>>24)&1);
-
-				for(br=0; br<=((dwOptions>>16)&255) ; br++)
-				{
-					if(br == ((dwOptions>>16)&255))
-						sprintf(szTemp, "%d", br*1000);
-				}
-
-				SetDlgItemText(hWndDlg, IDC_CB_BITRATE, szTemp);
-
-				for(br=0; br<=((dwOptions>>1)&0x0000ffff) ; br++)
-				{
-					if(br == ((dwOptions>>1)&0x0000ffff))
-						sprintf(szTemp, "%d", br);
-				}
-
-				SetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, szTemp);
-
-				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);
-					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                                 
-
-		case WM_CLOSE:
-       			// 	Closing the Dialog behaves the same as Cancel               
-			PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L);
-			break; // End of WM_CLOSE                                      
-
-		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;
-
-				case IDC_BTN_BROWSE:
-				{
-					char name[MAX_PATH];
-					BROWSEINFO bi;
-					ITEMIDLIST *idlist;
-					bi.hwndOwner = hWndDlg;
-					bi.pidlRoot = 0;
-					bi.pszDisplayName = name;
-					bi.lpszTitle = "Select a directory for AAC-MPEG4 file output:";
-					bi.ulFlags = BIF_RETURNONLYFSDIRS;
-					bi.lpfn = BrowseCallbackProc;
-					bi.lParam = 0;
-					idlist = SHBrowseForFolder( &bi );
-					if (idlist) 
-						SHGetPathFromIDList( idlist, config_AACoutdir );
-
-					SetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir);
-				}
-					break;
-
-				case IDC_E_BROWSE:
-					GetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir,256);
-					break;
-
-				case IDOK:
-				{
-					char szTemp[64];
-					DWORD retVal=0;
-					faacEncConfiguration faacEncCfg;
-
-					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;
-					}
-
-					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;
-			  
-					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;
-
-					if(IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG))
-						retVal|=1;
-
-					EndDialog(hWndDlg, retVal);
-				}
-					break;
-
-				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 encoder plug-in %s\nThis plugin uses FAAC encoder engine v%g\n\nCompiled on %s\n",
-						PI_VER,
-						FAACENC_VERSION,
-						__DATE__
-						);
-					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;
-	}
- return TRUE;
-} // End of DIALOGSMsgProc                                      
-
-
-
-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);
-	config_write();
-}
-
-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",
-		PI_VER,
-		FAACENC_VERSION,
-		__DATE__);
-	MessageBox(hwnd, buf, "About", MB_OK);
-}
-
-void Init()
-{
-	config_read();
-}
-
-void Quit()
-{
-}
-
-static char *scanstr_back(char *str, char *toscan, char *defval)
-{
-	char *s=str+strlen(str)-1;
-	if (strlen(str) < 1) return defval;
-	if (strlen(toscan) < 1) return defval;
-	while (1)
-	{
-		char *t=toscan;
-		while (*t)
-			if (*t++ == *s) return s;
-		t=CharPrev(str,s);
-		if (t==s) return defval;
-		s=t;
-	}
-}
-
-int Open(int lSamprate, int wChannels, int wBitsPerSample, int bufferlenms, int prebufferms)
-{
-//	HANDLE		hOutput;
-	faacEncHandle	hEncoder;
-	FILE		*outfile;
-	unsigned char	*bitbuf;
-	DWORD		maxBytesOutput;
-	long		samplesInput;
-	int		bytesEncoded;
-	int		br;
-
-	char		*t,*p;
-	char		temp2[MAX_PATH],lpstrFilename[MAX_PATH];
-	GetWindowText(out.hMainWindow,temp2,sizeof(temp2));
-	t=temp2;
-
-	t=scanstr_back(temp2,"-",NULL);
-	if (t) t[-1]=0;
-
-	if (temp2[0] && temp2[1] == '.')
-	{
-		char *p1,*p2;
-		p1=lpstrFilename;
-		p2=temp2;
-		while (*p2) *p1++ = *p2++;
-		*p1=0;
-		p1 = temp2+1;
-		p2 = lpstrFilename;
-		while (*p2) *p1++ = *p2++;
-		*p1=0;
-		temp2[0] = '0';
-	}
-	p=temp2;
-	while (*p != '.' && *p) p++;
-	if (*p == '.') 
-	{
-		*p = '-';
-		p=CharNext(p);
-	}
-	while (*p)
-	{
-		if (*p == '.' || *p == '/' || *p == '\\' || *p == '*' || 
-			*p == '?' || *p == ':' || *p == '+' || *p == '\"' || 
-			*p == '\'' || *p == '|' || *p == '<' || *p == '>') *p = '_';
-			p=CharNext(p);
-	}
-
-	p=config_AACoutdir;
-	if (p[0]) while (p[1]) p++;
-
-	if (!config_AACoutdir[0] || config_AACoutdir[0] == ' ')
-		Config(out.hMainWindow);
-	if (!config_AACoutdir[0])
-		wsprintf(lpstrFilename,"%s.aac",temp2);
-	else if (p[0]=='\\')
-		wsprintf(lpstrFilename,"%s%s.aac",config_AACoutdir,temp2);
-	else
-		wsprintf(lpstrFilename,"%s\\%s.aac",config_AACoutdir,temp2);
-
-	w_offset = writtentime = 0;
-	numchan = wChannels;
-	srate = lSamprate;
-	bps = wBitsPerSample;
-
-
-
-	/* open the aac output file */
-	if(!(outfile=fopen(lpstrFilename, "wb")))
-	{
-		MessageBox(0, "Can't create file", "FAAC interface", MB_OK);
-		return -1;
-	}
-
-	/* open the encoder library */
-	if(!(hEncoder=faacEncOpen(lSamprate, wChannels, &samplesInput, &maxBytesOutput)))
-	{
-		MessageBox(0, "Can't init library", "FAAC interface", MB_OK);
-		fclose(outfile);
-		return -1;
-	}
-
-	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 -1;
-	}
-
-	if(!(mo->inbuf=(unsigned char*)malloc(samplesInput*sizeof(short))))
-	{
-		MessageBox(0, "Memory allocation error: output buffer", "FAAC interface", MB_OK);
-		faacEncClose(hEncoder);
-		fclose(outfile);
-		free(bitbuf);
-		return -1;
-	}
-
-	mo->fFile=outfile;
-//	mo->lSize=lSize;
-	mo->lSamprate=lSamprate;
-	mo->wBitsPerSample=wBitsPerSample;
-	mo->wChannels=wChannels;
-	strcpy(mo->szNAME,lpstrFilename);
-
-	mo->hEncoder=hEncoder;
-	mo->bitbuf=bitbuf;
-	mo->maxBytesOutput=maxBytesOutput;
-	mo->samplesInput=samplesInput;
-	mo->bStopEnc=0;
-
-
-	if(dwOptions && !(dwOptions&1))
-	{
-		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;
-
-		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=mo->lSamprate/2;
-
-		if(!faacEncSetConfiguration(hEncoder, myFormat))
-		{
-			MessageBox(0, "Unsupported parameters", "FAAC interface", MB_OK);
-			faacEncClose(hEncoder);
-			fclose(outfile);
-			free(bitbuf);
-			free(mo->inbuf);
-//			GlobalFree(hOutput);
-			return -1;
-		}
-/*		{
-		faacEncConfigurationPtr myFormat;
-		myFormat=faacEncGetCurrentConfiguration(hEncoder);
-
-		myFormat->mpegVersion=faacEncCfg.mpegVersion;
-		myFormat->aacObjectType=faacEncCfg.aacObjectType;
-		myFormat->allowMidside=faacEncCfg.allowMidside;
-		myFormat->useLfe=faacEncCfg.useLfe;
-		myFormat->useTns=faacEncCfg.useTns;
-		myFormat->bandWidth=faacEncCfg.bandWidth;
-		myFormat->bitRate=faacEncCfg.bitRate;
-
-		if(!faacEncSetConfiguration(hEncoder, myFormat))
-		{
-			MessageBox(0, "Unsupported parameters", "FAAC interface", MB_OK);
-			faacEncClose(hEncoder);
-			fclose(outfile);
-			free(bitbuf);
-			free(mo->inbuf);
-			GlobalFree(hOutput);
-			return -1;
-		}*/
-	}
-
-	bytesEncoded=faacEncEncode(hEncoder, 0, 0, bitbuf, maxBytesOutput); // initializes the flushing process
-	if(bytesEncoded>0)
-		fwrite(bitbuf, 1, bytesEncoded, outfile);
-
-	return 0;
-}
-
-void Close()
-{
-//	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);
-		if(bytesEncoded>0)
-			fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
-	}
-
-	if(mo->hEncoder)
-		faacEncClose(mo->hEncoder);
-	if(mo->fFile)
-		fclose(mo->fFile);
-	if(mo->bitbuf)
-		free(mo->bitbuf);
-	if(mo->inbuf)
-		free(mo->inbuf);
-
-//	CloseHandle(outfile);
-}
-
-int Write(char *buf, int len)
-{
-	int bytesWritten;
-	int bytesEncoded;
-	int k,i,shift=0;
-
-	writtentime += len;
-  
-	if(!mo->bStopEnc)
-	{
-		if(mo->bytes_into_buffer+len<mo->samplesInput*sizeof(short))
-		{
-			memcpy(mo->inbuf+mo->bytes_into_buffer, buf, len);
-			mo->bytes_into_buffer+=len;
-			return 0;
-		}
-		else
-			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, 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;
-			return -1;
-		}
-	}
-
-	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;
-}
-
-int CanWrite()
-{
-	return last_pause ? 0 : 16*1024*1024;
-//	return last_pause ? 0 : mo->samplesInput;
-}
-
-int IsPlaying()
-{
-	return 0;
-}
-
-int Pause(int pause)
-{
-	int t=last_pause;
-	last_pause=pause;
-	return t;
-}
-
-void SetVolume(int volume)
-{
-}
-
-void SetPan(int pan)
-{
-}
-
-void Flush(int t)
-{
-	int a;
-	w_offset=0;
-	a = t - GetWrittenTime();
-	w_offset=a;
-}
-	
-int GetWrittenTime()
-{
-	int t=srate*numchan,l;
-	int ms=writtentime;
-
-	l=ms%t;
-	ms /= t;
-	ms *= 1000;
-	ms += (l*1000)/t;
-
-	if (bps == 16) ms/=2;
-
-	return ms + w_offset;
-}
--- /dev/null
+++ b/plugins/winamp/Out_faac.cpp
@@ -1,0 +1,868 @@
+#include <windows.h>
+#include <shlobj.h>
+#include <stdio.h>  // FILE *
+#include "resource.h"
+#include "..\..\include\faac.h"
+#include "out.h"
+
+
+#define PI_VER "v1.0 beta2"
+
+extern void config_read();
+extern void config_write();
+/*
+#ifdef __cplusplus
+extern "C" {
+#endif
+*/
+
+	
+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();
+/*
+#ifdef __cplusplus
+}
+#endif
+*/
+
+
+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];
+
+ faacEncHandle hEncoder;
+ unsigned char *bitbuf;
+ DWORD maxBytesOutput;
+ long  samplesInput;
+ BYTE  bStopEnc;
+
+ unsigned char *inbuf;
+ DWORD full_size; // size of decoded file needed to set the length of progress bar
+ DWORD tagsize;
+ DWORD bytes_read; // from file
+ DWORD bytes_consumed; // by faadDecDecode
+ DWORD bytes_into_buffer;
+ DWORD bytes_Enc;
+} MYOUTPUT;
+
+char config_AACoutdir[MAX_PATH]="";
+DWORD dwOptions;
+static MYOUTPUT mo0,
+                *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;
+static int last_pause=0;
+
+
+Out_Module out = {
+	OUT_VER,
+	"Freeware AAC encoder " PI_VER,
+	33,
+    NULL, // hmainwindow
+    NULL, // hdllinstance
+    Config,
+    About,
+    Init,
+    Quit,
+    Open,
+    Close,
+    Write,
+    CanWrite,
+    IsPlaying,
+    Pause,
+    SetVolume,
+    SetPan,
+    Flush,
+    GetWrittenTime,
+    GetWrittenTime
+};
+
+
+
+// *********************************************************************************************
+
+
+
+//__declspec(dllexport) Out_Module * __cdecl winampGetOutModule()
+__declspec(dllexport) Out_Module * winampGetOutModule()
+{
+	return &out;
+}
+// *********************************************************************************************
+
+//BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ulReason, LPVOID lpReserved)
+BOOL WINAPI DllMain (HANDLE hInst, DWORD ulReason, LPVOID lpReserved)
+{
+   switch(ulReason)
+   {
+      case DLL_PROCESS_ATTACH:
+           DisableThreadLibraryCalls((struct HINSTANCE__ *)hInst);
+           if(!hBmBrowse)
+            hBmBrowse=LoadBitmap((struct HINSTANCE__ *)hInst, MAKEINTRESOURCE(IDB_BROWSE));
+         /* Code from LibMain inserted here.  Return TRUE to keep the
+            DLL loaded or return FALSE to fail loading the DLL.
+ 
+            You may have to modify the code in your original LibMain to
+            account for the fact that it may be called more than once.
+            You will get one DLL_PROCESS_ATTACH for each process that
+            loads the DLL. This is different from LibMain which gets
+            called only once when the DLL is loaded. The only time this
+            is critical is when you are using shared data sections.
+            If you are using shared data sections for statically
+            allocated data, you will need to be careful to initialize it
+            only once. Check your code carefully.
+ 
+            Certain one-time initializations may now need to be done for
+            each process that attaches. You may also not need code from
+            your original LibMain because the operating system may now
+            be doing it for you.
+         */
+         break;
+ 
+      case DLL_THREAD_ATTACH:
+         /* Called each time a thread is created in a process that has
+            already loaded (attached to) this DLL. Does not get called
+            for each thread that exists in the process before it loaded
+            the DLL.
+ 
+            Do thread-specific initialization here.
+         */
+         break;
+ 
+      case DLL_THREAD_DETACH:
+         /* Same as above, but called when a thread in the process
+            exits.
+ 
+            Do thread-specific cleanup here.
+         */
+         break;
+ 
+      case DLL_PROCESS_DETACH:
+           if(hBmBrowse)
+           {
+            DeleteObject(hBmBrowse);
+            hBmBrowse=NULL;
+           }
+         /* Code from _WEP inserted here.  This code may (like the
+            LibMain) not be necessary.  Check to make certain that the
+            operating system is not doing it for you.
+         */
+         break;
+   }
+ 
+   /* The return value is only used for DLL_PROCESS_ATTACH; all other
+      conditions are ignored.  */
+   return TRUE;   // successful DLL_PROCESS_ATTACH
+}
+// *********************************************************************************************
+
+static int CALLBACK WINAPI BrowseCallbackProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
+{
+	if (uMsg == BFFM_INITIALIZED)
+	{
+		SetWindowText(hwnd,"Select Directory");
+		SendMessage(hwnd,BFFM_SETSELECTION,(WPARAM)1,(LPARAM)config_AACoutdir);
+	}
+	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); \
+}
+
+#define DISABLE_CTRL(Enabled) \
+{ \
+		CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, !Enabled); \
+        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_LTP), Enabled); \
+        EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_RAW), Enabled); \
+        EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_ADTS), Enabled); \
+        EnableWindow(GetDlgItem(hWndDlg, IDC_ALLOWMIDSIDE), Enabled); \
+        EnableWindow(GetDlgItem(hWndDlg, IDC_USETNS), 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 \
+}
+
+static BOOL CALLBACK DIALOGMsgProc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
+{
+ switch(Message)
+ {
+  case WM_INITDIALOG:
+	  {
+      char buf[10];
+
+		SendMessage(GetDlgItem(hWndDlg, IDC_BTN_BROWSE), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmBrowse);
+		if(!*config_AACoutdir)
+			GetCurrentDirectory(MAX_PATH,config_AACoutdir);
+		SetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir);
+
+	   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);
+
+       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);
+
+	   if(dwOptions)
+	   {
+       char Enabled=!(dwOptions&1);
+		CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, dwOptions&1);
+		DISABLE_CTRL(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);
+		      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;
+		}
+
+		switch((dwOptions>>31)&1)
+		{
+		case 0:
+              CheckDlgButton(hWndDlg,IDC_RADIO_RAW,TRUE);
+		      break;
+		case 1:
+              CheckDlgButton(hWndDlg,IDC_RADIO_ADTS,TRUE);
+		      break;
+		}
+
+		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_SETCURSEL, (dwOptions>>19)&31, 0);
+//        SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, (dwOptions>>6)&31, 0);
+		sprintf(buf,"%lu",(dwOptions>>1)&0x0000ffff);
+        SetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, buf);
+		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);
+	         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);
+			 CheckDlgButton(hWndDlg,IDC_RADIO_ADTS,TRUE);
+			 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                                      
+
+  case WM_COMMAND:
+	   switch(LOWORD(wParam))
+       {
+        case IDC_CHK_AUTOCFG:
+			{
+			char Enabled=!IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG);
+				DISABLE_CTRL(Enabled);
+			}
+            break;
+
+	    case IDC_BTN_BROWSE:
+             {
+             char name[MAX_PATH];
+             BROWSEINFO bi;
+             ITEMIDLIST *idlist;
+	          bi.hwndOwner = hWndDlg;
+	          bi.pidlRoot = 0;
+	          bi.pszDisplayName = name;
+	          bi.lpszTitle = "Select a directory for AAC-MPEG4 file output:";
+	          bi.ulFlags = BIF_RETURNONLYFSDIRS;
+	          bi.lpfn = BrowseCallbackProc;
+	          bi.lParam = 0;
+	          idlist = SHBrowseForFolder( &bi );
+	          if (idlist) 
+	           SHGetPathFromIDList( idlist, config_AACoutdir );
+
+              SetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir);
+			 }
+			 break;
+
+		case IDC_E_BROWSE:
+             GetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir,256);
+			 break;
+
+	    case IDOK:
+           	 {
+			 DWORD retVal=0;
+             faacEncConfiguration faacEncCfg;
+
+              if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_ADTS))
+			  {
+               faacEncCfg.mpegVersion=1;
+			   retVal|=1<<31;
+			  }
+              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;
+			  }
+
+              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;
+			  
+			  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)&31)<<6;
+			  retVal|=(faacEncCfg.bandWidth&0x0000ffff)<<1;
+
+			  if(IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG))
+			   retVal|=1;
+
+			  EndDialog(hWndDlg, retVal);
+             }
+             break;
+
+        case IDCANCEL:
+             // Ignore data values entered into the controls        
+             // and dismiss the dialog window returning FALSE       
+             EndDialog(hWndDlg, FALSE);
+             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;
+ }
+ return TRUE;
+} // End of DIALOGSMsgProc                                      
+// *********************************************************************************************
+
+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);
+ config_write();
+}
+// *********************************************************************************************
+
+void About(HWND hwnd)
+{
+char buf[256];
+ sprintf(buf,"AAC-MPEG4 encoder plug-in %s by 4N\n"
+			"This plugin uses FAAC encoder engine v%g\n\n"
+			"Compiled on %s\n",
+	         PI_VER,
+             FAACENC_VERSION,
+			 __DATE__);
+ MessageBox(hwnd, buf, "About", MB_OK);
+}
+// *********************************************************************************************
+
+void Init()
+{
+ config_read();
+}
+// *********************************************************************************************
+
+void Quit()
+{
+}
+// *********************************************************************************************
+
+static char *scanstr_back(char *str, char *toscan, char *defval)
+{
+	char *s=str+strlen(str)-1;
+	if (strlen(str) < 1) return defval;
+	if (strlen(toscan) < 1) return defval;
+	while (1)
+	{
+		char *t=toscan;
+		while (*t)
+			if (*t++ == *s) return s;
+		t=CharPrev(str,s);
+		if (t==s) return defval;
+		s=t;
+	}
+}
+
+#define ERROR_O(msg) \
+{ \
+	if(msg) \
+		MessageBox(0, msg, "FAAC plugin", MB_OK); \
+	Close(); \
+	return -1; \
+}
+
+int Open(int lSamprate, int wChannels, int wBitsPerSample, int bufferlenms, int prebufferms)
+{
+//HANDLE        hOutput;
+//faacEncHandle hEncoder;
+//FILE          *outfile;
+//unsigned char *bitbuf;
+DWORD         maxBytesOutput;
+unsigned long samplesInput;
+int           bytesEncoded;
+int				tmp;
+
+
+	char *t,*p;
+	char temp2[MAX_PATH],lpstrFilename[MAX_PATH];
+	GetWindowText(out.hMainWindow,temp2,sizeof(temp2));
+	t=temp2;
+
+	t=scanstr_back(temp2,"-",NULL);
+	if (t) t[-1]=0;
+
+	if (temp2[0] && temp2[1] == '.')
+	{
+		char *p1,*p2;
+		p1=lpstrFilename;
+		p2=temp2;
+		while (*p2) *p1++=*p2++;
+		*p1=0;
+		p1 = temp2+1;
+		p2 = lpstrFilename;
+		while (*p2)
+		{
+			*p1++ = *p2++;
+		}
+		*p1=0;
+		temp2[0] = '0';
+	}
+	p=temp2;
+	while (*p != '.' && *p) p++;
+	if (*p == '.') 
+	{
+		*p = '-';
+		p=CharNext(p);
+	}
+	while (*p)
+	{
+		if (*p == '.' || *p == '/' || *p == '\\' || *p == '*' || 
+			*p == '?' || *p == ':' || *p == '+' || *p == '\"' || 
+			*p == '\'' || *p == '|' || *p == '<' || *p == '>') *p = '_';
+		p=CharNext(p);
+	}
+
+	p=config_AACoutdir;
+	if (p[0]) while (p[1]) p++;
+
+	if (!config_AACoutdir[0] || config_AACoutdir[0] == ' ')
+		Config(out.hMainWindow);
+	if (!config_AACoutdir[0])
+		wsprintf(lpstrFilename,"%s.aac",temp2);
+	else if (p[0]=='\\')
+		wsprintf(lpstrFilename,"%s%s.aac",config_AACoutdir,temp2);
+	else
+		wsprintf(lpstrFilename,"%s\\%s.aac",config_AACoutdir,temp2);
+
+ 	w_offset = writtentime = 0;
+	numchan = wChannels;
+	srate = lSamprate;
+	bps = wBitsPerSample;
+
+
+
+	memset(mo,0,sizeof(MYOUTPUT));
+
+	/* open the aac output file */
+	if(!(mo->fFile=fopen(lpstrFilename, "wb")))
+		ERROR_O("Can't create file");
+
+	/* open the encoder library */
+	if(!(mo->hEncoder=faacEncOpen(lSamprate, wChannels, &samplesInput, &maxBytesOutput)))
+		ERROR_O("Can't init library");
+
+	if(!(mo->bitbuf=(unsigned char*)malloc(maxBytesOutput*sizeof(unsigned char))))
+		ERROR_O("Memory allocation error: output buffer");
+
+	if(!(mo->inbuf=(unsigned char*)malloc(samplesInput*sizeof(short))))
+		ERROR_O("Memory allocation error: input buffer");
+
+//	 mo->fFile=outfile;
+//	 mo->lSize=lSize;
+	 mo->lSamprate=lSamprate;
+	 mo->wBitsPerSample=wBitsPerSample;
+	 mo->wChannels=wChannels;
+	 strcpy(mo->szNAME,lpstrFilename);
+
+//	 mo->hEncoder=hEncoder;
+     //mo->bitbuf=bitbuf;
+	 mo->maxBytesOutput=maxBytesOutput;
+	 mo->samplesInput=samplesInput;
+	 mo->bStopEnc=0;
+
+
+	if(dwOptions && !(dwOptions&1))
+	{
+    faacEncConfigurationPtr myFormat;
+     myFormat=faacEncGetCurrentConfiguration(mo->hEncoder);
+
+	 myFormat->outputFormat=(dwOptions>>31)&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=mo->lSamprate/2;
+
+	 if(!faacEncSetConfiguration(mo->hEncoder, myFormat))
+		ERROR_O("Unsupported parameters");
+	}
+
+    bytesEncoded=faacEncEncode(mo->hEncoder, 0, 0, mo->bitbuf, maxBytesOutput); // initializes the flushing process
+    if(bytesEncoded>0)
+	{
+		tmp=fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
+		if(tmp!=bytesEncoded)
+			ERROR_O("fwrite");
+	}
+
+	return 0;
+}
+// *********************************************************************************************
+
+void Close()
+{
+// 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);
+  if(bytesEncoded>0)
+   fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
+ }
+
+ if(mo->fFile)
+ {
+  fclose(mo->fFile);
+  mo->fFile=0;
+ }
+
+ if(mo->hEncoder)
+  faacEncClose(mo->hEncoder);
+
+ if(mo->bitbuf)
+ {
+  free(mo->bitbuf);
+  mo->bitbuf=0;
+ }
+
+ if(mo->inbuf)
+ {
+  free(mo->inbuf);
+  mo->inbuf=0;
+ }
+
+// CloseHandle(outfile);
+}
+// *********************************************************************************************
+
+#define ERROR_W(msg) \
+{ \
+	if(msg) \
+		MessageBox(0, msg, "FAAC plugin", MB_OK); \
+    mo->bStopEnc=1; \
+	return -1; \
+}
+
+int Write(char *buf, int len)
+{
+int bytesWritten;
+int bytesEncoded;
+int k,i,shift=0;
+
+  writtentime += len;
+  
+  if(!mo->bStopEnc)
+  {
+
+   if(mo->bytes_into_buffer+len<mo->samplesInput*sizeof(short))
+   {
+    memcpy(mo->inbuf+mo->bytes_into_buffer, buf, len);
+	mo->bytes_into_buffer+=len;
+	return 0;
+   }
+   else
+    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, mo->bitbuf, mo->maxBytesOutput);
+	 mo->bytes_into_buffer=0;
+     if(bytesEncoded<1) // end of flushing process
+     {
+      if(bytesEncoded<0)
+		  ERROR_W("faacEncEncode() failed");
+      return 0;
+     }
+// write bitstream to aac file 
+     bytesWritten=fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
+     if(bytesWritten!=bytesEncoded)
+		  ERROR_W("bytesWritten and bytesEncoded are different");
+	}
+
+// 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)
+		  ERROR_W("faacEncEncode() failed");
+      return 0;
+    }
+// write bitstream to aac file 
+    bytesWritten=fwrite(mo->bitbuf, 1, bytesEncoded, mo->fFile);
+    if(bytesWritten!=bytesEncoded)
+		  ERROR_W("bytesWritten and bytesEncoded are different");
+   }
+
+   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;
+}
+// *********************************************************************************************
+
+int CanWrite()
+{
+	return last_pause ? 0 : 16*1024*1024;
+//	return last_pause ? 0 : mo->samplesInput;
+}
+// *********************************************************************************************
+
+int IsPlaying()
+{
+	return 0;
+}
+// *********************************************************************************************
+
+int Pause(int pause)
+{
+	int t=last_pause;
+	last_pause=pause;
+	return t;
+}
+// *********************************************************************************************
+
+void SetVolume(int volume)
+{
+}
+// *********************************************************************************************
+
+void SetPan(int pan)
+{
+}
+// *********************************************************************************************
+
+void Flush(int t)
+{
+  int a;
+  w_offset=0;
+  a = t - GetWrittenTime();
+  w_offset=a;
+}
+// *********************************************************************************************
+	
+int GetWrittenTime()
+{
+	int t=srate*numchan,l;
+	int ms=writtentime;
+
+	l=ms%t;
+	ms /= t;
+	ms *= 1000;
+	ms += (l*1000)/t;
+
+	if (bps == 16) ms/=2;
+
+	return ms + w_offset;
+}
--- a/plugins/winamp/RESOURCE.H
+++ b/plugins/winamp/RESOURCE.H
@@ -4,7 +4,7 @@
 //
 #define IDD_COMPRESSION                 101
 #define IDB_LOGO                        104
-#define IDB_BROWSE                      106
+#define IDB_BROWSE                      105
 #define IDC_RADIO_MPEG4                 1000
 #define IDC_RADIO_MPEG2                 1001
 #define IDC_RADIO_LOW                   1002
@@ -11,24 +11,26 @@
 #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_E_BROWSE                    1021
-#define IDC_BTN_BROWSE                  1022
-#define IDC_IMG_LOGO                    1023
-#define IDC_BTN_ABOUT                   1024
+#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_E_BROWSE                    1012
+#define IDC_BTN_BROWSE                  1013
+#define IDC_IMG_LOGO                    1014
+#define IDC_RADIO_RAW                   1014
+#define IDC_BTN_ABOUT                   1015
+#define IDC_RADIO_ADTS                  1015
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        108
+#define _APS_NEXT_RESOURCE_VALUE        106
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1025
+#define _APS_NEXT_CONTROL_VALUE         1016
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
--- a/plugins/winamp/out_FAAC.dsp
+++ b/plugins/winamp/out_FAAC.dsp
@@ -1,24 +1,24 @@
-# Microsoft Developer Studio Project File - Name="out_FAAC" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="out_faac" - Package Owner=<4>
 # Microsoft Developer Studio Generated Build File, Format Version 6.00
 # ** DO NOT EDIT **
 
 # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
 
-CFG=out_FAAC - Win32 Debug
+CFG=out_faac - Win32 Debug
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
 !MESSAGE use the Export Makefile command and run
 !MESSAGE 
-!MESSAGE NMAKE /f "out_FAAC.mak".
+!MESSAGE NMAKE /f "out_faac.mak".
 !MESSAGE 
 !MESSAGE You can specify a configuration when running NMAKE
 !MESSAGE by defining the macro CFG on the command line. For example:
 !MESSAGE 
-!MESSAGE NMAKE /f "out_FAAC.mak" CFG="out_FAAC - Win32 Debug"
+!MESSAGE NMAKE /f "out_faac.mak" CFG="out_faac - Win32 Debug"
 !MESSAGE 
 !MESSAGE Possible choices for configuration are:
 !MESSAGE 
-!MESSAGE "out_FAAC - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "out_FAAC - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "out_faac - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "out_faac - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
 !MESSAGE 
 
 # Begin Project
@@ -29,35 +29,33 @@
 MTL=midl.exe
 RSC=rc.exe
 
-!IF  "$(CFG)" == "out_FAAC - Win32 Release"
+!IF  "$(CFG)" == "out_faac - Win32 Release"
 
 # PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
 # PROP BASE Target_Dir ""
 # PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
+# PROP Use_Debug_Libraries 0
 # PROP Output_Dir "Release"
 # PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 1
+# PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "out_FAAC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MT /W3 /Gi /GX /O2 /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "out_FAAC_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-# SUBTRACT RSC /x
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "out_faac_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "out_faac_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x410 /d "NDEBUG"
+# ADD RSC /l 0x410 /d "NDEBUG"
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
 # 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 /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 msvcrt.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 /dll /machine:I386 /nodefaultlib /out:"Release\out_AAC.dll" /pdbtype:sept
-# SUBTRACT LINK32 /incremental:no /debug
+# 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 /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 odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Release/out_AAC.dll"
 
-!ELSEIF  "$(CFG)" == "out_FAAC - Win32 Debug"
+!ELSEIF  "$(CFG)" == "out_faac - Win32 Debug"
 
 # PROP BASE Use_MFC 0
 # PROP BASE Use_Debug_Libraries 1
@@ -68,40 +66,37 @@
 # PROP Use_Debug_Libraries 1
 # PROP Output_Dir "Debug"
 # PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
+# PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "out_FAAC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "out_FAAC_EXPORTS" /YX /FD /GZ /c
-# SUBTRACT CPP /WX
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "out_faac_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "out_faac_EXPORTS" /YX /FD /GZ /c
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-# SUBTRACT RSC /x
+# ADD BASE RSC /l 0x410 /d "_DEBUG"
+# ADD RSC /l 0x410 /d "_DEBUG"
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
 # 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 /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 msvcrt.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 /dll /debug /machine:I386 /nodefaultlib /out:"C:\Program Files\Sound\Gen\Winamp\Plugins\out_AAC.dll" /pdbtype:sept
-# SUBTRACT LINK32 /incremental:no
+# ADD 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 /dll /debug /machine:I386 /out:"Debug\out_AAC.dll" /pdbtype:sept
 
 !ENDIF 
 
 # Begin Target
 
-# Name "out_FAAC - Win32 Release"
-# Name "out_FAAC - Win32 Debug"
+# Name "out_faac - Win32 Release"
+# Name "out_faac - Win32 Debug"
 # Begin Group "Source Files"
 
 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
 # Begin Source File
 
-SOURCE=.\Aacinfo.c
+SOURCE=.\AACINFO.Cpp
 # End Source File
 # Begin Source File
 
-SOURCE=.\Config.c
+SOURCE=.\Config.cpp
 # End Source File
 # Begin Source File
 
@@ -109,8 +104,12 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\Out_faac.c
+SOURCE=.\Out_faac.cpp
 # End Source File
+# Begin Source File
+
+SOURCE=.\OUT_FAAC.DEF
+# End Source File
 # End Group
 # Begin Group "Header Files"
 
@@ -121,20 +120,16 @@
 # End Source File
 # Begin Source File
 
-SOURCE="E:\Program Files\Microsoft Visual Studio\VC98\Include\BASETSD.H"
+SOURCE=.\FILTERS.H
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\include\faac.h
+SOURCE=.\OUT.H
 # End Source File
 # Begin Source File
 
-SOURCE=.\Main.h
+SOURCE=.\RESOURCE.H
 # End Source File
-# Begin Source File
-
-SOURCE=.\Out.h
-# End Source File
 # End Group
 # Begin Group "Resource Files"
 
@@ -142,10 +137,6 @@
 # Begin Source File
 
 SOURCE=.\Logo.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Open.bmp
 # End Source File
 # End Group
 # End Target
--- a/plugins/winamp/out_FAAC.dsw
+++ b/plugins/winamp/out_FAAC.dsw
@@ -3,7 +3,7 @@
 
 ###############################################################################
 
-Project: "libfaac"=..\LIBFAAC\libfaac.dsp - Package Owner=<4>
+Project: "libfaac"=..\..\libfaac\libfaac.dsp - Package Owner=<4>
 
 Package=<5>
 {{{
@@ -15,7 +15,7 @@
 
 ###############################################################################
 
-Project: "out_FAAC"=.\out_FAAC.dsp - Package Owner=<4>
+Project: "out_faac"=.\out_faac.dsp - Package Owner=<4>
 
 Package=<5>
 {{{