shithub: aacdec

Download patch

ref: 27a4c0f5bc30ef3a84eef0a312901a153f29348a
parent: c6320bdc10062f0fc1cedbf90fd96fd96c48ab6f
author: menno <menno>
date: Sun Jan 20 18:19:13 EST 2002

Winamp2 AAC plugin
basically the same as old one, but with new library, and:
- new way of saving configuration (no more faad.dat)
- better multichannel handling

--- /dev/null
+++ b/plugins/winamp/in2.h
@@ -1,0 +1,105 @@
+#include "out.h"
+
+// note: exported symbol is now winampGetInModule2.
+
+#define IN_VER 0x100
+
+typedef struct
+{
+    int version;                // module type (IN_VER)
+    char *description;          // description of module, with version string
+
+    HWND hMainWindow;           // winamp's main window (filled in by winamp)
+    HINSTANCE hDllInstance;     // DLL instance handle (Also filled in by winamp)
+
+    char *FileExtensions;       // "mp3\0Layer 3 MPEG\0mp2\0Layer 2 MPEG\0mpg\0Layer 1 MPEG\0"
+                                // May be altered from Config, so the user can select what they want
+
+    int is_seekable;            // is this stream seekable?
+    int UsesOutputPlug;         // does this plug-in use the output plug-ins? (musn't ever change, ever :)
+
+    void (*Config)(HWND hwndParent); // configuration dialog
+    void (*About)(HWND hwndParent);  // about dialog
+
+    void (*Init)();             // called at program init
+    void (*Quit)();             // called at program quit
+
+    void (*GetFileInfo)(char *file, char *title, int *length_in_ms); // if file == NULL, current playing is used
+    int (*InfoBox)(char *file, HWND hwndParent);
+
+    int (*IsOurFile)(char *fn); // called before extension checks, to allow detection of mms://, etc
+    // playback stuff
+    int (*Play)(char *fn);      // return zero on success, -1 on file-not-found, some other value on other (stopping winamp) error
+    void (*Pause)();            // pause stream
+    void (*UnPause)();          // unpause stream
+    int (*IsPaused)();          // ispaused? return 1 if paused, 0 if not
+    void (*Stop)();             // stop (unload) stream
+
+    // time stuff
+    int (*GetLength)();         // get length in ms
+    int (*GetOutputTime)();     // returns current output time in ms. (usually returns outMod->GetOutputTime()
+    void (*SetOutputTime)(int time_in_ms);  // seeks to point in stream (in ms). Usually you signal yoru thread to seek, which seeks and calls outMod->Flush()..
+
+    // volume stuff
+    void (*SetVolume)(int volume);  // from 0 to 255.. usually just call outMod->SetVolume
+    void (*SetPan)(int pan);    // from -127 to 127.. usually just call outMod->SetPan
+
+    // in-window builtin vis stuff
+
+    void (*SAVSAInit)(int maxlatency_in_ms, int srate);     // call once in Play(). maxlatency_in_ms should be the value returned from outMod->Open()
+    // call after opening audio device with max latency in ms and samplerate
+    void (*SAVSADeInit)();  // call in Stop()
+
+
+    // simple vis supplying mode
+    void (*SAAddPCMData)(void *PCMData, int nch, int bps, int timestamp);
+                                            // sets the spec data directly from PCM data
+                                            // quick and easy way to get vis working :)
+                                            // needs at least 576 samples :)
+
+    // advanced vis supplying mode, only use if you're cool. Use SAAddPCMData for most stuff.
+    int (*SAGetMode)();     // gets csa (the current type (4=ws,2=osc,1=spec))
+                            // use when calling SAAdd()
+    void (*SAAdd)(void *data, int timestamp, int csa); // sets the spec data, filled in by winamp
+
+
+    // vis stuff (plug-in)
+    // simple vis supplying mode
+    void (*VSAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); // sets the vis data directly from PCM data
+                                            // quick and easy way to get vis working :)
+                                            // needs at least 576 samples :)
+
+    // advanced vis supplying mode, only use if you're cool. Use VSAAddPCMData for most stuff.
+    int (*VSAGetMode)(int *specNch, int *waveNch); // use to figure out what to give to VSAAdd
+    void (*VSAAdd)(void *data, int timestamp); // filled in by winamp, called by plug-in
+
+
+    // call this in Play() to tell the vis plug-ins the current output params.
+    void (*VSASetInfo)(int nch, int srate);
+
+
+    // dsp plug-in processing:
+    // (filled in by winamp, called by input plug)
+
+    // returns 1 if active (which means that the number of samples returned by dsp_dosamples
+    // could be greater than went in.. Use it to estimate if you'll have enough room in the
+    // output buffer
+    int (*dsp_isactive)();
+
+    // returns number of samples to output. This can be as much as twice numsamples.
+    // be sure to allocate enough buffer for samples, then.
+    int (*dsp_dosamples)(short int *samples, int numsamples, int bps, int nch, int srate);
+
+
+    // eq stuff
+    void (*EQSet)(int on, char data[10], int preamp); // 0-64 each, 31 is +0, 0 is +12, 63 is -12. Do nothing to ignore.
+
+    // info setting (filled in by winamp)
+    void (*SetInfo)(int bitrate, int srate, int stereo, int synched); // if -1, changes ignored? :)
+
+    Out_Module *outMod; // filled in by winamp, optionally used :)
+} In_Module;
+
+extern In_Module mod;
+
+
--- /dev/null
+++ b/plugins/winamp/in_faad.c
@@ -1,0 +1,992 @@
+/*
+** FAAD - Freeware Advanced Audio Decoder
+** Copyright (C) 2002 M. Bakker
+**  
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+** 
+** This program 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 General Public License for more details.
+** 
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software 
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** $Id: in_faad.c,v 1.1 2002/01/20 23:19:13 menno Exp $
+**/
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <commctrl.h>
+#include "resource.h"
+
+#include <faad.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <aacinfo.h>
+#include <filestream.h>
+#include <id3v2tag.h>
+
+#include "in2.h"
+
+
+static char app_name[] = "AudioCoding.com AAC Player";
+
+// post this to the main window at end of file (after playback has stopped)
+#define WM_WA_AAC_EOF WM_USER+2
+
+faadAACInfo file_info;
+
+faacDecHandle hDecoder;
+faacDecFrameInfo frameInfo;
+
+In_Module mod; // the output module (declared near the bottom of this file)
+char *lastfn; // currently playing file (used for getting info on the current file)
+int file_length; // file length, in bytes
+int decode_pos_ms; // current decoding position, in milliseconds
+int paused; // are we paused?
+int seek_needed; // if != -1, it is the point that the decode thread should seek to, in ms.
+
+char *sample_buffer; // sample buffer
+unsigned char *buffer; // input buffer
+unsigned char *memmap_buffer; // input buffer for whole file
+long memmap_index;
+
+long buffercount, fileread, bytecount;
+
+// seek table for ADTS header files
+unsigned long *seek_table = NULL;
+int seek_table_length=0;
+
+int killPlayThread=0; // the kill switch for the decode thread
+int PlayThreadAlive=0; // 1=play thread still running
+HANDLE play_thread_handle=INVALID_HANDLE_VALUE; // the handle to the decode thread
+FILE_STREAM *infile;
+
+/* Function definitions */
+int id3v2_tag(unsigned char *buffer);
+DWORD WINAPI PlayThread(void *b); // the decode thread procedure
+
+BOOL CALLBACK config_dialog_proc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);
+
+
+// 1= use vbr display, 0 = use average bitrate. This value only controls what shows up in the
+// configuration form. Also- Streaming uses an on-the-fly bitrate display regardless of this value.
+long m_variable_bitrate_display=0;
+long m_priority = 5;
+long m_memmap_file = 0;
+char m_format_string[50] = "%1 - %2";
+static char INI_FILE[MAX_PATH];
+
+char *priority_text[] = {	"",
+							"Decode Thread Priority: Lowest",
+							"Decode Thread Priority: Lower",
+							"Decode Thread Priority: Normal",
+							"Decode Thread Priority: Higher",
+							"Decode Thread Priority: Highest (default)"
+						};
+
+long priority_table[] = {0, THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_NORMAL, THREAD_PRIORITY_ABOVE_NORMAL, THREAD_PRIORITY_HIGHEST};
+
+long current_file_mode = 0;
+
+int PlayThread_memmap();
+int PlayThread_file();
+
+static void _r_s(char *name,char *data, int mlen)
+{
+	char buf[10];
+	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 variable_bitrate_display[10];
+    char priority[10];
+    char memmap_file[10];
+    char local_buffer_size[10];
+    char stream_buffer_size[10];
+
+	config_init();
+
+    RS(variable_bitrate_display);
+    RS(priority);
+    RS(m_format_string);
+    RS(memmap_file);
+    RS(local_buffer_size);
+    RS(stream_buffer_size);
+
+    m_priority = atoi(priority);
+    m_variable_bitrate_display = atoi(variable_bitrate_display);
+    m_memmap_file = atoi(memmap_file);
+    m_local_buffer_size = atoi(local_buffer_size);
+    m_stream_buffer_size = atoi(stream_buffer_size);
+}
+
+void config_write()
+{
+    char variable_bitrate_display[10];
+    char priority[10];
+    char memmap_file[10];
+    char local_buffer_size[10];
+    char stream_buffer_size[10];
+
+    itoa(m_priority, priority, 10);
+    itoa(m_variable_bitrate_display, variable_bitrate_display, 10);
+    itoa(m_memmap_file, memmap_file, 10);
+    itoa(m_local_buffer_size, local_buffer_size, 10);
+    itoa(m_stream_buffer_size, stream_buffer_size, 10);
+
+    WS(variable_bitrate_display);
+    WS(priority);
+    WS(m_format_string);
+    WS(memmap_file);
+    WS(local_buffer_size);
+    WS(stream_buffer_size);
+}
+
+void config(HWND hwndParent)
+{
+	DialogBox(mod.hDllInstance, MAKEINTRESOURCE(IDD_CONFIG), hwndParent, config_dialog_proc);
+}
+
+BOOL CALLBACK config_dialog_proc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+	char tmp[10];
+
+    switch (message)
+	{
+    case WM_INITDIALOG:
+        
+		SetDlgItemText(hwndDlg, IDC_FORMAT, m_format_string);
+
+		/* Set priority slider range and previous position */
+		SendMessage(GetDlgItem(hwndDlg, THREAD_PRIORITY_SLIDER), TBM_SETRANGE, TRUE, MAKELONG(1, 5)); 
+		SendMessage(GetDlgItem(hwndDlg, THREAD_PRIORITY_SLIDER), TBM_SETPOS, TRUE, m_priority);
+		SetDlgItemText(hwndDlg, IDC_STATIC2, priority_text[m_priority]);
+		
+		/* Put a limit to the amount of characters allowed in the buffer boxes */
+		SendMessage(GetDlgItem(hwndDlg, LOCAL_BUFFER_TXT), EM_LIMITTEXT, 4, 0);
+		SendMessage(GetDlgItem(hwndDlg, STREAM_BUFFER_TXT), EM_LIMITTEXT, 4, 0);
+
+	    if(m_variable_bitrate_display)
+			SendMessage(GetDlgItem(hwndDlg, VARBITRATE_CHK), BM_SETCHECK, BST_CHECKED, 0);
+	    if(m_memmap_file)
+			SendMessage(GetDlgItem(hwndDlg, IDC_MEMMAP), BM_SETCHECK, BST_CHECKED, 0);
+
+		itoa(m_local_buffer_size, tmp, 10);
+		SetDlgItemText(hwndDlg, LOCAL_BUFFER_TXT, tmp);
+
+		itoa(m_stream_buffer_size, tmp, 10);
+		SetDlgItemText(hwndDlg, STREAM_BUFFER_TXT, tmp);
+
+		return TRUE;
+
+	case WM_HSCROLL:
+
+		/* Thread priority slider moved */
+		if(GetDlgItem(hwndDlg, THREAD_PRIORITY_SLIDER) == (HWND) lParam)
+		{
+			int tmp;
+			tmp = SendMessage(GetDlgItem(hwndDlg, THREAD_PRIORITY_SLIDER), TBM_GETPOS, 0, 0);
+
+			if(tmp > 0)
+			{
+				m_priority = tmp;
+
+                SetDlgItemText(hwndDlg, IDC_STATIC2, priority_text[m_priority]);
+
+				if(play_thread_handle)
+					SetThreadPriority(play_thread_handle, priority_table[m_priority]);
+			}
+		}
+
+		return TRUE;
+
+    case WM_COMMAND:
+
+		if(HIWORD(wParam) == BN_CLICKED)
+		{
+			if(GetDlgItem(hwndDlg, VARBITRATE_CHK) == (HWND) lParam)
+			{
+				/* Variable Bitrate checkbox hit */
+				m_variable_bitrate_display = SendMessage(GetDlgItem(hwndDlg, VARBITRATE_CHK), BM_GETCHECK, 0, 0); 
+			}
+			if(GetDlgItem(hwndDlg, IDC_MEMMAP) == (HWND) lParam)
+			{
+				/* Variable Bitrate checkbox hit */
+				m_memmap_file = SendMessage(GetDlgItem(hwndDlg, IDC_MEMMAP), BM_GETCHECK, 0, 0); 
+			}
+		}
+
+        switch (LOWORD(wParam))
+		{
+			case OK_BTN:
+				/* User hit OK, save buffer settings (all others are set on command) */
+				GetDlgItemText(hwndDlg, LOCAL_BUFFER_TXT, tmp, 5);
+				m_local_buffer_size = atol(tmp);
+
+				GetDlgItemText(hwndDlg, STREAM_BUFFER_TXT, tmp, 5);
+				m_stream_buffer_size = atol(tmp);
+
+				GetDlgItemText(hwndDlg, IDC_FORMAT, m_format_string, 50);
+
+                config_write();
+
+			case IDCANCEL:
+			case CANCEL_BTN:
+				/* User hit Cancel or the X, just close without saving buffer settings */
+				EndDialog(hwndDlg, wParam);
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+void about(HWND hwndParent)
+{
+    MessageBox(hwndParent,"AudioCoding.com AAC Player\n"
+        "Compiled on: " __DATE__ "\n"
+        "http://www.audiocoding.com\n"
+        "Copyright 2002 AudioCoding.com",
+        "About AAC Player",MB_OK);
+}
+
+void init()
+{
+	char plugin_path[1024];
+	int i;
+
+    config_read();
+
+	hInstance_for_id3editor = mod.hDllInstance;
+
+    buffer = (unsigned char*)LocalAlloc(LPTR, 768*2);
+    lastfn = (char*)LocalAlloc(LPTR, 1024*sizeof(char));
+
+    /* Initialize winsock, necessary for streaming */
+    WinsockInit();
+}
+
+void quit()
+{
+    if (lastfn) LocalFree(lastfn);
+    if (buffer) LocalFree(buffer);
+
+    /* Deallocate winsock */
+    WinsockDeInit();
+
+	if(seek_table)
+	{
+		free(seek_table);
+		seek_table = NULL;
+		seek_table_length = 0;
+	}
+}
+
+int isourfile(char *fn)
+{
+    /* Finally fixed */
+    if(StringComp(fn + strlen(fn) - 3, "aac", 3) == 0)
+    {
+        return 1;
+    }
+
+    return 0;
+}
+
+unsigned long samplerate, channels;
+
+int play_memmap(char *fn)
+{
+    int tagsize = 0;
+
+    infile = open_filestream(fn);
+    
+	if (infile == NULL)
+        return 1;
+
+    fileread = filelength_filestream(infile);
+
+    memmap_buffer = (char*)LocalAlloc(LPTR, fileread);
+    read_buffer_filestream(infile, memmap_buffer, fileread);
+    memmap_index = 0;
+
+    tagsize = id3v2_tag(memmap_buffer);
+
+	/* If we find a tag, run right over it */
+    memmap_index += tagsize;
+
+    hDecoder = faacDecOpen();
+
+	/* Copy the configuration dialog setting and use it as the default */
+	/* initialize the decoder, and get samplerate and channel info */
+
+    if((buffercount = faacDecInit(hDecoder, memmap_buffer + memmap_index, &samplerate, &channels)) < 0)
+    {
+		MessageBox(mod.hMainWindow, "Error opening input file\n", "FAAD Error", MB_OK);
+		return 1;
+    }
+
+    memmap_index += buffercount;
+
+    PlayThread_memmap();
+
+    return 0;
+}
+
+int play_file(char *fn)
+{
+    int k;
+    int tagsize;
+
+    ZeroMemory(buffer, 768*2);
+
+    infile = open_filestream(fn);
+    
+	if (infile == NULL)
+        return 1;
+
+    fileread = filelength_filestream(infile);
+
+    buffercount = bytecount = 0;
+    read_buffer_filestream(infile, buffer, 768*2);
+
+    tagsize = id3v2_tag(buffer);
+
+	/* If we find a tag, run right over it */
+    if(tagsize)
+	{
+        if(infile->http)
+        {
+            int i;
+            /* Crude way of doing this, but I believe its fast enough to not make a big difference */
+            close_filestream(infile);
+            infile = open_filestream(fn);
+
+            for(i=0; i < tagsize; i++)
+                read_byte_filestream(infile);
+        }
+        else
+        {
+            seek_filestream(infile, tagsize, FILE_BEGIN);
+        }
+
+        bytecount = tagsize;
+        buffercount = 0;
+        read_buffer_filestream(infile, buffer, 768*2);
+    }
+
+    hDecoder = faacDecOpen();
+
+	/* Copy the configuration dialog setting and use it as the default */
+	/* initialize the decoder, and get samplerate and channel info */
+
+    if((buffercount = faacDecInit(hDecoder, buffer, &samplerate, &channels)) < 0)
+    {
+		MessageBox(mod.hMainWindow, "Error opening input file\n", "FAAD Error", MB_OK);
+		return 1;
+    }
+
+    if(buffercount > 0)
+	{
+		bytecount += buffercount;
+
+		for (k = 0; k < (768*2 - buffercount); k++)
+			buffer[k] = buffer[k + buffercount];
+
+		read_buffer_filestream(infile, buffer + (768*2) - buffercount, buffercount);
+		buffercount = 0;
+	}
+
+    PlayThread_file();
+
+    return 0;
+}
+
+int play(char *fn)
+{
+    int maxlatency;
+    int thread_id;
+
+    current_file_mode = m_memmap_file;
+
+    if (current_file_mode) {
+        if (play_memmap(fn))
+            return -1;
+    } else {
+        if (play_file(fn))
+            return -1;
+    }
+
+	if(seek_table)
+	{
+		free(seek_table);
+		seek_table = NULL;
+		seek_table_length = 0;
+	}
+
+	get_AAC_format(fn, &file_info, &seek_table, &seek_table_length, 0);
+
+	if(infile->http)
+	{
+		/* No seeking in http streams */
+		mod.is_seekable = 0;
+	}
+	else
+	{
+		if (file_info.headertype == 2) /* ADTS header - seekable */
+			mod.is_seekable = 1;
+		else
+			mod.is_seekable = 0; /* ADIF or Headerless - not seekable */
+	}
+
+    strcpy(lastfn,fn);
+    paused=0;
+    decode_pos_ms=0;
+    seek_needed=-1;
+
+    /*
+      To RageAmp: This is really needed, because aacinfo isn't very accurate on ADIF files yet.
+                  Can be fixed though :-)
+    */
+    file_info.sampling_rate = samplerate;
+    file_info.channels = frameInfo.channels;
+
+    maxlatency = mod.outMod->Open(file_info.sampling_rate, file_info.channels, 16, -1,-1);
+
+    if (maxlatency < 0) // error opening device
+    {
+        return -1;
+    }
+
+    // initialize vis stuff
+    mod.SAVSAInit(maxlatency, file_info.sampling_rate);
+    mod.VSASetInfo(file_info.sampling_rate, file_info.channels);
+
+    mod.SetInfo(file_info.bitrate/1000, file_info.sampling_rate/1000, file_info.channels,1);
+
+    mod.outMod->SetVolume(-666); // set the output plug-ins default volume
+
+    killPlayThread = 0;
+
+    if((play_thread_handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) PlayThread, (void *) &killPlayThread, 0, &thread_id)) == NULL)
+    {
+        MessageBox(mod.hMainWindow, "Fatal error: Cannot create playback thread\n", "FAAD Error", MB_OK);
+        return -1;
+    }
+
+    // Note: This line seriously slows down start up time
+	if(m_priority != 3) // if the priority in config window is set to normal, there is nothing to reset!
+	    SetThreadPriority(play_thread_handle, priority_table[m_priority]);
+
+    return 0;
+}
+
+void pause() { paused=1; mod.outMod->Pause(1); }
+void unpause() { paused=0; mod.outMod->Pause(0); }
+int ispaused() { return paused; }
+
+void stop()
+{
+    killPlayThread=1;
+
+    if (play_thread_handle != INVALID_HANDLE_VALUE)
+    {
+        if (WaitForSingleObject(play_thread_handle, INFINITE) == WAIT_TIMEOUT)
+            TerminateThread(play_thread_handle,0);
+        CloseHandle(play_thread_handle);
+        play_thread_handle = INVALID_HANDLE_VALUE;
+    }
+
+    faacDecClose(hDecoder);
+    close_filestream(infile);
+    mod.outMod->Close();
+    mod.SAVSADeInit();
+
+    if (memmap_buffer) LocalFree(memmap_buffer);
+	if(seek_table)
+	{
+		free(seek_table);
+		seek_table = NULL;
+		seek_table_length = 0;
+	}
+}
+
+int getlength()
+{
+    return file_info.length;
+}
+
+int getoutputtime()
+{
+    return decode_pos_ms+(mod.outMod->GetOutputTime()-mod.outMod->GetWrittenTime());
+}
+
+void setoutputtime(int time_in_ms)
+{
+    if (file_info.headertype == 2)
+        seek_needed=time_in_ms;
+    else
+        seek_needed = -1;
+}
+
+int aac_seek(int pos_ms, int *sktable)
+{
+    double offset_sec;
+
+    offset_sec = pos_ms / 1000.0;
+    if (!current_file_mode)
+    {
+        seek_filestream(infile, sktable[(int)(offset_sec+0.5)], FILE_BEGIN);
+
+        bytecount = sktable[(int)(offset_sec+0.5)];
+        buffercount = 0;
+        read_buffer_filestream(infile, buffer, 768*2);
+    } else {
+        memmap_index = sktable[(int)(offset_sec+0.5)];
+    }
+
+    return 0;
+}
+
+VOID EnableCheckbox(HWND checkBox, BOOL bEnable, BOOL bChecked)
+{
+    if (bEnable) {
+        EnableWindow(checkBox, TRUE);
+        SendMessage(checkBox, BM_SETCHECK, bChecked?BST_CHECKED:BST_UNCHECKED, 0);
+    } else {
+        EnableWindow(checkBox, FALSE);
+        SendMessage(checkBox, BM_SETCHECK, bChecked?BST_CHECKED:BST_UNCHECKED, 0);
+    }
+}
+
+void setvolume(int volume) { mod.outMod->SetVolume(volume); }
+void setpan(int pan) { mod.outMod->SetPan(pan); }
+
+char info_fn[255];
+BOOL bFileChanged;
+
+BOOL CALLBACK info_dialog_proc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    faadAACInfo format;
+    char *tmp_string;
+    char info[1024];
+    LV_COLUMN lvc;
+    BOOL bResult;
+
+    switch (message) {
+    case WM_INITDIALOG:
+        /* Set up the list control for the ID3 tag */
+        
+        /* Initialize the LV_COLUMN structure. */
+        lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+        lvc.fmt = LVCFMT_LEFT;
+
+        /* Add the columns. */
+        lvc.iSubItem = 0;
+        lvc.cx = 100;
+        lvc.pszText = "Frame";
+        ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_ID3LIST), 0, &lvc);
+        lvc.iSubItem = 1;
+        lvc.cx = 250;
+        lvc.pszText = "Data";
+        ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_ID3LIST), 1, &lvc);
+
+        /* get AAC info */
+        get_AAC_format(info_fn, &format, NULL, NULL, 1);
+
+        switch(format.headertype)
+        {
+        case 0: /* Headerless */
+            tmp_string = "RAW"; break;
+        case 1: /* ADIF */
+            tmp_string = "ADIF"; break;
+        case 2: /* ADTS */
+            tmp_string = "ADTS"; break;
+        }
+        SetDlgItemText(hwndDlg, IDC_HEADER, tmp_string);
+
+        if (format.object_type == 0 /* Main */)
+            tmp_string = "Main";
+        else if (format.object_type == 1 /* Low Complexity */)
+            tmp_string = "Low Complexity";
+        else if (format.object_type == 2 /* SSR */)
+            tmp_string = "SSR (unsupported)";
+        else if (format.object_type == 3 /* LTP */)
+            tmp_string = "Main LTP";
+        SetDlgItemText(hwndDlg, IDC_PROFILE, tmp_string);
+
+        if (format.version == 2) tmp_string = "MPEG2";
+        else tmp_string = "MPEG4";
+        SetDlgItemText(hwndDlg, IDC_VERSION, tmp_string);
+
+        wsprintf(info, "%d bps", format.bitrate);
+        SetDlgItemText(hwndDlg, IDC_BITRATE, info);
+
+        wsprintf(info, "%d Hz", format.sampling_rate);
+        SetDlgItemText(hwndDlg, IDC_SAMPLERATE, info);
+
+        wsprintf(info, "%d ch", format.channels);
+        SetDlgItemText(hwndDlg, IDC_CHANNELS, info);
+
+        FillID3List(hwndDlg, GetDlgItem(hwndDlg, IDC_ID3LIST), info_fn);
+        if (ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_ID3LIST)) == 0)
+            EnableWindow(GetDlgItem(hwndDlg, IDC_ID3V2TAG), FALSE);
+        else
+            EnableCheckbox(GetDlgItem(hwndDlg, IDC_ID3V2TAG), TRUE, TRUE);
+        bFileChanged = FALSE;
+
+        return TRUE;
+
+    case WM_NOTIFY:
+        
+        /* Branch depending on the specific notification message. */
+        switch (((LPNMHDR) lParam)->code) { 
+            
+        /* Process LVN_GETDISPINFO to supply information about */
+        /* callback items. */
+        case LVN_GETDISPINFO:
+            List_OnGetDispInfo((LV_DISPINFO *)lParam);
+            break;
+        case NM_DBLCLK:
+            bResult = List_EditData(hwndDlg, GetDlgItem(hwndDlg, IDC_ID3LIST));
+            if (bResult)
+                EnableCheckbox(GetDlgItem(hwndDlg, IDC_ID3V2TAG), TRUE, TRUE);
+            bFileChanged = bFileChanged ? bFileChanged : bResult;
+            break;
+        }
+        return TRUE;
+
+    case WM_COMMAND:
+        switch (LOWORD(wParam)) {
+        case IDC_ADDSTFRAMES:
+            bResult = List_AddStandardFrames(hwndDlg, GetDlgItem(hwndDlg, IDC_ID3LIST));
+            if (bResult)
+                EnableCheckbox(GetDlgItem(hwndDlg, IDC_ID3V2TAG), TRUE, TRUE);
+            bFileChanged = bFileChanged ? bFileChanged : bResult;
+            return TRUE;
+        case IDC_ADDFRAME:
+            bResult = List_AddFrame(hwndDlg, GetDlgItem(hwndDlg, IDC_ID3LIST));
+            if (bResult)
+                EnableCheckbox(GetDlgItem(hwndDlg, IDC_ID3V2TAG), TRUE, TRUE);
+            bFileChanged = bFileChanged ? bFileChanged : bResult;
+            return TRUE;
+        case IDC_DELFRAME:
+            bResult = List_DeleteSelected(hwndDlg, GetDlgItem(hwndDlg, IDC_ID3LIST));
+            if (ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_ID3LIST)) == 0)
+                EnableCheckbox(GetDlgItem(hwndDlg, IDC_ID3V2TAG), FALSE, FALSE);
+            bFileChanged = bFileChanged ? bFileChanged : bResult;
+            return TRUE;
+        case IDC_EDITFRAME:
+            bResult = List_EditData(hwndDlg, GetDlgItem(hwndDlg, IDC_ID3LIST));
+            if (bResult)
+                EnableCheckbox(GetDlgItem(hwndDlg, IDC_ID3V2TAG), TRUE, TRUE);
+            bFileChanged = bFileChanged ? bFileChanged : bResult;
+            return TRUE;
+        case IDC_ID3V2TAG:
+            bFileChanged = TRUE;
+            return TRUE;
+
+        case IDC_CLOSE:
+        case IDCANCEL:
+            if (bFileChanged == TRUE) {
+                if (MessageBox(hwndDlg, "Save changes?", "Save changes", MB_YESNO) == IDYES)
+                    List_SaveID3(hwndDlg, GetDlgItem(hwndDlg, IDC_ID3LIST), info_fn);
+            }
+            EndDialog(hwndDlg, wParam);
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+int infoDlg(char *fn, HWND hwnd)
+{
+    lstrcpy(info_fn, fn);
+
+    DialogBox(mod.hDllInstance, MAKEINTRESOURCE(IDD_INFO),
+        hwnd, info_dialog_proc);
+
+    return 0;
+}
+
+LPTSTR PathFindFileName(LPCTSTR pPath)
+{
+    LPCTSTR pT;
+
+    for (pT = pPath; *pPath; pPath = CharNext(pPath)) {
+        if ((pPath[0] == TEXT('\\') || pPath[0] == TEXT(':')) && pPath[1] && (pPath[1] != TEXT('\\')))
+            pT = pPath + 1;
+    }
+
+    return (LPTSTR)pT;   // const -> non const
+}
+
+int getsonglength(char *fn)
+{
+    faadAACInfo tmp;
+
+    get_AAC_format(fn, &tmp, NULL, NULL, 1);
+
+    return tmp.length;
+}
+
+void getfileinfo(char *filename, char *title, int *length_in_ms)
+{
+    if (!filename || !*filename)  // currently playing file
+    {
+        if (length_in_ms)
+            *length_in_ms=getlength();
+
+        if (title)
+            GetID3FileTitle(lastfn, title, m_format_string);
+    }
+    else // some other file
+    {
+        if (length_in_ms)
+            *length_in_ms = getsonglength(filename);
+
+        if (title)
+            GetID3FileTitle(filename, title, m_format_string);
+    }
+}
+
+void eq_set(int on, char data[10], int preamp)
+{
+}
+
+int last_frame;
+
+int PlayThread_memmap()
+{
+    sample_buffer = (char*)faacDecDecode(hDecoder, &frameInfo, memmap_buffer + memmap_index);
+    if (frameInfo.error)
+    {
+        MessageBox(NULL, faacDecGetErrorMessage(frameInfo.error), "FAAD Error", MB_OK);
+        last_frame = 1;
+    }
+
+    memmap_index += frameInfo.bytesconsumed;
+    if (memmap_index >= fileread)
+        last_frame = 1;
+
+    return frameInfo.bytesconsumed;
+}
+
+int PlayThread_file()
+{
+    int k;
+
+    if (buffercount > 0) {
+        for (k = 0; k < (768*2 - buffercount); k++)
+            buffer[k] = buffer[k + buffercount];
+
+        read_buffer_filestream(infile, buffer + (768*2) - buffercount, buffercount);
+        buffercount = 0;
+    }
+
+    sample_buffer = (char*)faacDecDecode(hDecoder, &frameInfo, buffer);
+    if (frameInfo.error)
+    {
+        MessageBox(NULL, faacDecGetErrorMessage(frameInfo.error), "FAAD Error", MB_OK);
+        last_frame = 1;
+    }
+
+    buffercount += frameInfo.bytesconsumed;
+
+    bytecount += frameInfo.bytesconsumed;
+    if (bytecount >= fileread)
+        last_frame = 1;
+
+    return frameInfo.bytesconsumed;
+}
+
+DWORD WINAPI PlayThread(void *b)
+{
+    int done=0;
+    int l;
+	int decoded_frames=0;
+	int br_calc_frames=0;
+	int br_bytes_consumed=0;
+    unsigned long bytesconsumed;
+
+	PlayThreadAlive = 1;
+    last_frame = 0;
+
+    while (! *((int *)b) )
+    {
+        if (seek_needed != -1)
+        {
+            int seconds;
+
+            // Round off to a second
+            seconds = seek_needed - (seek_needed%1000);
+            mod.outMod->Flush(decode_pos_ms);
+            aac_seek(seconds, seek_table);
+            decode_pos_ms = seconds;
+			seek_needed = -1;
+			decoded_frames = 0;
+			br_calc_frames = 0;
+			br_bytes_consumed = 0;
+        }
+
+        if (done)
+        {
+            mod.outMod->CanWrite();
+
+            if (!mod.outMod->IsPlaying())
+            {
+                PostMessage(mod.hMainWindow,WM_WA_AAC_EOF,0,0);
+                PlayThreadAlive = 0;
+                return 0;
+            }
+
+            Sleep(10);
+        }
+        //assume that max channels is 2.
+        else if (mod.outMod->CanWrite() >= ((1024*file_info.channels*sizeof(short))<<(mod.dsp_isactive()?1:0)))
+        {
+            if(last_frame)
+            {
+                done=1;
+            }
+            else
+            {
+                if (current_file_mode)
+                    bytesconsumed = PlayThread_memmap();
+                else
+                    bytesconsumed = PlayThread_file();
+
+				decoded_frames++;
+				br_calc_frames++;
+				br_bytes_consumed += bytesconsumed;
+
+				/* Update the variable bitrate about every second */
+				if(m_variable_bitrate_display && br_calc_frames == 43)
+				{
+					int br;
+
+					br = (int)((br_bytes_consumed * 8) / (decoded_frames / 43.07));
+
+					mod.SetInfo(br/1000, file_info.sampling_rate/1000, file_info.channels, 1);
+					br_calc_frames = 0;
+				}
+
+                if (!killPlayThread && (frameInfo.samples > 0))
+                {
+                    mod.SAAddPCMData(sample_buffer,file_info.channels, 16, decode_pos_ms);
+                    mod.VSAAddPCMData(sample_buffer,file_info.channels, 16, decode_pos_ms);
+                    decode_pos_ms+=(1024*1000)/file_info.sampling_rate;
+
+                    if (mod.dsp_isactive())
+                        l=mod.dsp_dosamples((short *)sample_buffer,frameInfo.samples*sizeof(short)/file_info.channels/(16/8),16,file_info.channels,file_info.sampling_rate)*(file_info.channels*(16/8));
+                    else
+                        l = frameInfo.samples*sizeof(short);
+
+                    mod.outMod->Write(sample_buffer, l);
+                }
+            }
+        }
+        else
+        {
+            Sleep(10);
+        }
+    }
+
+	if(seek_table)
+	{
+		free(seek_table);
+		seek_table = NULL;
+		seek_table_length = 0;
+	}
+    
+	PlayThreadAlive = 0;
+	
+    return 0;
+}
+
+int id3v2_tag(unsigned char *buffer)
+{
+    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;
+
+        return tagsize;
+    }
+	else
+	{
+        return 0;
+    }
+}
+
+In_Module mod =
+{
+    IN_VER,
+    "AudioCoding.com AAC Player: " __DATE__,
+    0,  // hMainWindow
+    0,  // hDllInstance
+    "AAC\0AAC File (*.AAC)\0"
+    ,
+    1, // is_seekable
+    1, // uses output
+    config,
+    about,
+    init,
+    quit,
+    getfileinfo,
+    infoDlg,
+    isourfile,
+    play,
+    pause,
+    unpause,
+    ispaused,
+    stop,
+
+    getlength,
+    getoutputtime,
+    setoutputtime,
+
+    setvolume,
+    setpan,
+
+    0,0,0,0,0,0,0,0,0, // vis stuff
+
+
+    0,0, // dsp
+
+    eq_set,
+
+    NULL,       // setinfo
+
+    0 // out_mod
+};
+
+__declspec( dllexport ) In_Module * winampGetInModule2()
+{
+    return &mod;
+}
--- /dev/null
+++ b/plugins/winamp/in_faad.dsp
@@ -1,0 +1,147 @@
+# Microsoft Developer Studio Project File - Name="in_faad" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=in_faad - 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 "in_faad.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 "in_faad.mak" CFG="in_faad - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "in_faad - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "in_faad - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=xicl6.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "in_faad - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# 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 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /I "..\..\common\faad" /I "..\..\plugins\winamp" /I "..\..\common\id3lib\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ID3LIB_COMPILATION" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x413 /d "NDEBUG"
+# ADD RSC /l 0x413 /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 /subsystem:windows /dll /machine:I386
+# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+
+!ELSEIF  "$(CFG)" == "in_faad - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\common\faad" /I "..\..\plugins\winamp" /I "..\..\common\id3lib\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ID3LIB_COMPILATION" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x413 /d "_DEBUG"
+# ADD RSC /l 0x413 /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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "in_faad - Win32 Release"
+# Name "in_faad - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\common\faad\aacinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\common\faad\filestream.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\common\faad\id3v2tag.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\in_faad.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\common\faad\aacinfo.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\faad.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\common\faad\filestream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\common\faad\id3v2tag.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\in2.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\out.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\plugin_dlg.rc
+# End Source File
+# End Group
+# End Target
+# End Project
--- /dev/null
+++ b/plugins/winamp/in_faad.dsw
@@ -1,0 +1,74 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "id3lib"=..\..\common\id3lib\libprj\id3lib.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name zlib
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "in_faad"=.\in_faad.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name id3lib
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name libfaad
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "libfaad"=..\..\libfaad\libfaad.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "zlib"=..\..\common\id3lib\zlib\prj\zlib.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
--- /dev/null
+++ b/plugins/winamp/out.h
@@ -1,0 +1,52 @@
+#define OUT_VER 0x10
+
+typedef struct
+{
+    int version;                // module version (OUT_VER)
+    char *description;          // description of module, with version string
+    int id;                     // module id. each input module gets its own. non-nullsoft modules should
+                                // be >= 65536.
+
+    HWND hMainWindow;           // winamp's main window (filled in by winamp)
+    HINSTANCE hDllInstance;     // DLL instance handle (filled in by winamp)
+
+    void (*Config)(HWND hwndParent); // configuration dialog
+    void (*About)(HWND hwndParent);  // about dialog
+
+    void (*Init)();             // called when loaded
+    void (*Quit)();             // called when unloaded
+
+    int (*Open)(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms);
+                    // returns >=0 on success, <0 on failure
+                    // NOTENOTENOTE: bufferlenms and prebufferms are ignored in most if not all output plug-ins.
+                    //    ... so don't expect the max latency returned to be what you asked for.
+                    // returns max latency in ms (0 for diskwriters, etc)
+                    // bufferlenms and prebufferms must be in ms. 0 to use defaults.
+                    // prebufferms must be <= bufferlenms
+
+    void (*Close)();    // close the ol' output device.
+
+    int (*Write)(char *buf, int len);
+                    // 0 on success. Len == bytes to write (<= 8192 always). buf is straight audio data.
+                    // 1 returns not able to write (yet). Non-blocking, always.
+
+    int (*CanWrite)();  // returns number of bytes possible to write at a given time.
+                        // Never will decrease unless you call Write (or Close, heh)
+
+    int (*IsPlaying)(); // non0 if output is still going or if data in buffers waiting to be
+                        // written (i.e. closing while IsPlaying() returns 1 would truncate the song
+
+    int (*Pause)(int pause); // returns previous pause state
+
+    void (*SetVolume)(int volume); // volume is 0-255
+    void (*SetPan)(int pan); // pan is -128 to 128
+
+    void (*Flush)(int t);   // flushes buffers and restarts output at time t (in ms)
+                            // (used for seeking)
+
+    int (*GetOutputTime)(); // returns played time in MS
+    int (*GetWrittenTime)(); // returns time written in MS (used for synching up vis stuff)
+
+} Out_Module;
+
+
--- /dev/null
+++ b/plugins/winamp/plugin_dlg.rc
@@ -1,0 +1,277 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CONFIG DIALOGEX 0, 0, 261, 133
+STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "FAAC Decoder Configuration"
+FONT 8, "MS Sans Serif"
+BEGIN
+    CONTROL         "Enable variable bitrate display",VARBITRATE_CHK,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,119,7,109,10
+    EDITTEXT        STREAM_BUFFER_TXT,187,21,21,12,ES_AUTOHSCROLL | 
+                    ES_NUMBER
+    EDITTEXT        LOCAL_BUFFER_TXT,187,38,21,12,ES_AUTOHSCROLL | ES_NUMBER
+    CONTROL         "Buffer entire files into memory",IDC_MEMMAP,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,119,60,107,10
+    CONTROL         "Slider1",THREAD_PRIORITY_SLIDER,"msctls_trackbar32",
+                    TBS_AUTOTICKS | WS_TABSTOP,119,89,99,11,
+                    WS_EX_TRANSPARENT
+    PUSHBUTTON      "OK",OK_BTN,74,112,50,14
+    PUSHBUTTON      "Cancel",CANCEL_BTN,137,112,50,14
+    LTEXT           "HTTP stream buffer:",IDC_STATIC,119,22,65,8
+    LTEXT           "Decode Thread Priority: Highest (default)",IDC_STATIC2,
+                    119,78,135,8
+    LTEXT           "Local file buffer: ",IDC_STATIC,119,40,53,8
+    GROUPBOX        "Title Format",IDC_STATIC,7,7,102,95
+    EDITTEXT        IDC_FORMAT,13,20,89,14,ES_AUTOHSCROLL
+    LTEXT           "%0 Track",IDC_STATIC,13,41,31,8
+    LTEXT           "%1 Artist",IDC_STATIC,13,51,28,8
+    LTEXT           "%2 Title",IDC_STATIC,13,61,26,8
+    LTEXT           "%3 Album",IDC_STATIC,13,71,32,8
+    LTEXT           "%4 Year",IDC_STATIC,13,81,27,8
+    LTEXT           "%5 Comment",IDC_STATIC,58,41,42,8
+    LTEXT           "%6 Genre",IDC_STATIC,58,51,32,8
+    LTEXT           "%7 Filename",IDC_STATIC,58,61,40,8
+END
+
+IDD_INFO DIALOGEX 0, 0, 401, 237
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "File Properties"
+FONT 8, "MS Sans Serif"
+BEGIN
+    CONTROL         "ID3v2 tag",IDC_ID3V2TAG,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,145,17,47,10
+    PUSHBUTTON      "Add standard",IDC_ADDSTFRAMES,145,209,50,14
+    PUSHBUTTON      "Add frame",IDC_ADDFRAME,200,209,50,14
+    PUSHBUTTON      "Edit frame",IDC_EDITFRAME,255,209,50,14
+    PUSHBUTTON      "Delete frame",IDC_DELFRAME,310,209,50,14
+    PUSHBUTTON      "Close",IDC_CLOSE,7,216,50,14
+    GROUPBOX        "ID3v2",IDC_STATIC,137,7,257,223
+    GROUPBOX        "AAC file info",IDC_STATIC,7,7,122,92
+    LTEXT           "Header type:",IDC_STATIC,21,34,42,8
+    LTEXT           "Profile:",IDC_STATIC,41,46,22,8
+    LTEXT           "Bitrate:",IDC_STATIC,40,58,23,8
+    LTEXT           "Samplerate:",IDC_STATIC,25,70,38,8
+    LTEXT           "Channels:",IDC_STATIC,31,82,32,8
+    LTEXT           "-",IDC_HEADER,69,34,50,8
+    LTEXT           "-",IDC_PROFILE,69,46,50,8
+    LTEXT           "-",IDC_BITRATE,69,58,50,8
+    LTEXT           "-",IDC_SAMPLERATE,69,70,50,8
+    LTEXT           "-",IDC_CHANNELS,69,82,50,8
+    LTEXT           "MPEG version:",IDC_STATIC,15,22,48,8
+    LTEXT           "-",IDC_VERSION,69,22,50,8
+    CONTROL         "List1",IDC_ID3LIST,"SysListView32",LVS_REPORT | 
+                    LVS_NOSORTHEADER | WS_TABSTOP,145,32,243,173,
+                    WS_EX_CLIENTEDGE
+END
+
+IDD_EDITTEXTFRAME DIALOGEX 0, 0, 210, 63
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Edit text frame"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    EDITTEXT        IDC_EDITTEXTFRAME,71,23,132,12,ES_AUTOHSCROLL
+    DEFPUSHBUTTON   "OK",IDOK,108,42,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,51,42,50,14
+    EDITTEXT        IDC_TEXTFRAMENAME,71,6,132,12,ES_AUTOHSCROLL
+    LTEXT           "Frame description",IDC_STATIC,11,9,56,8
+    LTEXT           "Frame data",IDC_STATIC,22,26,45,8,0,WS_EX_RIGHT
+END
+
+IDD_ADDFRAME DIALOGEX 0, 0, 213, 84
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Dialog"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    COMBOBOX        IDC_FRAMETYPE,72,7,134,63,CBS_DROPDOWNLIST | WS_VSCROLL | 
+                    WS_TABSTOP
+    EDITTEXT        IDC_COL0,72,23,134,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_COL1,72,39,134,12,ES_AUTOHSCROLL
+    DEFPUSHBUTTON   "OK",IDOK,109,63,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,53,63,50,14
+    LTEXT           "Frame type",IDC_STATIC,31,10,36,8
+    LTEXT           "Frame description",IDC_STATIC,11,25,56,8
+    LTEXT           "Frame data",IDC_STATIC,18,41,50,8,0,WS_EX_RIGHT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE 
+BEGIN
+    IDD_CONFIG, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 254
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 126
+    END
+
+    IDD_INFO, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 394
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 230
+    END
+
+    IDD_EDITTEXTFRAME, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 203
+        TOPMARGIN, 6
+        BOTTOMMARGIN, 56
+    END
+
+    IDD_ADDFRAME, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 206
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 77
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Dutch (Netherlands) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NLD)
+#ifdef _WIN32
+LANGUAGE LANG_DUTCH, SUBLANG_DUTCH
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ADDSTANDARD DIALOG DISCARDABLE  0, 0, 243, 245
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Add standard frames"
+FONT 8, "MS Sans Serif"
+BEGIN
+    EDITTEXT        IDC_TRACK,63,22,162,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_TITLE,63,36,162,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_ARTIST,63,52,162,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_ALBUM,63,68,162,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_YEAR,63,82,40,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_GENRE,132,81,93,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_COMMENT,63,97,162,35,ES_MULTILINE | ES_AUTOHSCROLL | 
+                    WS_VSCROLL
+    EDITTEXT        IDC_COMPOSER,63,135,162,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_ORIGARTIST,63,151,162,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_COPYRIGHT,63,164,162,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_URL,63,180,162,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_ENCBY,63,196,162,12,ES_AUTOHSCROLL
+    DEFPUSHBUTTON   "OK",IDOK,120,224,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,61,224,50,14
+    LTEXT           "Track #:",IDC_STATIC,26,24,28,8
+    LTEXT           "Title",IDC_STATIC,40,39,14,8
+    LTEXT           "Artist",IDC_STATIC,38,54,16,8
+    LTEXT           "Album",IDC_STATIC,34,69,20,8
+    LTEXT           "Year",IDC_STATIC,38,85,16,8
+    LTEXT           "Genre",IDC_STATIC,109,83,20,8
+    LTEXT           "Comment",IDC_STATIC,24,98,30,8
+    LTEXT           "Composer",IDC_STATIC,22,138,32,8
+    LTEXT           "Orig. artist",IDC_STATIC,22,152,32,8
+    LTEXT           "Copyright",IDC_STATIC,24,168,30,8
+    LTEXT           "URL",IDC_STATIC,38,182,16,8
+    LTEXT           "Encoded by",IDC_STATIC,15,197,39,8
+    GROUPBOX        "Standard frames",IDC_STATIC,7,7,229,210
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE 
+BEGIN
+    IDD_ADDSTANDARD, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 236
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 238
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+#endif    // Dutch (Netherlands) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
--- /dev/null
+++ b/plugins/winamp/resource.h
@@ -1,0 +1,63 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by plugin_dlg.rc
+//
+#define PLUGIN_DLG                      101
+#define IDD_CONFIG                      101
+#define IDD_INFO                        102
+#define IDD_EDITTEXTFRAME               103
+#define IDD_ADDFRAME                    104
+#define IDD_ADDSTANDARD                 105
+#define VARBITRATE_CHK                  1004
+#define BUFFERING_SLIDER                1006
+#define THREAD_PRIORITY_SLIDER          1007
+#define IDC_ID3V2TAG                    1020
+#define IDC_CLOSE                       1021
+#define IDC_CANCEL                      1022
+#define IDC_HEADER                      1025
+#define IDC_PROFILE                     1026
+#define IDC_BITRATE                     1027
+#define IDC_SAMPLERATE                  1028
+#define IDC_CHANNELS                    1029
+#define IDC_VERSION                     1030
+#define IDC_ID3LIST                     1032
+#define IDC_STATIC2                     1034
+#define LOCAL_BUFFER_TXT                1035
+#define STREAM_BUFFER_TXT               1036
+#define IDC_CHECK1                      1037
+#define IDC_MEMMAP                      1037
+#define OK_BTN                          1038
+#define CANCEL_BTN                      1039
+#define IDC_EDITTEXTFRAME               1040
+#define IDC_FRAMETYPE                   1040
+#define IDC_TEXTFRAMENAME               1041
+#define IDC_COL0                        1041
+#define IDC_DELFRAME                    1042
+#define IDC_COL1                        1042
+#define IDC_EDITFRAME                   1043
+#define IDC_ADDFRAME                    1044
+#define IDC_TRACK                       1045
+#define IDC_ADDSTFRAMES                 1045
+#define IDC_TITLE                       1046
+#define IDC_FORMAT                      1046
+#define IDC_ARTIST                      1047
+#define IDC_ALBUM                       1048
+#define IDC_YEAR                        1049
+#define IDC_COMMENT                     1050
+#define IDC_COMPOSER                    1051
+#define IDC_ORIGARTIST                  1052
+#define IDC_COPYRIGHT                   1053
+#define IDC_URL                         1054
+#define IDC_ENCBY                       1055
+#define IDC_GENRE                       1056
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        106
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1047
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif