Index: /winamp-musepack/trunk/in_mpc.cpp
===================================================================
--- /winamp-musepack/trunk/in_mpc.cpp	(revision 321)
+++ /winamp-musepack/trunk/in_mpc.cpp	(revision 322)
@@ -1,4 +1,4 @@
 /*
-	Copyright (C) 2006 Nicolas BOTTI <rududu at laposte.net>
+	Copyright (C) 2006-2007 Nicolas BOTTI <rududu at laposte.net>
 	This file is part of the Musepack Winamp plugin.
 
@@ -48,4 +48,5 @@
 
 mpc_player * player;
+mpc_player * player_ext;
 
 // module definition.
@@ -93,9 +94,10 @@
 void config(HWND hwndParent)
 {
-	MessageBoxA(hwndParent, "No configuration yet", "Configuration", MB_OK);
+	MessageBoxA(hwndParent, "Do you really need a configuration ?", "Musepack Configuration", MB_OK);
 }
 void about(HWND hwndParent)
 {
-	MessageBoxA(hwndParent,"Musepack plugin for winamp\nAll bugs © Nicolas BOTTI", "Uh ?", MB_OK);
+	if (MessageBoxA(hwndParent,"Musepack plugin for winamp\nAll bugs © Nicolas BOTTI\n\nDo you want to go to http://www.musepack.net ?", "Uh ?", MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES)
+		ShellExecute( hwndParent, "open", "http://www.musepack.net", NULL, NULL, SW_NORMAL);
 }
 
@@ -225,3 +227,17 @@
 }
 
-}
+__declspec( dllexport ) int winampGetExtendedFileInfo(const char *fn, const char *data, char *dest, int destlen )
+{
+	if ( !fn || (fn && !fn[0]) ) return 0;
+
+	if (player_ext == 0)
+		player_ext = new mpc_player(fn, 0);
+	else
+		player_ext->openFile(fn);
+
+	dest[0] = 0;
+
+	return player_ext->getExtendedFileInfo(data, dest, destlen);
+}
+
+}
Index: /winamp-musepack/trunk/mpc_player.cpp
===================================================================
--- /winamp-musepack/trunk/mpc_player.cpp	(revision 321)
+++ /winamp-musepack/trunk/mpc_player.cpp	(revision 322)
@@ -1,4 +1,4 @@
 /*
-	Copyright (C) 2006 Nicolas BOTTI <rududu at laposte.net>
+	Copyright (C) 2006-2007 Nicolas BOTTI <rududu at laposte.net>
 	This file is part of the Musepack Winamp plugin.
 
@@ -20,4 +20,5 @@
 #include <windows.h>
 #include <math.h>
+#include <strsafe.h>
 
 #include <sstream>
@@ -66,5 +67,5 @@
 }
 
-mpc_player::mpc_player(char * fn, In_Module * in_mod)
+mpc_player::mpc_player(const char * fn, In_Module * in_mod)
 {
 	init(in_mod);
@@ -92,6 +93,9 @@
 }
 
-int mpc_player::openFile(char * fn)
-{
+int mpc_player::openFile(const char * fn)
+{
+	if (strcmp(fn, lastfn) == 0)
+		return 0;
+
 	closeFile();
 
@@ -425,2 +429,54 @@
 	return 0;
 }
+
+int mpc_player::getExtendedFileInfo(const char *data, char *dest, int destlen )
+{
+	if (!stricmp(data, "length")) {
+		StringCchPrintfA(dest, destlen, "%u", getLength());
+	} else if (!stricmp(data, "bitrate")) {
+		StringCchPrintfA(dest, destlen, "%u", (unsigned int)(si.average_bitrate/1000.));
+	} else if (!stricmp(data, "replaygain_album_gain"))	{
+		if (si.gain_album)
+			StringCchPrintfA(dest, destlen, "%-+.2f dB", 64.82f - si.gain_album / 256.f);
+	} else if (!stricmp(data, "replaygain_album_peak"))	{
+		if (si.peak_album)
+			StringCchPrintfA(dest, destlen, "%-.9f", (float)((1 << 15) / pow(10, si.peak_album / (20 * 256))));
+	} else if (!stricmp(data, "replaygain_track_gain"))	{
+		if (si.gain_title)
+			StringCchPrintfA(dest, destlen, "%-+.2f dB", 64.82f - si.gain_title / 256.f);
+	} else if (!stricmp(data, "replaygain_track_peak"))	{		
+		if (si.peak_title)
+			StringCchPrintfA(dest, destlen, "%-.9f", (float)((1 << 15) / pow(10, si.peak_title / (20 * 256))));
+	} else {
+
+		if (tag_file == 0)
+			tag_file = new TagLib::FileRef(lastfn, false);
+
+		if (!tag_file->isNull() && tag_file->tag()) {
+			TagLib::Tag *tag = tag_file->tag();
+			WCHAR buf[2048];
+
+			if (!stricmp(data, "title"))
+				MultiByteToWideChar(CP_UTF8, 0, tag->title().toCString(true), -1, buf, 2048);
+			else if (!stricmp(data, "artist"))
+				MultiByteToWideChar(CP_UTF8, 0, tag->artist().toCString(true), -1, buf, 2048);
+			else if (!stricmp(data, "album"))
+				MultiByteToWideChar(CP_UTF8, 0, tag->album().toCString(true), -1, buf, 2048);
+			else if (!stricmp(data, "comment"))
+				MultiByteToWideChar(CP_UTF8, 0, tag->comment().toCString(true), -1, buf, 2048);
+			else if (!stricmp(data, "genre"))
+				MultiByteToWideChar(CP_UTF8, 0, tag->genre().toCString(true), -1, buf, 2048);
+			else if (!stricmp(data, "trackno")) {
+				StringCchPrintfA(dest, destlen, "%u", tag->track());
+				return 1;
+			} else if (!stricmp(data, "year")) {
+				StringCchPrintfA(dest, destlen, "%u", tag->year());
+				return 1;
+			}
+
+			WideCharToMultiByte(CP_ACP, 0, buf, -1, dest, destlen, NULL, NULL);
+		} else
+			return 0;
+	}
+	return 1;
+}
Index: /winamp-musepack/trunk/mpc_player.h
===================================================================
--- /winamp-musepack/trunk/mpc_player.h	(revision 321)
+++ /winamp-musepack/trunk/mpc_player.h	(revision 322)
@@ -1,4 +1,4 @@
 /*
-	Copyright (C) 2006 Nicolas BOTTI <rududu at laposte.net>
+	Copyright (C) 2006-2007 Nicolas BOTTI <rududu at laposte.net>
 	This file is part of the Musepack Winamp plugin.
 
@@ -32,12 +32,14 @@
 public:
 	mpc_player(In_Module * in_mod);
-	mpc_player(char * fn, In_Module * in_mod);
+	mpc_player(const char * fn, In_Module * in_mod);
 	~mpc_player(void);
 
+	int openFile(const char * fn);
 	int play(char *fn);
 	void stop(void);
 
 	void getFileInfo(char *title, int *length_in_ms);
-	int getLength(void) {return (int)(si.samples * 1000 / si.sample_freq);}
+	int getExtendedFileInfo(const char *data, char *dest, int destlen);
+	int getLength(void) {return (int)(mpc_streaminfo_get_length(&si) * 1000);}
 	int getOutputTime(void) {return (int)(decode_pos_sample * 1000 / si.sample_freq);}
 
@@ -72,5 +74,4 @@
 	static DWORD WINAPI runThread(void * pThis);
 	int decodeFile(void);
-	int openFile(char * fn);
 	void closeFile(void);
 
