changeset 1391:58f74efbe943

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author William Pitcock <nenolod@atheme-project.org>
date Fri, 27 Jul 2007 16:20:15 -0500
parents 095595555e7b (current diff) e2754a023ae0 (diff)
children d872ca28881f
files src/cdaudio/Makefile src/cdaudio/cdaudio.c src/cdaudio/cdaudio.h src/cdaudio/cddb.c src/cdaudio/cddb.h src/cdaudio/cdinfo.c src/cdaudio/cdinfo.h src/cdaudio/configure.c src/cdaudio/http.c src/cdaudio/http.h
diffstat 25 files changed, 526 insertions(+), 4021 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Fri Jul 27 16:20:08 2007 -0500
+++ b/configure.ac	Fri Jul 27 16:20:15 2007 -0500
@@ -110,22 +110,6 @@
     [Path to OSS mixer, default is /dev/mixer.]
 )
 
-AC_ARG_WITH(cdda-device,
-    [  --with-cdda-device=path        Path to default cdaudio device.],
-    [AC_DEFINE_UNQUOTED(CDDA_DEVICE, "$withval",
-         [Path to default cdaudio device.]
-     )
-    ]
-)
-
-AC_ARG_WITH(cdda-dir,
-    [  --with-cdda-dir=path           Path to default cdaudio directory.],
-    [AC_DEFINE_UNQUOTED(CDDA_DIRECTORY, "$withval",
-         [Path to default cdaudio directory.]
-     )
-    ]
-)
-
 dnl These plugins are always built.
 
 INPUT_PLUGINS="tonegen console sexypsf wav cue alac metronom vtx"
@@ -1107,33 +1091,12 @@
 AC_CHECK_FUNCS([mkdtemp getmntinfo statvfs strtoul])
 
 
-if test "${ac_cv_header_linux_cdrom_h}" = "yes" || test "${ac_cv_header_sys_cdio_h}" = "yes"
-then
-    INPUT_PLUGINS="cdaudio $INPUT_PLUGINS"
-    case "$host" in
-        *-*-sunos* | *-*-solaris* | *-*-linux*)
-            AC_DEFINE(BEEP_CDROM_SOLARIS,, [Define if cdrom access is in Solaris style])
-        ;;
-        *-*-freebsd*)
-            AC_DEFINE(BEEP_CDROM_BSD,, [Define if cdrom access is in BSD style])
-        ;;
-        *-*-netbsd* | *-*-openbsd* | *-*-mirbsd*)
-            AC_DEFINE(BEEP_CDROM_BSD,, [Define if cdrom access is in BSD style])
-            AC_DEFINE(BEEP_CDROM_BSD_NETBSD,, [Define if cdrom access uses NetBSD variant])
-        ;;
-        *-*darwin*)
-            AC_DEFINE(BEEP_CDROM_BSD,, [Define if cdrom access is in BSD style])
-            AC_DEFINE(BEEP_CDROM_BSD_DARWIN,, [Define if cdrom access uses Darwin variant])
-        ;;
-    esac
-fi
-
 dnl CD-Audio New Generation
 
-AC_ARG_ENABLE(cdaudio-ng,
-    [  --enable-cdaudio_ng     enable cdaudio-ng input plugin (default=disabled) ],
+AC_ARG_ENABLE(cdaudio,
+    [  --disable-cdaudio       disable cdaudio-ng input plugin (default=enabled) ],
     [enable_cdaudio_ng=$enableval],
-    [enable_cdaudio_ng=no]
+    [enable_cdaudio_ng=yes]
 )
 
 if test "$enable_cdaudio_ng" = "yes"; then
@@ -1512,8 +1475,7 @@
 echo "    -> FluidSynth backend:                $enable_amidiplug_fluidsynth"
 echo "    -> dummy backend:                     $enable_amidiplug_dummy"
 echo "  MIDI to WAVE converter (timidity):      $enable_timidity"
-echo "  CD Digital Audio (cdda):                yes"
-echo "  New CD Digital Audio (cdaudio-ng):      $enable_cdaudio_ng"
+echo "  CD Digital Audio (cdaudio_ng):          $enable_cdaudio_ng"
 echo "  Microsoft WAV (wav):                    yes"
 echo "    + sndfile extensions:                 $enable_sndfile"
 echo "  Tone Generator:                         yes"
--- a/src/OSS/configure.c	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/OSS/configure.c	Fri Jul 27 16:20:15 2007 -0500
@@ -124,15 +124,17 @@
 scan_devices(gchar * type, GtkWidget * option_menu, GtkSignalFunc sigfunc)
 {
     GtkWidget *menu, *item;
-    VFSFile *file;
+    FILE *file;
     gchar buffer[256], *temp, *tmp2;
     gboolean found = FALSE;
     gint index = 0;
 
     menu = gtk_menu_new();
 
-    if ((file = vfs_fopen("/dev/sndstat", "r"))) {
-        while (vfs_fgets(buffer, 255, file)) {
+    if ((file = fopen("/dev/sndstat",             "r")) ||    
+        (file = fopen("/proc/asound/sndstat",     "r")) ||    
+        (file = fopen("/proc/asound/oss/sndstat", "r")))  {   
+        while (fgets(buffer, 255, file)) {
             if (found && buffer[0] == '\n')
                 break;
             if (buffer[strlen(buffer) - 1] == '\n')
@@ -162,7 +164,7 @@
                 found = 1;
 
         }
-        vfs_fclose(file);
+        fclose(file);
     }
     else {
         item = gtk_menu_item_new_with_label(_("Default"));
--- a/src/aosd/aosd_ui.c	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/aosd/aosd_ui.c	Fri Jul 27 16:20:15 2007 -0500
@@ -230,7 +230,7 @@
   aosd_callback_list_add( cb_list , pos_offset_table , aosd_cb_configure_position_offset_commit );
   aosd_callback_list_add( cb_list , pos_offset_table , aosd_cb_configure_position_maxsize_commit );
 
-  pos_multimon_frame = gtk_frame_new( "Multi-Monitor options" );
+  pos_multimon_frame = gtk_frame_new( _("Multi-Monitor options") );
   pos_multimon_hbox = gtk_hbox_new( FALSE , 4 );
   gtk_container_set_border_width( GTK_CONTAINER(pos_multimon_hbox) , 6 );
   gtk_container_add( GTK_CONTAINER(pos_multimon_frame), pos_multimon_hbox );
@@ -396,7 +396,7 @@
   for ( i = 0 ; i < AOSD_TEXT_FONTS_NUM ; i++ )
   {
     GdkColor gcolor = { 0 , 0 , 0 , 0 };
-    gchar *label_str = g_strdup_printf( "Font %i:" , i+1 );
+    gchar *label_str = g_strdup_printf( _("Font %i:") , i+1 );
     tex_font_label[i] = gtk_label_new( label_str );
     g_free( label_str );
     tex_font_fontbt[i] = gtk_font_button_new();
@@ -566,7 +566,7 @@
       colors_max_num = colors_num;
     gtk_list_store_append( dec_rstyle_store , &iter );
     gtk_list_store_set( dec_rstyle_store , &iter ,
-      0 , aosd_deco_style_get_desc( deco_code_array[i] ) ,
+      0 , _(aosd_deco_style_get_desc( deco_code_array[i] )) ,
       1 , deco_code_array[i] , 2 , colors_num , -1 );
     if ( deco_code_array[i] == cfg->osd->decoration.code )
       iter_sel = iter;
@@ -609,7 +609,7 @@
     GdkColor gcolor = { 0 , 0 , 0 , 0 };
     gchar *label_str = NULL;
     hbox = gtk_hbox_new( FALSE , 4 );
-    label_str = g_strdup_printf( "Color %i:" , i+1 );
+    label_str = g_strdup_printf( _("Color %i:") , i+1 );
     label = gtk_label_new( label_str );
     g_free( label_str );
     colorbt = gtk_color_button_new();
@@ -733,11 +733,11 @@
     GtkWidget *frame, *vbox, *label, *checkbt;
     gtk_list_store_append( tri_event_store , &iter );
     gtk_list_store_set( tri_event_store , &iter ,
-      0 , aosd_trigger_get_name( trigger_code_array[i] ) ,
+      0 , _(aosd_trigger_get_name( trigger_code_array[i] )) ,
       1 , trigger_code_array[i] , 2 , i , -1 );
     vbox = gtk_vbox_new( FALSE , 0 );
     gtk_container_set_border_width( GTK_CONTAINER(vbox) , 6 );
-    label = gtk_label_new( aosd_trigger_get_desc( trigger_code_array[i] ) );
+    label = gtk_label_new( _(aosd_trigger_get_desc( trigger_code_array[i] )) );
     gtk_label_set_line_wrap( GTK_LABEL(label) , TRUE );
     gtk_misc_set_alignment( GTK_MISC(label) , 0.0 , 0.0 );
     checkbt = gtk_check_button_new_with_label( _("Enable trigger") );
@@ -869,7 +869,7 @@
   gtk_container_set_border_width( GTK_CONTAINER(mis_transp_status_hbox) , 3 );
   gtk_container_add( GTK_CONTAINER(mis_transp_status_frame) , mis_transp_status_hbox );
   gtk_box_pack_start( GTK_BOX(mis_transp_vbox) , mis_transp_status_frame , TRUE , TRUE , 0 );
-  
+
   mis_transp_status_img = gtk_image_new();
   gtk_misc_set_alignment( GTK_MISC(mis_transp_status_img) , 0.5 , 0 );
   mis_transp_status_label = gtk_label_new( "" );
@@ -879,11 +879,11 @@
   gtk_box_pack_start( GTK_BOX(mis_transp_status_hbox) , mis_transp_status_label , TRUE , TRUE , 0 );
   g_object_set_data( G_OBJECT(mis_transp_status_hbox) , "img" , mis_transp_status_img );
   g_object_set_data( G_OBJECT(mis_transp_status_hbox) , "label" , mis_transp_status_label );
-                     
+
 #ifdef HAVE_XCOMPOSITE
   g_signal_connect( G_OBJECT(mis_transp_real_rbt) , "toggled" ,
     G_CALLBACK(aosd_cb_configure_misc_transp_real_clicked) , mis_transp_status_hbox );
-  
+
   /* check if the composite extension is loaded */
   if ( aosd_osd_check_composite_ext() )
   {
@@ -928,7 +928,7 @@
   aosd_cfg_debug( cfg );
 #endif
   markup_message = g_markup_printf_escaped(
-    "<span font_desc='%s'>Audacious OSD</span>" , cfg->osd->text.fonts_name[0] );
+    _("<span font_desc='%s'>Audacious OSD</span>") , cfg->osd->text.fonts_name[0] );
   aosd_osd_shutdown(); /* stop any displayed osd */
   aosd_osd_cleanup(); /* just in case it's active */
   aosd_osd_init( cfg->osd->misc.transparency_mode );
@@ -1137,11 +1137,11 @@
   gtk_text_view_set_justification( GTK_TEXT_VIEW(info_tv) , GTK_JUSTIFY_LEFT );
   gtk_text_view_set_left_margin( GTK_TEXT_VIEW(info_tv) , 10 );
 
-  info_tb_content = g_strjoin( NULL , "\nAudacious OSD " , AOSD_VERSION_PLUGIN ,
+  info_tb_content = g_strjoin( NULL , _("\nAudacious OSD ") , AOSD_VERSION_PLUGIN ,
                                _("\nhttp://www.develia.org/projects.php?p=audacious#aosd\n"
-                                 "written by Giacomo Lozito\n") ,
-                               "< james@develia.org >\n\n" ,
-                               _("On-Screen-Display is based on Ghosd library\n"
+                                 "written by Giacomo Lozito\n"
+                                 "< james@develia.org >\n\n"
+                                 "On-Screen-Display is based on Ghosd library\n"
                                  "written by Evan Martin\n"
                                  "http://neugierig.org/software/ghosd/\n\n") , NULL );
   gtk_text_buffer_set_text( info_tb , info_tb_content , -1 );
--- a/src/cdaudio-ng/cdaudio-ng.c	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/cdaudio-ng/cdaudio-ng.c	Fri Jul 27 16:20:15 2007 -0500
@@ -1,8 +1,3 @@
-
-/*
-	todo: 
-		- about dialog
-*/
 
 #include <string.h>
 #include <stdlib.h>
@@ -24,9 +19,9 @@
 #include <audacious/i18n.h>
 #include <audacious/configdb.h>
 #include <audacious/plugin.h>
-//#include <audacious/playback.h>	// todo: this should be available soon (by 1.4)
 #include <audacious/util.h>
 #include <audacious/output.h>
+#include "config.h"
 
 #include "cdaudio-ng.h"
 #include "configure.h"
@@ -78,7 +73,7 @@
 	NULL,
 	"CD Audio Plugin NG",
 	cdaudio_init,
-	NULL /*cdaudio_about*/,	// todo: implement an about dialog
+	cdaudio_about,
 	cdaudio_configure,
 	cdaudio_is_our_file,
 	cdaudio_scan_dir,
@@ -116,9 +111,9 @@
 		cleanup_on_error();
 		return;
 	}
-	
+
 	libcddb_init();
-	
+
 	ConfigDb *db = bmp_cfg_db_open();
 	gchar *string = NULL;
 
@@ -158,6 +153,23 @@
 {
 	if (debug)
 		printf("cdaudio-ng: cdaudio_about()\n");
+
+	static GtkWidget* about_window = NULL;
+
+    if (about_window) {
+        gdk_window_raise(about_window->window);
+    }
+
+    char about_text[1000];
+	sprintf(about_text, _("Copyright (c) 2007, by Calin Crisan <ccrisan@gmail.com> and The Audacious Team.\n\n"
+						"Many thanks to libcdio developers <http://www.gnu.org/software/libcdio/>\n\tand to libcddb developers <http://libcddb.sourceforge.net/>.\n\n"
+						"Also thank you Tony Vroon for mentoring & guiding me.\n\n"
+ 						"This was a Google Summer of Code 2007 project."));
+
+    about_window = xmms_show_message(_("About CD Audio Plugin NG"), about_text, _("OK"), FALSE, NULL, NULL);
+
+    g_signal_connect(G_OBJECT(about_window), "destroy",
+                     G_CALLBACK(gtk_widget_destroyed), &about_window);
 }
 
 void cdaudio_configure()
@@ -190,9 +202,10 @@
 		if (cdio_get_media_changed(pcdio) && pcdio != NULL) {
 			if (debug)
 				printf("cdaudio-ng: cd changed, rescanning\n");
-			cdaudio_scan_dir(CDDA_DEFAULT);
+			if (cdaudio_scan_dir(CDDA_DEFAULT) == NULL)
+				pcdio = NULL;
 		}
-		
+
 		if (pcdio == NULL) {
 			if (debug)
 				printf("cdaudio-ng: \"%s\" is not our file\n", filename);
@@ -256,7 +269,8 @@
 			cleanup_on_error();
 			return NULL;
 		}
-		cdio_free_device_list(ppcd_drives);
+		if (ppcd_drives != NULL && *ppcd_drives != NULL)
+			cdio_free_device_list(ppcd_drives);
 	}
 
 		/* limit read speed */
@@ -340,7 +354,7 @@
 			else {
 				if (debug)
 					printf("cdaudio-ng: discid = %X, category = \"%s\"\n", cddb_disc_get_discid(pcddb_disc), cddb_disc_get_category_str(pcddb_disc));
-	
+
 				cddb_read(pcddb_conn, pcddb_disc);
 				if (cddb_errno(pcddb_conn) != CDDB_ERR_OK) {
 					fprintf(stderr, "cdaudio-ng: failed to read the cddb info: %s\n", cddb_error_str(cddb_errno(pcddb_conn)));
@@ -350,7 +364,7 @@
 				else {
 					if (debug)
 						printf("cdaudio-ng: we have got the cddb info\n");
-	
+
 					strcpy(trackinfo[0].performer, cddb_disc_get_artist(pcddb_disc));
 					strcpy(trackinfo[0].name, cddb_disc_get_title(pcddb_disc));
 					strcpy(trackinfo[0].genre, cddb_disc_get_genre(pcddb_disc));
@@ -378,7 +392,7 @@
 		/* add track "file" names to the list */
 	GList *list = NULL;
 	for (trackno = firsttrackno; trackno <= lasttrackno; trackno++) {
-		list = g_list_append(list, g_strdup_printf("track%02u.cda", trackno));	
+		list = g_list_append(list, g_strdup_printf("track%02u.cda", trackno));
 		cdtext_t *pcdtext = NULL;
 		if (use_cdtext) {
 			if (debug)
@@ -415,10 +429,10 @@
 	}
 
 	if (debug) {
-		printf("cdaudio-ng: disc has : performer = \"%s\", name = \"%s\", genre = \"%s\"\n", 
+		printf("cdaudio-ng: disc has : performer = \"%s\", name = \"%s\", genre = \"%s\"\n",
 			   trackinfo[0].performer, trackinfo[0].name, trackinfo[0].genre);
 		for (trackno = firsttrackno; trackno <= lasttrackno; trackno++) {
-			printf("cdaudio-ng: track %d has : performer = \"%s\", name = \"%s\", genre = \"%s\", startlsn = %d, endlsn = %d\n", 
+			printf("cdaudio-ng: track %d has : performer = \"%s\", name = \"%s\", genre = \"%s\", startlsn = %d, endlsn = %d\n",
 				trackno, trackinfo[trackno].performer, trackinfo[trackno].name, trackinfo[trackno].genre, trackinfo[trackno].startlsn, trackinfo[trackno].endlsn);
 		}
 	}
@@ -435,7 +449,7 @@
 {
 	if (debug)
 		printf("cdaudio-ng: cdaudio_play_file(\"%s\")\n", pinputplayback->filename);
-	
+
 	pglobalinputplayback = pinputplayback;
 
 	if (trackinfo == NULL) {
@@ -450,6 +464,13 @@
 		cdaudio_scan_dir(CDDA_DEFAULT);
 	}
 
+	if (trackinfo == NULL) {
+		if (debug)
+			printf("cdaudio-ng: no cd information can be retrieved, aborting\n");
+		pinputplayback->playing = FALSE;
+		return;
+	}
+
 	int trackno = find_trackno_from_filename(pinputplayback->filename);
 	if (trackno < firsttrackno || trackno > lasttrackno) {
 		fprintf(stderr, "cdaudio-ng: trackno %d is out of range [%d..%d]\n", trackno, firsttrackno, lasttrackno);
@@ -461,6 +482,11 @@
 	playing_track = trackno;
 	is_paused = FALSE;
 
+	char *title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(pinputplayback->filename));
+
+	inputplugin.set_info(title, calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn), 1411200, 44100, 2);
+	free(title);
+
 	if (use_dae) {
 		if (debug)
 			printf("cdaudio-ng: using digital audio extraction\n");
@@ -502,20 +528,15 @@
 			return;
 		}
 	}
-
-	char *title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(pinputplayback->filename));
-
-	inputplugin.set_info(title, calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn), 128000, 44100, 2);
-	free(title);
 }
 
 void cdaudio_stop(InputPlayback *pinputplayback)
 {
 	if (debug)
 		printf("cdaudio-ng: cdaudio_stop(\"%s\")\n", pinputplayback != NULL ? pinputplayback->filename : "N/A");
-	
+
 	pglobalinputplayback = NULL;
-	
+
 	if (playing_track == -1)
 		return;
 
@@ -582,7 +603,7 @@
 		msf_t startmsf, endmsf;
 		cdio_lsn_to_msf(newstartlsn, &startmsf);
 		cdio_lsn_to_msf(trackinfo[playing_track].endlsn, &endmsf);
-	
+
 		if (cdio_audio_play_msf(pcdio, &startmsf, &endmsf) != DRIVER_OP_SUCCESS) {
 			fprintf(stderr, "cdaudio-ng: failed to play analog cd\n");
 			cleanup_on_error();
@@ -642,7 +663,7 @@
 		}
 		*l = volume.level[0];
 		*r = volume.level[1];
-	
+
 		return TRUE;
 	}
 }
@@ -662,7 +683,7 @@
 			cleanup_on_error();
 			return FALSE;
 		}
-	
+
 		return TRUE;
 	}
 }
@@ -724,6 +745,9 @@
 
 TitleInput *create_tuple_from_trackinfo(char *filename)
 {
+	if (trackinfo == NULL)
+		return NULL;
+
 	TitleInput *tuple = bmp_title_input_new();
 	int trackno = find_trackno_from_filename(filename);
 
@@ -755,6 +779,8 @@
 	gboolean output_paused = FALSE;
 	int read_error_counter = 0;
 
+	//pdae_params->endlsn += 75 * 3;
+
 	while (pdae_params->pplayback->playing) {
 			/* handle pause status */
 		if (is_paused) {
@@ -790,13 +816,16 @@
 			/* compute the actual number of sectors to read */
 		int lsncount = CDDA_DAE_FRAMES <= (pdae_params->endlsn - pdae_params->currlsn + 1) ? CDDA_DAE_FRAMES : (pdae_params->endlsn - pdae_params->currlsn + 1);
 			/* check too see if we have reached the end of the song */
-		if (lsncount <= 0)
+		if (lsncount <= 0) {
+			sleep(3);
 			break;
+		}
 
 		if (cdio_read_audio_sectors(pcdio, buffer, pdae_params->currlsn, lsncount) != DRIVER_OP_SUCCESS) {
 			fprintf(stderr, "cdaudio-ng: failed to read audio sector\n");
 			read_error_counter++;
 			if (read_error_counter >= 2) {
+				read_error_counter = 0;
 				fprintf(stderr, "cdaudio-ng: this cd can no longer be played, stopping\n");
 				break;
 			}
@@ -851,7 +880,6 @@
 {
 	if (playing_track != -1) {
 		playing_track = -1;
-		playback_stop();
 	}
 
 	if (trackinfo != NULL) {
--- a/src/cdaudio-ng/configure.c	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/cdaudio-ng/configure.c	Fri Jul 27 16:20:15 2007 -0500
@@ -3,6 +3,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <gtk/gtk.h>
+#include <audacious/i18n.h>
+#include "config.h"
 
 #include "configure.h"
 
@@ -62,7 +64,7 @@
 void configure_create_gui()
 {
 	configwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-	gtk_window_set_title(GTK_WINDOW(configwindow), "CD Audio Plugin Configuration");
+	gtk_window_set_title(GTK_WINDOW(configwindow), _("CD Audio Plugin Configuration"));
 	gtk_window_set_resizable(GTK_WINDOW(configwindow), FALSE);
 	gtk_window_set_position(GTK_WINDOW(configwindow), GTK_WIN_POS_CENTER_ALWAYS);
 	gtk_container_set_border_width(GTK_CONTAINER(configwindow), 10);
@@ -72,64 +74,64 @@
 	gtk_table_set_homogeneous(GTK_TABLE(maintable), FALSE);
 	gtk_container_add(GTK_CONTAINER(configwindow), maintable);
 
-	daeframe = gtk_frame_new("Digital audio extraction");
+	daeframe = gtk_frame_new(_("Digital audio extraction"));
 	gtk_table_attach_defaults(GTK_TABLE(maintable), daeframe, 0, 2, 0, 1);
 	daetable = gtk_table_new(1, 2, TRUE);
 	gtk_container_add(GTK_CONTAINER(daeframe), daetable);
 
-	titleinfoframe = gtk_frame_new("Title information");
+	titleinfoframe = gtk_frame_new(_("Title information"));
 	gtk_table_attach_defaults(GTK_TABLE(maintable), titleinfoframe, 0, 2, 1, 2);
 	titleinfotable = gtk_table_new(2, 2, TRUE);
 	gtk_container_add(GTK_CONTAINER(titleinfoframe), titleinfotable);
 
-	miscframe = gtk_frame_new("Misc");
+	miscframe = gtk_frame_new(_("Misc"));
 	gtk_table_attach_defaults(GTK_TABLE(maintable), miscframe, 0, 2, 2, 3);
 	misctable = gtk_table_new(2, 2, TRUE);
 	gtk_container_add(GTK_CONTAINER(miscframe), misctable);
 
 
 	/*
-	usedaecheckbutton = gtk_check_button_new_with_label("Use digital audio extraction");
+	usedaecheckbutton = gtk_check_button_new_with_label(_("Use digital audio extraction"));
 	g_signal_connect(G_OBJECT(usedaecheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
 	gtk_table_attach_defaults(GTK_TABLE(daetable), usedaecheckbutton, 0, 2, 0, 1);
 	*/
 
-	limitcheckbutton = gtk_check_button_new_with_label("Limit read speed to: ");
+	limitcheckbutton = gtk_check_button_new_with_label(_("Limit read speed to: "));
 	g_signal_connect(G_OBJECT(limitcheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
 	gtk_table_attach_defaults(GTK_TABLE(daetable), limitcheckbutton, 0, 1, 0, 1);
 
 	limitspinbutton = gtk_spin_button_new_with_range(1.0, 24.0, 1.0);
 	gtk_table_attach_defaults(GTK_TABLE(daetable), limitspinbutton, 1, 2, 0, 1);
 
-	usecdtextcheckbutton = gtk_check_button_new_with_label("Use cd-text if available");
+	usecdtextcheckbutton = gtk_check_button_new_with_label(_("Use cd-text if available"));
 	g_signal_connect(G_OBJECT(usecdtextcheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
 	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), usecdtextcheckbutton, 0, 2, 0, 1);
 
-	usecddbcheckbutton = gtk_check_button_new_with_label("Use CDDB if available");
+	usecddbcheckbutton = gtk_check_button_new_with_label(_("Use CDDB if available"));
 	g_signal_connect(G_OBJECT(usecddbcheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
 	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), usecddbcheckbutton, 0, 2, 1, 2);
-	
-	cddbserverlabel = gtk_label_new("Server: ");
+
+	cddbserverlabel = gtk_label_new(_("Server: "));
 	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbserverlabel, 0, 1, 2, 3);
-	
-	cddbportlabel = gtk_label_new("Port: ");
+
+	cddbportlabel = gtk_label_new(_("Port: "));
 	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbportlabel, 0, 1, 3, 4);
-	
+
 	cddbserverentry = gtk_entry_new();
 	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbserverentry, 1, 2, 2, 3);
-	
+
 	cddbportentry = gtk_entry_new();
 	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbportentry, 1, 2, 3, 4);
 
 
-	usedevicecheckbutton = gtk_check_button_new_with_label("Override default device: ");
+	usedevicecheckbutton = gtk_check_button_new_with_label(_("Override default device: "));
 	g_signal_connect(G_OBJECT(usedevicecheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
 	gtk_table_attach_defaults(GTK_TABLE(misctable), usedevicecheckbutton, 0, 1, 0, 1);
 
 	deviceentry = gtk_entry_new();
 	gtk_table_attach_defaults(GTK_TABLE(misctable), deviceentry, 1, 2, 0, 1);
 
-	debugcheckbutton = gtk_check_button_new_with_label("Print debug information");
+	debugcheckbutton = gtk_check_button_new_with_label(_("Print debug information"));
 	g_signal_connect(G_OBJECT(debugcheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
 	gtk_table_attach_defaults(GTK_TABLE(misctable), debugcheckbutton, 0, 1, 1, 2);
 
@@ -139,11 +141,11 @@
 	gtk_hbutton_box_set_spacing_default(10);
 	gtk_table_attach_defaults(GTK_TABLE(maintable), buttonbox, 0, 2, 3, 4);
 
-	okbutton = gtk_button_new_with_label("Ok");
+	okbutton = gtk_button_new_with_label(_("Ok"));
 	g_signal_connect(G_OBJECT(okbutton), "clicked", G_CALLBACK(button_clicked), NULL);
 	gtk_container_add(GTK_CONTAINER(buttonbox), okbutton);
 
-	cancelbutton = gtk_button_new_with_label("Cancel");
+	cancelbutton = gtk_button_new_with_label(_("Cancel"));
 	g_signal_connect(G_OBJECT(cancelbutton), "clicked", G_CALLBACK(button_clicked), NULL);
 	gtk_container_add(GTK_CONTAINER(buttonbox), cancelbutton);
 
@@ -200,8 +202,8 @@
 	/*gtk_widget_set_sensitive(limitcheckbutton, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usedaecheckbutton)));*/
 
 	gtk_widget_set_sensitive(
-		limitspinbutton, 
-		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(limitcheckbutton)) && 
+		limitspinbutton,
+		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(limitcheckbutton)) &&
 		GTK_WIDGET_IS_SENSITIVE(limitcheckbutton));
 
 	gtk_widget_set_sensitive(cddbserverentry, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton)));
--- a/src/cdaudio/Makefile	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-include ../../mk/rules.mk
-include ../../mk/init.mk
-
-OBJECTIVE_LIBS = libcdaudio$(SHARED_SUFFIX)
-
-LIBADD = $(GTK_LIBS) $(GLIB_LIBS) $(PANGO_LIBS)
-LIBDIR = $(plugindir)/$(INPUT_PLUGIN_DIR)
-
-SOURCES = cdaudio.c cddb.c cdinfo.c configure.c http.c 
-
-OBJECTS = ${SOURCES:.c=.o}
-
-CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) -I../../intl -I../.. -I../..
-
-include ../../mk/objective.mk
--- a/src/cdaudio/cdaudio.c	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1342 +0,0 @@
-/*  XMMS - Cross-platform multimedia player
- *  Copyright (C) 1998-2003  Peter Alm, Mikael Alm, Olle Hallnas,
- *                           Thomas Nilsson and 4Front Technologies
- *  Copyright (C) 1999-2003  Haavard Kvaalen <havardk@xmms.org>
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
-#include "cdaudio.h"
-
-#include <glib.h>
-#include <audacious/i18n.h>
-#include <glib/gprintf.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-
-#include <audacious/configdb.h>
-#include <audacious/util.h>
-#include <audacious/titlestring.h>
-#include "audacious/output.h"
-
-#ifdef CDROMSTOP
-# define XMMS_STOP CDROMSTOP
-#elif defined CDIOCSTOP
-# define XMMS_STOP CDIOCSTOP
-#else
-# error "No stop ioctl"
-#endif
-
-#ifdef CDIOCPAUSE
-# define XMMS_PAUSE CDIOCPAUSE
-#elif defined CDROMPAUSE
-# define XMMS_PAUSE CDROMPAUSE
-#else
-# error "No pause ioctl"
-#endif
-
-#ifdef CDIOCRESUME
-# define XMMS_RESUME CDIOCRESUME
-#elif defined CDROMRESUME
-# define XMMS_RESUME CDROMRESUME
-#else
-# error "No resume ioctl"
-#endif
-
-/*
- * Distributions should not patch this, but instead use the
- * --with-cdda-device=path and --with-cdda-dir=path configure options.
- */
-
-#ifndef CDDA_DEVICE
-# ifdef HAVE_SYS_CDIO_H
-#  if defined(__FreeBSD__) && !defined(CDIOCREADAUDIO)
-#   define CDDA_DEVICE "/dev/acd0c"
-#  elif defined __FreeBSD__
-#   define CDDA_DEVICE "/dev/acd0"
-#  elif defined __OpenBSD__ || defined __NetBSD__
-#   define CDDA_DEVICE "/dev/cd0c"
-#  else
-#   define CDDA_DEVICE "/vol/dev/aliases/cdrom0"
-#  endif
-# else
-#   define CDDA_DEVICE "/dev/cdrom"
-# endif
-#endif
-
-#ifndef CDDA_DIRECTORY
-# ifdef HAVE_SYS_CDIO_H
-#  ifdef __FreeBSD__
-#   define CDDA_DIRECTORY "/cdrom"
-#  elif defined __OpenBSD__ || defined __NetBSD__
-#   define CDDA_DIRECTORY "/cdrom"
-#  else
-#   define CDDA_DIRECTORY "/cdrom/cdrom0"
-#  endif
-# else
-#   define CDDA_DIRECTORY "/mnt/cdrom"
-# endif
-#endif
-
-
-
-
-static TitleInput *cdda_get_tuple(cdda_disc_toc_t * toc, int track);
-static gchar *get_song_title(TitleInput *tuple);
-static gboolean stop_timeout(gpointer data);
-
-static void cdda_init(void);
-static int is_our_file(char *filename);
-static GList *scan_dir(char *dir);
-static void play_file(InputPlayback *playback);
-static void stop(InputPlayback *playback);
-static void cdda_pause(InputPlayback *playback, short p);
-static void seek(InputPlayback *playback, int time);
-static int get_time(InputPlayback *playback);
-static void get_song_info(char *filename, char **title, int *length);
-static TitleInput *get_song_tuple(char *filename);
-static gint get_volume(int *l, int *r);
-static gint set_volume(int l, int r);
-static void cleanup(void);
-void cdda_fileinfo(char *filename);
-
-InputPlugin cdda_ip = {
-    NULL,
-    NULL,
-    "CD Audio Plugin",                       /* Description */
-    cdda_init,
-    NULL,                       /* about */
-    cdda_configure,
-    is_our_file,
-    scan_dir,
-    play_file,
-    stop,
-    cdda_pause,
-    seek,
-    NULL,                       /* set_eq */
-    get_time,
-    get_volume,
-    set_volume,
-    cleanup,
-    NULL,                       /* obsolete */
-    NULL,                       /* add_vis_pcm */
-    NULL,                       /* set_info, filled in by xmms */
-    NULL,                       /* set_info_text, filled in by xmms */
-    get_song_info,
-    NULL,                       /*  cdda_fileinfo, *//* file_info_box */
-    NULL,                        /* output plugin handle */
-    get_song_tuple
-};
-
-InputPlugin *cdda_iplist[] = { &cdda_ip, NULL };
-
-DECLARE_PLUGIN(cdda, NULL, NULL, cdda_iplist, NULL, NULL, NULL, NULL);
-
-CDDAConfig cdda_cfg;
-
-static struct {
-    struct driveinfo drive;
-    cdda_disc_toc_t cd_toc;
-    int track;
-    int fd;
-    gboolean playing;
-} cdda_playing;
-
-static struct {
-    GThread *thread;
-    gboolean audio_error, eof;
-    int seek;
-
-} dae_data;
-
-static gboolean is_paused;
-static int pause_time;
-
-struct timeout {
-    int id;
-    char *device;
-};
-
-static GList *timeout_list;
-
-/* Time to delay stop command in 1/10 second */
-#define STOP_DELAY 20
-
-#ifdef BEEP_CDROM_SOLARIS
-/*
- * Lowlevel cdrom access, Solaris style (Solaris, Linux)
- */
-
-static void
-play_ioctl(struct cdda_msf *start, struct cdda_msf *end)
-{
-    struct cdrom_msf msf;
-
-    msf.cdmsf_min0 = start->minute;
-    msf.cdmsf_sec0 = start->second;
-    msf.cdmsf_frame0 = start->frame;
-    msf.cdmsf_min1 = end->minute;
-    msf.cdmsf_sec1 = end->second;
-    msf.cdmsf_frame1 = end->frame;
-    ioctl(cdda_playing.fd, CDROMPLAYMSF, &msf);
-}
-
-static int
-get_current_frame(void)
-{
-    struct cdrom_subchnl subchnl;
-
-    subchnl.cdsc_format = CDROM_MSF;
-    if (ioctl(cdda_playing.fd, CDROMSUBCHNL, &subchnl) < 0)
-        return -1;
-
-    switch (subchnl.cdsc_audiostatus) {
-    case CDROM_AUDIO_COMPLETED:
-    case CDROM_AUDIO_ERROR:
-        return -1;
-    }
-
-    return (LBA(subchnl.cdsc_absaddr.msf));
-}
-
-#if !defined(CDROMVOLREAD)
-static int volume_left = 100, volume_right = 100;
-#endif
-
-static void
-drive_get_volume(int *l, int *r)
-{
-#if defined(CDROMVOLREAD)
-    struct cdrom_volctrl vol;
-
-    if (cdda_playing.fd != -1 && !ioctl(cdda_playing.fd, CDROMVOLREAD, &vol)) {
-        *l = (100 * vol.channel0) / 255;
-        *r = (100 * vol.channel1) / 255;
-    }
-#if 0
-    else if (cdda_playing.fd != -1)
-        g_message("CDROMVOLREAD failed");
-#endif
-#else
-    *l = volume_left;
-    *r = volume_right;
-#endif
-}
-
-static void
-drive_set_volume(int l, int r)
-{
-    struct cdrom_volctrl vol;
-
-    if (cdda_playing.fd != -1) {
-        vol.channel0 = vol.channel2 = (l * 255) / 100;
-        vol.channel1 = vol.channel3 = (r * 255) / 100;
-        ioctl(cdda_playing.fd, CDROMVOLCTRL, &vol);
-    }
-#if !defined(CDROMVOLREAD)
-    volume_left = l;
-    volume_right = r;
-#endif
-}
-
-#ifdef CDROMREADAUDIO
-int
-read_audio_data(int fd, int pos, int num, void *buf)
-{
-    struct cdrom_read_audio cdra;
-
-#if 1
-    cdra.addr.lba = pos - CDDA_MSF_OFFSET;
-    cdra.addr_format = CDROM_LBA;
-#else
-    cdra.addr.msf.minute = pos / (60 * 75);
-    cdra.addr.msf.second = (pos / 75) % 60;
-    cdra.addr.msf.frame = pos % 75;
-    cdra.addr_format = CDROM_MSF;
-#endif
-
-    cdra.nframes = num;
-    cdra.buf = buf;
-
-    if (ioctl(fd, CDROMREADAUDIO, &cdra) < 0)
-        return -errno;
-
-    return cdra.nframes;
-}
-#endif                          /* CDROMREADAUDIO */
-
-#if defined(CDROMCDDA)
-int
-read_audio_data(int fd, int pos, int num, void *buf)
-{
-    struct cdrom_cdda cdra;
-
-    cdra.cdda_addr = pos - CDDA_MSF_OFFSET;
-    cdra.cdda_length = num;
-    cdra.cdda_data = buf;
-    cdra.cdda_subcode = CDROM_DA_NO_SUBCODE;
-    if (ioctl(fd, CDROMCDDA, &cdra) < 0)
-        return -errno;
-
-    return cdra.cdda_length;
-}
-#endif
-
-static gboolean
-cdda_get_toc_lowlevel(int fd, cdda_disc_toc_t * info)
-{
-    struct cdrom_tochdr tochdr;
-    struct cdrom_tocentry tocentry;
-    int i;
-
-
-
-    if (ioctl(fd, CDROMREADTOCHDR, &tochdr))
-        return FALSE;
-
-    for (i = tochdr.cdth_trk0; i <= tochdr.cdth_trk1; i++) {
-        tocentry.cdte_format = CDROM_MSF;
-        tocentry.cdte_track = i;
-        if (ioctl(fd, CDROMREADTOCENTRY, &tocentry))
-            return FALSE;
-        info->track[i].minute = tocentry.cdte_addr.msf.minute;
-        info->track[i].second = tocentry.cdte_addr.msf.second;
-        info->track[i].frame = tocentry.cdte_addr.msf.frame;
-        info->track[i].flags.data_track =
-            tocentry.cdte_ctrl == CDROM_DATA_TRACK;
-
-    }
-
-    /* Get the leadout track */
-    tocentry.cdte_track = CDROM_LEADOUT;
-    tocentry.cdte_format = CDROM_MSF;
-
-    if (ioctl(fd, CDROMREADTOCENTRY, &tocentry))
-        return FALSE;
-    info->leadout.minute = tocentry.cdte_addr.msf.minute;
-    info->leadout.second = tocentry.cdte_addr.msf.second;
-    info->leadout.frame = tocentry.cdte_addr.msf.frame;
-
-    info->first_track = tochdr.cdth_trk0;
-    info->last_track = tochdr.cdth_trk1;
-
-    return TRUE;
-}
-
-#endif
-
-#ifdef BEEP_CDROM_BSD
-/*
- * Lowlevel cdrom access, BSD style (FreeBSD, OpenBSD, NetBSD, Darwin)
- */
-
-static void
-play_ioctl(struct cdda_msf *start, struct cdda_msf *end)
-{
-    struct ioc_play_msf msf;
-
-    msf.start_m = start->minute;
-    msf.start_s = start->second;
-    msf.start_f = start->frame;
-    msf.end_m = end->minute;
-    msf.end_s = end->second;
-    msf.end_f = end->frame;
-    ioctl(cdda_playing.fd, CDIOCPLAYMSF, &msf);
-}
-
-static int
-get_current_frame(void)
-{
-    struct ioc_read_subchannel subchnl;
-    struct cd_sub_channel_info subinfo;
-    subchnl.address_format = CD_MSF_FORMAT;
-    subchnl.data_format = CD_CURRENT_POSITION;
-    subchnl.track = 0;
-    subchnl.data_len = sizeof(subinfo);
-    subchnl.data = &subinfo;
-    if (ioctl(cdda_playing.fd, CDIOCREADSUBCHANNEL, &subchnl) < 0)
-        return -1;
-
-#ifdef BEEP_CDROM_BSD_DARWIN
-    return ((subchnl.data->what.position.absaddr[1] * 60
-             subchnl.data->what.position.absaddr[2]) * 75 +
-            subchnl.data->what.position.absaddr[3]);
-#else
-    return (LBA(subchnl.data->what.position.absaddr.msf));
-#endif
-}
-
-static void
-drive_get_volume(int *l, int *r)
-{
-    struct ioc_vol vol;
-
-    if (cdda_playing.fd != -1) {
-        ioctl(cdda_playing.fd, CDIOCGETVOL, &vol);
-        *l = (100 * vol.vol[0]) / 255;
-        *r = (100 * vol.vol[1]) / 255;
-    }
-}
-
-static void
-drive_set_volume(int l, int r)
-{
-    struct ioc_vol vol;
-
-    if (cdda_playing.fd != -1) {
-        vol.vol[0] = vol.vol[2] = (l * 255) / 100;
-        vol.vol[1] = vol.vol[3] = (r * 255) / 100;
-        ioctl(cdda_playing.fd, CDIOCSETVOL, &vol);
-    }
-}
-
-#if defined(__FreeBSD__) && !defined(CDIOCREADAUDIO)
-int
-read_audio_data(int fd, int pos, int num, void *buf)
-{
-    int bs = CD_FRAMESIZE_RAW;
-
-    if (ioctl(fd, CDRIOCSETBLOCKSIZE, &bs) == -1)
-	return -1;
-    if (pread(fd, buf, num * bs, (pos - 150) * bs) != num * bs)
-	return -1;
-
-    return num;
-}
-#endif
-
-#if defined(CDIOCREADAUDIO)
-int
-read_audio_data(int fd, int pos, int num, void *buf)
-{
-    struct ioc_read_audio cdra;
-
-    cdra.address.lba = pos - CDDA_MSF_OFFSET;
-    cdra.address_format = CD_LBA_FORMAT;
-    cdra.nframes = num;
-    cdra.buffer = buf;
-
-    if (ioctl(fd, CDIOCREADAUDIO, &cdra) < 0)
-        return -errno;
-
-    return cdra.nframes;
-}
-#endif                          /* CDIOCREADAUDIO */
-
-#ifdef BEEP_CDROM_BSD_NETBSD    /* NetBSD, OpenBSD */
-
-static gboolean
-cdda_get_toc_lowlevel(int fd, cdda_disc_toc_t * info)
-{
-    struct ioc_toc_header tochdr;
-    struct ioc_read_toc_entry tocentry;
-    struct cd_toc_entry tocentrydata;
-    int i;
-
-    if (ioctl(fd, CDIOREADTOCHEADER, &tochdr))
-        return FALSE;
-
-    for (i = tochdr.starting_track; i <= tochdr.ending_track; i++) {
-        tocentry.address_format = CD_MSF_FORMAT;
-
-        tocentry.starting_track = i;
-        tocentry.data = &tocentrydata;
-        tocentry.data_len = sizeof(tocentrydata);
-        if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry))
-            return FALSE;
-        info->track[i].minute = tocentry.data->addr.msf.minute;
-        info->track[i].second = tocentry.data->addr.msf.second;
-        info->track[i].frame = tocentry.data->addr.msf.frame;
-        info->track[i].flags.data_track = (tocentry.data->control & 4) == 4;
-    }
-
-    /* Get the leadout track */
-    tocentry.address_format = CD_MSF_FORMAT;
-
-    tocentry.starting_track = 0xAA;
-    tocentry.data = &tocentrydata;
-    tocentry.data_len = sizeof(tocentrydata);
-    if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry))
-        return FALSE;
-    info->leadout.minute = tocentry.data->addr.msf.minute;
-    info->leadout.second = tocentry.data->addr.msf.second;
-    info->leadout.frame = tocentry.data->addr.msf.frame;
-
-    info->first_track = tochdr.starting_track;
-    info->last_track = tochdr.ending_track;
-
-    return TRUE;
-}
-
-#elif defined(BEEP_CDROM_BSD_DARWIN)
-
-static gboolean
-cdda_get_toc_lowlevel(int fd, cdda_disc_toc_t * info)
-{
-    struct ioc_toc_header tochdr;
-    struct ioc_read_toc_entry tocentry;
-    int i;
-
-    if (ioctl(fd, CDIOREADTOCHEADER, &tochdr))
-        return FALSE;
-
-    for (i = tochdr.starting_track; i <= tochdr.ending_track; i++) {
-        tocentry.address_format = CD_MSF_FORMAT;
-
-        tocentry.starting_track = i;
-        if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry))
-            return FALSE;
-        info->track[i].minute = tocentry.data->addr[1];
-        info->track[i].second = tocentry.data->addr[2];
-        info->track[i].frame = tocentry.data->addr[3];
-        info->track[i].flags.data_track = (tocentry.data->control & 4) == 4;
-    }
-
-    /* Get the leadout track */
-    tocentry.address_format = CD_MSF_FORMAT;
-
-    tocentry.starting_track = 0xAA;
-    if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry))
-        return FALSE;
-    info->leadout.minute = tocentry.data->addr[1];
-    info->leadout.second = tocentry.data->addr[2];
-    info->leadout.frame = tocentry.data->addr[3];
-
-    return TRUE;
-}
-
-#else                           /* FreeBSD */
-
-static gboolean
-cdda_get_toc_lowlevel(int fd, cdda_disc_toc_t * info)
-{
-    struct ioc_toc_header tochdr;
-    struct ioc_read_toc_single_entry tocentry;
-    int i;
-
-    if (ioctl(fd, CDIOREADTOCHEADER, &tochdr))
-        return FALSE;
-
-    for (i = tochdr.starting_track; i <= tochdr.ending_track; i++) {
-        tocentry.address_format = CD_MSF_FORMAT;
-
-        tocentry.track = i;
-        if (ioctl(fd, CDIOREADTOCENTRY, &tocentry))
-            return FALSE;
-        info->track[i].minute = tocentry.entry.addr.msf.minute;
-        info->track[i].second = tocentry.entry.addr.msf.second;
-        info->track[i].frame = tocentry.entry.addr.msf.frame;
-        info->track[i].flags.data_track = (tocentry.entry.control & 4) == 4;
-    }
-
-    /* Get the leadout track */
-    tocentry.address_format = CD_MSF_FORMAT;
-
-    tocentry.track = 0xAA;
-    if (ioctl(fd, CDIOREADTOCENTRY, &tocentry))
-        return FALSE;
-    info->leadout.minute = tocentry.entry.addr.msf.minute;
-    info->leadout.second = tocentry.entry.addr.msf.second;
-    info->leadout.frame = tocentry.entry.addr.msf.frame;
-
-    info->first_track = tochdr.starting_track;
-    info->last_track = tochdr.ending_track;
-
-    return TRUE;
-}
-#endif
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
-extern gboolean
-is_mounted(const char *device_name)
-{
-#if defined(HAVE_MNTENT_H) || defined(HAVE_GETMNTINFO)
-    char devname[256];
-    struct stat st;
-#if defined(HAVE_MNTENT_H)
-    FILE *mounts;
-    struct mntent *mnt;
-#elif defined(HAVE_GETMNTINFO)
-#if defined __NetBSD__ && HAVE_STATVFS
-    struct statvfs *fsp;
-#else
-    struct statfs *fsp;
-#endif
-    int entries;
-#endif
-
-    if (lstat(device_name, &st) < 0)
-        return -1;
-
-    if (S_ISLNK(st.st_mode))
-        readlink(device_name, devname, 256);
-    else
-        strncpy(devname, device_name, 256);
-
-#if defined(HAVE_MNTENT_H)
-    if ((mounts = setmntent(MOUNTED, "r")) == NULL)
-        return TRUE;
-
-    while ((mnt = getmntent(mounts)) != NULL) {
-        if (strcmp(mnt->mnt_fsname, devname) == 0) {
-            endmntent(mounts);
-            return TRUE;
-        }
-    }
-    endmntent(mounts);
-#elif defined(HAVE_GETMNTINFO)
-    entries = getmntinfo(&fsp, MNT_NOWAIT);
-    if (entries < 0)
-        return FALSE;
-
-    while (entries-- > 0) {
-        if (!strcmp(fsp->f_mntfromname, devname))
-            return TRUE;
-        fsp++;
-    }
-#endif
-#endif
-    return FALSE;
-}
-
-
-gboolean
-cdda_get_toc(cdda_disc_toc_t * info, const char *device)
-{
-    gboolean retv = FALSE;
-    int fd;
-
-    if (is_mounted(device))
-        return FALSE;
-
-    if ((fd = open(device, CDOPENFLAGS)) == -1)
-        return FALSE;
-
-    memset(info, 0, sizeof(cdda_disc_toc_t));
-
-    retv = cdda_get_toc_lowlevel(fd, info);
-    close(fd);
-
-    return retv;
-}
-
-static void
-cdda_init(void)
-{
-    ConfigDb *db;
-    struct driveinfo *drive = g_malloc0(sizeof(struct driveinfo));
-    int ndrives = 1, i;
-
-    cdda_playing.fd = -1;
-    memset(&cdda_cfg, 0, sizeof(CDDAConfig));
-
-#ifdef HAVE_OSS
-    drive->mixer = CDDA_MIXER_OSS;
-    drive->oss_mixer = SOUND_MIXER_CD;
-#endif
-
-    db = bmp_cfg_db_open();
-
-    /* These names are used for backwards compatibility */
-    bmp_cfg_db_get_string(db, "CDDA", "device", &drive->device);
-    bmp_cfg_db_get_string(db, "CDDA", "directory", &drive->directory);
-    bmp_cfg_db_get_int(db, "CDDA", "mixer", &drive->mixer);
-    if (bmp_cfg_db_get_int(db, "CDDA", "readmode", &drive->dae)==FALSE)
-        drive->dae = 1; /* default to digital */
-
-    if (!drive->device)
-        drive->device = g_strdup(CDDA_DEVICE);
-    if (!drive->directory)
-        drive->directory = g_strdup(CDDA_DIRECTORY);
-
-    cdda_cfg.drives = g_list_append(cdda_cfg.drives, drive);
-
-    bmp_cfg_db_get_int(db, "CDDA", "num_drives", &ndrives);
-    for (i = 1; i < ndrives; i++) {
-        char label[20];
-        drive = g_malloc0(sizeof(struct driveinfo));
-
-        sprintf(label, "device%d", i);
-        bmp_cfg_db_get_string(db, "CDDA", label, &drive->device);
-
-        sprintf(label, "directory%d", i);
-        bmp_cfg_db_get_string(db, "CDDA", label, &drive->directory);
-
-        sprintf(label, "mixer%d", i);
-        bmp_cfg_db_get_int(db, "CDDA", label, &drive->mixer);
-
-        sprintf(label, "readmode%d", i);
-        bmp_cfg_db_get_int(db, "CDDA", label, &drive->dae);
-
-        cdda_cfg.drives = g_list_append(cdda_cfg.drives, drive);
-    }
-    bmp_cfg_db_get_bool(db, "CDDA", "title_override",
-                        &cdda_cfg.title_override);
-    bmp_cfg_db_get_string(db, "CDDA", "name_format", &cdda_cfg.name_format);
-    bmp_cfg_db_get_bool(db, "CDDA", "use_cddb", &cdda_cfg.use_cddb);
-    bmp_cfg_db_get_string(db, "CDDA", "cddb_server", &cdda_cfg.cddb_server);
-    bmp_cfg_db_close(db);
-
-    if (!cdda_cfg.cddb_server)
-        cdda_cfg.cddb_server = g_strdup(CDDB_DEFAULT_SERVER);
-    if (!cdda_cfg.name_format)
-        cdda_cfg.name_format = g_strdup("%p - %t");
-}
-
-struct driveinfo *
-cdda_find_drive(char *filename)
-{
-    GList *node;
-
-    // FIXME: Will always return the first drive
-
-    for (node = cdda_cfg.drives; node; node = node->next) {
-        struct driveinfo *d = node->data;
-        if (!strncmp(d->directory, filename, strlen(d->directory)))
-            return d;
-    }
-
-    return NULL;
-
-}
-
-static void
-timeout_destroy(struct timeout *entry)
-{
-    g_free(entry->device);
-    g_free(entry);
-    timeout_list = g_list_remove(timeout_list, entry);
-}
-
-static void
-timeout_remove_for_device(char *device)
-{
-    GList *node;
-
-    for (node = timeout_list; node; node = node->next) {
-        struct timeout *t = node->data;
-
-        if (!strcmp(t->device, device)) {
-            gtk_timeout_remove(t->id);
-            timeout_destroy(t);
-            return;
-        }
-    }
-
-}
-
-static void
-cleanup(void)
-{
-    GList *node;
-    struct driveinfo *drive;
-
-    if (cdda_cfg.drives) {
-        for (node = g_list_first(cdda_cfg.drives); node; node = node->next) {
-            drive = (struct driveinfo *)node->data;
-            if (!drive)
-                continue;
-
-            if (drive->device)
-                free(drive->device);
-
-            if (drive->directory)
-                free(drive->directory);
-
-            free(drive);
-        }
-
-        g_list_free(cdda_cfg.drives);
-        cdda_cfg.drives = NULL;
-    }
-
-    if (cdda_cfg.name_format) {
-        free(cdda_cfg.name_format);
-        cdda_cfg.name_format = NULL;
-    }
-
-    if (cdda_cfg.cddb_server) {
-        free(cdda_cfg.cddb_server);
-        cdda_cfg.cddb_server = NULL;
-    }
-
-    while (timeout_list) {
-        struct timeout *t = timeout_list->data;
-        gtk_timeout_remove(t->id);
-        stop_timeout(t);
-        timeout_destroy(t);
-    }
-    cddb_quit();
-}
-
-static int
-is_our_file(char *filename)
-{
-    char *ext = ".cda";
-
-    if (cdda_find_drive(filename) == NULL) {
-        return FALSE;
-    }
-
-    if (g_str_has_suffix(filename, ext)) {
-        return TRUE;
-    }
-    return FALSE;
-}
-
-
-static GList *
-scan_dir(char *dir)
-{
-    GList *list = NULL;
-    int i;
-    cdda_disc_toc_t toc;
-    struct driveinfo *drive;
-
-    if ((drive = cdda_find_drive(dir)) == NULL)
-        return NULL;
-
-    if (!cdda_get_toc(&toc, drive->device))
-        return NULL;
-
-    for (i = toc.last_track; i >= toc.first_track; i--)
-        if (!toc.track[i].flags.data_track) {
-            list = g_list_prepend(list, g_strdup_printf("Track %02d.cda", i));
-        }
-    return list;
-}
-
-guint
-cdda_calculate_track_length(cdda_disc_toc_t * toc, int track)
-{
-    if (track == toc->last_track)
-        return (LBA(toc->leadout) - LBA(toc->track[track]));
-    else
-        return (LBA(toc->track[track + 1]) - LBA(toc->track[track]));
-}
-
-static void *
-dae_play_loop(void *data)
-{
-    InputPlayback *playback = data;
-    char *buffer = g_malloc(CD_FRAMESIZE_RAW * CDDA_DAE_FRAMES);
-    int pos = LBA(cdda_playing.cd_toc.track[cdda_playing.track]);
-    int end, frames;
-
-    if (cdda_playing.track == cdda_playing.cd_toc.last_track)
-        end = LBA(cdda_playing.cd_toc.leadout);
-    else
-        end = LBA(cdda_playing.cd_toc.track[cdda_playing.track + 1]);
-
-    while (cdda_playing.playing) {
-        int left;
-        char *data;
-
-        if (dae_data.seek != -1) {
-	    playback->output->flush(dae_data.seek * 1000);
-            pos = LBA(cdda_playing.cd_toc.track[cdda_playing.track])
-                + dae_data.seek * 75;
-            dae_data.seek = -1;
-            dae_data.eof = FALSE;
-        }
-        frames = MIN(CDDA_DAE_FRAMES, end - pos);
-        if (frames == 0)
-            dae_data.eof = TRUE;
-
-        if (dae_data.eof) {
-            xmms_usleep(30000);
-            continue;
-        }
-
-        frames = read_audio_data(cdda_playing.fd, pos, frames, buffer);
-        if (frames <= 0) {
-            int err = -frames;
-            if (err == EOPNOTSUPP)
-                dae_data.eof = TRUE;
-            else {
-                /*
-                 * If the read failed, skip ahead to
-                 * avoid getting stuck on scratches
-                 * and such.
-                 */
-                g_message("read_audio_data() failed:  %s (%d)",
-                          strerror(err), err);
-                pos += MIN(CDDA_DAE_FRAMES, end - pos);
-            }
-            continue;
-        }
-        left = frames * CD_FRAMESIZE_RAW;
-        data = buffer;
-        while (cdda_playing.playing && left > 0 && dae_data.seek == -1) {
-            int cur = MIN(512 * 2 * 2, left);
-            cdda_ip.add_vis_pcm(playback->output->written_time(),
-                                FMT_S16_LE, 2, cur, data);
-            while (playback->output->buffer_free() < cur &&
-                   cdda_playing.playing && dae_data.seek == -1)
-                xmms_usleep(30000);
-            if (cdda_playing.playing && dae_data.seek == -1)
-                produce_audio(playback->output->written_time(), FMT_S16_LE, 2, cur, data, &cdda_playing.playing);
-            left -= cur;
-            data += cur;
-        }
-        pos += frames;
-    }
-
-    playback->output->buffer_free();
-    playback->output->buffer_free();
-    g_free(buffer);
-
-    g_thread_exit(NULL);
-    return NULL;
-}
-
-static void
-dae_play(InputPlayback *playback)
-{
-    if (playback->output->open_audio(FMT_S16_LE, 44100, 2) == 0) {
-        dae_data.audio_error = TRUE;
-        cdda_playing.playing = FALSE;
-        return;
-    }
-    dae_data.seek = -1;
-    dae_data.eof = FALSE;
-    dae_data.audio_error = FALSE;
-    dae_data.thread = g_thread_create(dae_play_loop, playback, TRUE, NULL);
-}
-
-static void
-play_file(InputPlayback *playback)
-{
-    char *filename = playback->filename;
-    char *tmp;
-    struct driveinfo *drive;
-    int track;
-    int track_len;
-
-//      g_message(g_strdup_printf("** CD_AUDIO: trying to play file %s",filename));
-
-    if ((drive = cdda_find_drive(filename)) == NULL) {
-//              g_message("** CD_AUDIO: find drive check failed");
-        return;
-    }
-    if (is_mounted(drive->device)) {
-//              g_message("** CD_AUDIO: drive is mounted");
-        return;
-    }
-    tmp = strrchr(filename, '/');
-    if (tmp)
-        tmp++;
-    else
-        tmp = filename;
-
-    if (!sscanf(tmp, "Track %d.cda", &track)) {
-//              g_message("** CD_AUDIO: filename check failed");                
-        return;
-    }
-
-    if (!cdda_get_toc(&cdda_playing.cd_toc, drive->device) ||
-        cdda_playing.cd_toc.track[track].flags.data_track ||
-        track < cdda_playing.cd_toc.first_track ||
-        track > cdda_playing.cd_toc.last_track) {
-//              g_message("** CD_AUDIO: toc check failed");             
-        return;
-    }
-
-    if ((cdda_playing.fd = open(drive->device, CDOPENFLAGS)) == -1) {
-//              g_message("** CD_AUDIO: device open failed");           
-        return;
-    }
-    track_len = cdda_calculate_track_length(&cdda_playing.cd_toc, track);
-    cdda_ip.set_info(get_song_title(cdda_get_tuple(&cdda_playing.cd_toc, track)),
-                     (track_len * 1000) / 75, 44100 * 2 * 2 * 8, 44100, 2);
-
-    memcpy(&cdda_playing.drive, drive, sizeof(struct driveinfo));
-#ifndef CDDA_HAS_READAUDIO
-    cdda_playing.drive.dae = FALSE;
-#endif
-
-    cdda_playing.track = track;
-
-    is_paused = FALSE;
-    timeout_remove_for_device(drive->device);
-
-    cdda_playing.playing = TRUE;
-    if (drive->dae)
-        dae_play(playback);
-    else
-        seek(playback, 0);
-    return;
-}
-
-static TitleInput *
-cdda_get_tuple(cdda_disc_toc_t * toc, int track)
-{
-    G_LOCK_DEFINE_STATIC(tuple);
-
-    static guint32 cached_id;
-    static cdinfo_t cdinfo;
-    static gchar *performer, *album_name, *track_name;
-    TitleInput *tuple = NULL;
-    guint32 disc_id;
-
-    disc_id = cdda_cddb_compute_discid(toc);
-
-    /*
-     * We want to avoid looking up a album from two threads simultaneously.
-     * This can happen since we are called both from the main-thread and
-     * from the playlist-thread.
-     */
-
-    G_LOCK(tuple);
-    if (!(disc_id == cached_id && cdinfo.is_valid)) {
-        /*
-         * We try to look up the disc again if the info is not
-         * valid.  The user might have configured a new server
-         * in the meantime.
-         */
-        cdda_cdinfo_flush(&cdinfo);
-        cached_id = disc_id;
-
-        if (!cdda_cdinfo_read_file(disc_id, &cdinfo)) {
-            if (cdda_cfg.use_cddb)
-                cdda_cddb_get_info(toc, &cdinfo);
-            if (cdinfo.is_valid)
-                cdda_cdinfo_write_file(disc_id, &cdinfo);
-        }
-    }
-
-    tuple = bmp_title_input_new();
-    cdda_cdinfo_get(&cdinfo, track, &performer, &album_name, &track_name);
-    G_UNLOCK(tuple);
-
-    tuple->performer = g_strdup(performer);
-    tuple->album_name = g_strdup(album_name);
-    tuple->track_name = g_strdup(track_name);
-    tuple->track_number = (track);
-    tuple->file_name = g_strdup(tuple->file_path);
-    tuple->file_path = g_strdup_printf(_("CD Audio Track %02u"), track);
-    tuple->file_ext = "cda";
-    tuple->length = ((cdda_calculate_track_length(toc, track) * 1000) / 75);
-
-    if (!tuple->track_name)
-        tuple->track_name = g_strdup_printf(_("CD Audio Track %02u"), track);
-
-    tuple->genre = g_strdup(cdinfo.genre);
-    tuple->year = cdinfo.year;
-
-    return tuple;
-}
-
-static gchar *
-get_song_title(TitleInput *tuple)
-{
-    return xmms_get_titlestring(cdda_cfg.title_override ?
-                                cdda_cfg.name_format :
-                                xmms_get_gentitle_format(), tuple);
-}
-
-static gboolean
-stop_timeout(gpointer data)
-{
-    int fd;
-    struct timeout *to = data;
-
-    fd = open(to->device, CDOPENFLAGS);
-    if (fd != -1) {
-        ioctl(fd, XMMS_STOP, 0);
-        close(fd);
-    }
-    timeout_destroy(to);
-    return FALSE;
-}
-
-static void
-stop(InputPlayback * playback)
-{
-    struct timeout *to_info;
-    if (cdda_playing.fd < 0)
-        return;
-
-    cdda_playing.playing = FALSE;
-
-    if (cdda_playing.drive.dae) {
-        g_thread_join(dae_data.thread);
-        playback->output->close_audio();
-    }
-    else
-        ioctl(cdda_playing.fd, XMMS_PAUSE, 0);
-
-    close(cdda_playing.fd);
-    cdda_playing.fd = -1;
-
-    if (!cdda_playing.drive.dae) {
-        to_info = g_malloc(sizeof(*to_info));
-        to_info->device = g_strdup(cdda_playing.drive.device);
-        to_info->id = gtk_timeout_add(STOP_DELAY * 100, stop_timeout,
-                                      to_info);
-        timeout_list = g_list_prepend(timeout_list, to_info);
-    }
-}
-
-static void
-cdda_pause(InputPlayback *playback, short p)
-{
-    if (cdda_playing.drive.dae) {
-        playback->output->pause(p);
-        return;
-    }
-    if (p) {
-        pause_time = get_time(playback);
-        ioctl(cdda_playing.fd, XMMS_PAUSE, 0);
-    }
-    else {
-        ioctl(cdda_playing.fd, XMMS_RESUME, 0);
-        pause_time = -1;
-    }
-    is_paused = p;
-}
-
-
-
-static void
-seek(InputPlayback *data, int time)
-{
-    struct cdda_msf *end, start;
-    int track = cdda_playing.track;
-
-//      g_message("** CD_AUDIO: seeking...");
-    if (cdda_playing.drive.dae) {
-        dae_data.seek = time;
-        while (dae_data.seek != -1)
-            xmms_usleep(20000);
-        return;
-    }
-
-    start.minute = (cdda_playing.cd_toc.track[track].minute * 60 +
-                    cdda_playing.cd_toc.track[track].second + time) / 60;
-    start.second = (cdda_playing.cd_toc.track[track].second + time) % 60;
-    start.frame = cdda_playing.cd_toc.track[track].frame;
-    if (track == cdda_playing.cd_toc.last_track)
-        end = &cdda_playing.cd_toc.leadout;
-    else
-        end = &cdda_playing.cd_toc.track[track + 1];
-
-    play_ioctl(&start, end);
-
-    if (is_paused) {
-        cdda_pause(data, TRUE);
-        pause_time = time * 1000;
-    }
-}
-
-static int
-get_time_analog(void)
-{
-    int frame, start_frame, length;
-    int track = cdda_playing.track;
-
-    if (is_paused && pause_time != -1)
-        return pause_time;
-
-    frame = get_current_frame();
-
-    if (frame == -1)
-        return -1;
-
-    start_frame = LBA(cdda_playing.cd_toc.track[track]);
-    length = cdda_calculate_track_length(&cdda_playing.cd_toc, track);
-
-    if (frame - start_frame >= length - 20) /* 20 seems to work better */
-        return -1;
-
-    return ((frame - start_frame) * 1000) / 75;
-}
-
-static int
-get_time_dae(InputPlayback *playback)
-{
-    if (dae_data.audio_error)
-        return -2;
-    if (!cdda_playing.playing ||
-        (dae_data.eof && !playback->output->buffer_playing()))
-        return -1;
-    return playback->output->output_time();
-}
-
-static int
-get_time(InputPlayback *playback)
-{
-    if (cdda_playing.fd == -1)
-        return -1;
-
-    if (cdda_playing.drive.dae)
-        return get_time_dae(playback);
-    else
-        return get_time_analog();
-}
-
-static void
-get_song_info(char *filename, char **title, int *len)
-{
-    cdda_disc_toc_t toc;
-    int t;
-    char *tmp;
-    struct driveinfo *drive;
-    TitleInput *tuple;
-
-    *title = NULL;
-    *len = -1;
-
-//      g_message("** CD_AUDIO: getting song info");
-
-    if ((drive = cdda_find_drive(filename)) == NULL)
-        return;
-
-    tmp = strrchr(filename, '/');
-    if (tmp)
-        tmp++;
-    else
-        tmp = filename;
-
-    if (!sscanf(tmp, "Track %d.cda", &t))
-        return;
-    if (!cdda_get_toc(&toc, drive->device))
-        return;
-    if (t < toc.first_track || t > toc.last_track
-        || toc.track[t].flags.data_track)
-        return;
-
-    if ((tuple = cdda_get_tuple(&toc, t)) != NULL) {
-        *len = tuple->length;
-        *title = get_song_title(tuple);
-    }
-    bmp_title_input_free(tuple);
-}
-
-static TitleInput *
-get_song_tuple(char *filename)
-{
-    cdda_disc_toc_t toc;
-    int t;
-    char *tmp;
-    struct driveinfo *drive;
-    TitleInput *tuple = NULL;
-
-//      g_message("** CD_AUDIO: getting song info");
-
-    if ((drive = cdda_find_drive(filename)) == NULL)
-        return tuple;
-
-    tmp = strrchr(filename, '/');
-    if (tmp)
-        tmp++;
-    else
-        tmp = filename;
-
-    if (!sscanf(tmp, "Track %d.cda", &t))
-        return tuple;
-    if (!cdda_get_toc(&toc, drive->device))
-        return tuple;
-    if (t < toc.first_track || t > toc.last_track
-        || toc.track[t].flags.data_track)
-        return tuple;
-
-    tuple = cdda_get_tuple(&toc, t);
-    return tuple;
-}
-
-#ifdef HAVE_OSS
-static void
-oss_get_volume(int *l, int *r, int mixer_line)
-{
-    int fd, v;
-
-    fd = open(DEV_MIXER, O_RDONLY);
-    if (fd != -1) {
-        ioctl(fd, MIXER_READ(mixer_line), &v);
-        *r = (v & 0xFF00) >> 8;
-        *l = (v & 0x00FF);
-        close(fd);
-    }
-}
-
-static void
-oss_set_volume(int l, int r, int mixer_line)
-{
-    int fd, v;
-
-    fd = open(DEV_MIXER, O_RDONLY);
-    if (fd != -1) {
-        v = (r << 8) | l;
-        ioctl(fd, MIXER_WRITE(mixer_line), &v);
-        close(fd);
-    }
-}
-#else
-static void
-oss_get_volume(int *l, int *r, int mixer_line)
-{
-}
-static void
-oss_set_volume(int l, int r, int mixer_line)
-{
-}
-#endif
-
-
-static gint
-get_volume(int *l, int *r)
-{
-    if (cdda_playing.drive.dae)
-        return 0;
-    else if (cdda_playing.drive.mixer == CDDA_MIXER_OSS)
-        oss_get_volume(l, r, cdda_playing.drive.oss_mixer);
-    else if (cdda_playing.drive.mixer == CDDA_MIXER_DRIVE)
-        drive_get_volume(l, r);
-    return 1;
-}
-
-static gint
-set_volume(int l, int r)
-{
-    if (cdda_playing.drive.dae)
-        return 0;
-    else if (cdda_playing.drive.mixer == CDDA_MIXER_OSS)
-        oss_set_volume(l, r, cdda_playing.drive.oss_mixer);
-    else if (cdda_playing.drive.mixer == CDDA_MIXER_DRIVE)
-        drive_set_volume(l, r);
-    return 1;
-}
--- a/src/cdaudio/cdaudio.h	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*  XMMS - Cross-platform multimedia player
- *  Copyright (C) 1998-2002  Peter Alm, Mikael Alm, Olle Hallnas,
- *                           Thomas Nilsson and 4Front Technologies
- *  Copyright (C) 1999-2002  Haavard Kvaalen
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#ifndef CDAUDIO_H
-#define CDAUDIO_H
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include "audacious/plugin.h"
-
-#include "cdinfo.h"
-
-#ifdef HAVE_OSS
-#ifdef HAVE_SYS_SOUNDCARD_H
-#include <sys/soundcard.h>
-#else
-#include <soundcard.h>
-#endif
-#endif
-
-#ifdef HAVE_MNTENT_H
-#include <mntent.h>
-#endif
-
-#ifdef HAVE_GETMNTINFO
-#include <sys/param.h>
-#include <sys/ucred.h>
-#include <sys/mount.h>
-#endif
-
-#ifndef CD_FRAMES
-#define CD_FRAMES 75
-#endif
-
-#include <sys/types.h>
-
-#ifdef HAVE_LINUX_CDROM_H
-#include <linux/cdrom.h>
-#elif defined HAVE_SYS_CDIO_H
-#include <sys/cdio.h>
-#ifdef HAVE_SYS_CDRIO_H
-#include <sys/cdrio.h>
-#endif
-#endif
-
-#if defined(CDROMREADAUDIO) || defined(CDIOCREADAUDIO) || defined(CDROMCDDA) || defined(CDRIOCSETBLOCKSIZE)
-# define CDDA_HAS_READAUDIO
-#endif
-
-#ifndef CD_FRAMESIZE_RAW
-# define CD_FRAMESIZE_RAW 2352
-#endif
-
-/* Number of frames that are read at once in dae mode */
-#define CDDA_DAE_FRAMES 8
-
-#ifndef CDDA_HAS_READAUDIO
-#warning "Digital audio extraction has not been ported to this platform"
-#define read_audio_data(fd, pos, num, buf) -1
-#else
-int read_audio_data(int fd, int pos, int num, void *buf);
-#endif
-
-
-#ifdef __FreeBSD__
-/*
- * FreeBSD won't be able to detect media changes if using O_NONBLOCK
- */
-#define CDOPENFLAGS O_RDONLY
-#else
-#define CDOPENFLAGS (O_RDONLY | O_NONBLOCK)
-#endif
-
-
-#define CDDB_DEFAULT_SERVER "freedb.freedb.org"
-
-struct driveinfo {
-    gchar *device, *directory;
-    gint mixer, oss_mixer;
-    gboolean valid;
-    gint dae;
-};
-
-typedef struct {
-    GList *drives;
-
-    gchar *cddb_server;
-    gint cddb_protocol_level;
-    gboolean use_cddb;
-
-    gboolean title_override;
-    char *name_format;
-} CDDAConfig;
-
-struct cdda_msf {
-    guint8 minute;
-    guint8 second;
-    guint8 frame;
-    struct {
-        guint data_track:1;
-    } flags;
-};
-
-/*
- * Note: This macro will convert to a LBA representation of the MSF
- * address, not to a true LBA address, as we don't subtract the offset
- */
-#define LBA(msf) ((msf.minute * 60 + msf.second) * 75 + msf.frame)
-
-#define CDDA_MSF_OFFSET 150
-
-typedef struct {
-    guint8 first_track, last_track;
-    struct cdda_msf leadout;
-    struct cdda_msf track[100];
-} cdda_disc_toc_t;
-
-extern CDDAConfig cdda_cfg;
-
-enum {
-    CDDA_MIXER_NONE,
-    CDDA_MIXER_DRIVE,
-    CDDA_MIXER_OSS,
-};
-
-enum {
-    CDDA_READ_ANALOG,
-    CDDA_READ_DAE,
-};
-
-void cdda_configure(void);
-gboolean cdda_get_toc(cdda_disc_toc_t * info, const gchar *device);
-guint32 cdda_cddb_compute_discid(cdda_disc_toc_t * info);
-void cdda_cddb_get_info(cdda_disc_toc_t * toc, cdinfo_t * info);
-struct driveinfo *cdda_find_drive(gchar *filename);
-
-void cdda_cddb_show_server_dialog(GtkWidget * w, gpointer data);
-void cdda_cddb_set_server(const gchar *new_server);
-void cddb_quit(void);
-
-#endif
--- a/src/cdaudio/cddb.c	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,956 +0,0 @@
-/*
- *  cddb.c  Copyright 1999-2001 Håvard Kvålen <havardk@xmms.org>
- *
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-
-#include "cddb.h"
-
-#include <glib.h>
-#include <glib/gprintf.h>
-#include <gtk/gtk.h>
-#include <stdarg.h>
-
-#include <audacious/util.h>
-
-#include "http.h"
-#include "cdaudio.h"
-#include "cdinfo.h"
-
-
-static guint32 cached_id = 0;
-static GtkWidget *server_dialog, *server_clist;
-static GtkWidget *debug_window, *debug_clist;
-static GList *debug_messages = NULL;
-static GList *temp_messages = NULL;
-static guint cddb_timeout_id;
-
-G_LOCK_DEFINE_STATIC(list);
-
-void configure_set_cddb_server(gchar * server);
-
-static void
-cddb_log(gchar * str, ...)
-{
-    static GList *end_ptr = NULL;
-    static gint message_num = 0;
-    va_list args;
-    gchar *text;
-
-    va_start(args, str);
-    text = g_strdup_vprintf(str, args);
-    va_end(args);
-
-    message_num++;
-    debug_messages = g_list_prepend(debug_messages, text);
-    if (!end_ptr)
-        end_ptr = debug_messages;
-    if (message_num > CDDB_LOG_MAX) {
-        GList *temp;
-
-        temp = g_list_previous(end_ptr);
-        temp->next = NULL;
-        g_free(end_ptr->data);
-        g_list_free_1(end_ptr);
-        end_ptr = temp;
-        message_num--;
-    }
-    if (debug_window) {
-        G_LOCK(list);
-        temp_messages = g_list_append(temp_messages, g_strdup(text));
-        G_UNLOCK(list);
-    }
-}
-
-static gint
-cddb_sum(gint in)
-{
-    gint retval = 0;
-
-    while (in > 0) {
-        retval += in % 10;
-        in /= 10;
-    }
-    return retval;
-}
-
-guint32
-cdda_cddb_compute_discid(cdda_disc_toc_t * info)
-{
-    gint i;
-    guint high = 0, low;
-
-    for (i = info->first_track; i <= info->last_track; i++)
-        high += cddb_sum(info->track[i].minute * 60 + info->track[i].second);
-
-    low = (info->leadout.minute * 60 + info->leadout.second) -
-        (info->track[info->first_track].minute * 60 +
-         info->track[info->first_track].second);
-
-    return ((high % 0xff) << 24 | low << 8 | (info->last_track -
-                                              info->first_track + 1));
-}
-
-static gchar *
-cddb_generate_offset_string(cdda_disc_toc_t * info)
-{
-    gchar *buffer;
-    gchar offset[8];
-    int i;
-
-    buffer = g_malloc(info->last_track * 7 + 1);
-
-    sprintf(buffer, "%d", LBA(info->track[info->first_track]));
-
-    for (i = info->first_track + 1; i <= info->last_track; i++) {
-        sprintf(offset, "+%d", LBA(info->track[i]));
-        strcat(buffer, offset);
-    }
-
-    return buffer;
-}
-
-static gchar *
-cddb_generate_hello_string(void)
-{
-    static gchar *buffer;
-
-    if (buffer == NULL) {
-        gchar *env, *client = NULL, *version = NULL, **strs = NULL;
-
-        env = getenv("XMMS_CDDB_CLIENT_NAME");
-        if (env) {
-            strs = g_strsplit(env, " ", 2);
-            if (strs && strs[0] && strs[1]) {
-                client = strs[0];
-                version = strs[1];
-            }
-        }
-
-        if (!client || !version) {
-            client = PACKAGE_NAME;
-            version = PACKAGE_VERSION;
-        }
-
-        buffer = g_strdup_printf("&hello=nobody+localhost+%s+%s",
-                                 client, version);
-        if (strs)
-            g_strfreev(strs);
-    }
-    return buffer;
-}
-
-static gint
-cddb_http_open_connection(const gchar * server, gint port)
-{
-    gint sock;
-    gchar *status;
-
-    if ((sock = http_open_connection(server, 80)) == 0)
-        status = "Failed";
-    else
-        status = "Ok";
-
-    cddb_log("Connecting to CDDB-server %s: %s", server, status);
-    return sock;
-}
-
-
-static gboolean
-cddb_query(gchar * server, cdda_disc_toc_t * info,
-           cddb_disc_header_t * cddb_info)
-{
-    /*
-     * Query the cddb-server for the cd.
-     * Returns the *real* discid and category.
-     */
-
-    gint sock;
-    gchar *offsets, *getstr;
-    gchar buffer[256];
-    gchar **response;
-    gint i;
-    gint ret;
-
-    if ((sock = cddb_http_open_connection(server, 80)) == 0)
-        return FALSE;
-
-    offsets = cddb_generate_offset_string(info);
-
-    cddb_log("Sending query-command. Disc ID: %08x",
-             cdda_cddb_compute_discid(info));
-
-    getstr =
-        g_strdup_printf
-        ("GET /~cddb/cddb.cgi?cmd=cddb+query+%08x+%d+%s+%d%s&proto=%d HTTP/1.0\r\n\r\n",
-         cdda_cddb_compute_discid(info),
-         info->last_track - info->first_track + 1, offsets,
-         (info->leadout.minute * 60 + info->leadout.second),
-         cddb_generate_hello_string(), cdda_cfg.cddb_protocol_level);
-	cddb_log(getstr);
-
-    g_free(offsets);
-    ret = write(sock, getstr, strlen(getstr));
-
-    if(ret != strlen(getstr)){
-        g_free(getstr);
-        http_close_connection(sock);
-        return FALSE;
-    }
-
-    g_free(getstr);
-
-    if (http_read_first_line(sock, buffer, 256) < 0) {
-        http_close_connection(sock);
-        return FALSE;
-    }
-
-    response = g_strsplit(buffer, " ", 4);
-
-    cddb_log("Query response: %s", buffer);
-
-    switch (strtol(response[0], NULL, 10)) {
-    case 200:
-        /* One exact match */
-        for (i = 0; i < 4; i++) {
-            if (response[i] == NULL) {
-                g_strfreev(response);
-                return FALSE;
-            }
-        }
-        cddb_info->category = g_strdup(response[1]);
-        cddb_info->discid = strtoul(response[2], NULL, 16);
-        break;
-    case 210:
-    case 211:
-        /* multiple matches - use first match */
-        g_strfreev(response);
-        if (http_read_first_line(sock, buffer, 256) < 0) {
-            http_close_connection(sock);
-            return FALSE;
-        }
-        response = g_strsplit(buffer, " ", 4);
-        for (i = 0; i < 4; i++) {
-            if (response[i] == NULL) {
-                g_strfreev(response);
-                return FALSE;
-            }
-        }
-        cddb_info->category = g_strdup(response[0]);
-        cddb_info->discid = strtoul(response[1], NULL, 16);
-        break;
-    default:                   /* FIXME: Handle other 2xx */
-        g_strfreev(response);
-        return FALSE;
-    }
-    http_close_connection(sock);
-
-    g_strfreev(response);
-    return TRUE;
-}
-
-static gint
-cddb_check_protocol_level(const gchar * server)
-{
-    gint level = 0, sock, n, ret;
-    gchar *str, buffer[256];
-
-    if ((sock = cddb_http_open_connection(server, 80)) == 0)
-        return 0;
-
-    str =
-        g_strdup_printf
-        ("GET /~cddb/cddb.cgi?cmd=stat%s&proto=1 HTTP/1.0\r\n\r\n",
-         cddb_generate_hello_string());
-
-    ret = write(sock, str, strlen(str));
-    if(ret != strlen(str)){
-        g_free(str);
-        http_close_connection(sock);
-        return 0;
-    }
-
-
-    g_free(str);
-
-    if ((n = http_read_first_line(sock, buffer, 256)) < 0 ||
-        atoi(buffer) != 210) {
-        if (n > 0)
-            cddb_log("Getting cddb protocol level failed: %s", buffer);
-        else
-            cddb_log("Getting cddb protocol level failed.");
-
-        http_close_connection(sock);
-        return 0;
-    }
-
-    while (http_read_line(sock, buffer, 256) >= 0) {
-        g_strstrip(buffer);
-        if (!strncmp(buffer, "max proto:", 10))
-            level = atoi(buffer + 10);
-        if (!strcmp(buffer, "."))
-            break;
-    }
-    http_close_connection(sock);
-    cddb_log("Getting cddb protocol level. Got level %d", level);
-    return (MIN(level, CDDB_MAX_PROTOCOL_LEVEL));
-}
-
-#define BUF2SIZE (80*3)
-
-static gboolean
-cddb_read(gchar * server, cddb_disc_header_t * cddb_info, cdinfo_t * cdinfo)
-{
-    gint sock;
-    gchar *readstr;
-    gchar buffer[256];	/* http line buffer */
-    gchar *discid = NULL, *dartist = NULL, *dtitle = NULL,
-	    *dyear = NULL, *dgenre = NULL, *ttitle = NULL;
-    gchar *realstr, *temp;
-    gint len, command;
-    gint num, oldnum;
-    gint ret;
-
-    if ((sock = cddb_http_open_connection(server, 80)) == 0)
-        return FALSE;
-
-    cddb_log("Sending read-command. Disc ID: %08x. Category: %s",
-             cddb_info->discid, cddb_info->category);
-
-    readstr =
-        g_strdup_printf
-        ("GET /~cddb/cddb.cgi?cmd=cddb+read+%s+%08x%s&proto=%d HTTP/1.0\r\n\r\n",
-         cddb_info->category, cddb_info->discid,
-         cddb_generate_hello_string(), cdda_cfg.cddb_protocol_level);
-	cddb_log(readstr);
-
-    ret = write(sock, readstr, strlen(readstr));
-    if(ret != strlen(readstr)){
-        g_free(readstr);
-        http_close_connection(sock);
-        return FALSE;
-    }
-
-    g_free(readstr);
-
-    if (http_read_first_line(sock, buffer, 256) < 0) {
-        http_close_connection(sock);
-        return FALSE;
-    }
-
-    cddb_log("Read response: %s", buffer);
-
-    command = 1;
-    oldnum = -1;
-    do {
-        realstr = strchr(buffer, '=');
-        if (buffer[0] == '#' || !realstr)
-            continue;
-
-        realstr++;
-        len = strlen(realstr);
-
-        switch (command) {
-        case 1:
-            if (!strncmp(buffer, "DISCID", 6)) {
-                discid = g_strdup(realstr);
-                break;			
-            }
-            command++;
-        case 2:
-            if (!strncmp(buffer, "DTITLE", 6)) {
-                if((temp = strstr(buffer, " / ")) != NULL) {
-                    dtitle = g_strdup(temp+3);
-                    dartist = g_strndup(realstr, temp - realstr);
-                }
-                else {
-                    dtitle = g_strdup(realstr);
-                }
-                break;
-            }
-            command++;
-        case 3:
-            if (!strncmp(buffer, "DYEAR", 5)) {
-                dyear = g_strdup(realstr);
-                break;
-            }
-            command++;
-        case 4:
-            if (!strncmp(buffer, "DGENRE", 6)) {
-                dgenre = g_strdup(realstr);
-                break;
-            }
-
-            // we have obtained all necessary data to set discinfo
-            cdda_cdinfo_cd_set(cdinfo, dtitle, dartist, discid, dgenre, dyear);
-            
-            command++;
-        case 5:
-            if (!strncmp(buffer, "TTITLE", 6)) {
-                num = atoi(buffer + 6);
-                if (oldnum < 0 || num == oldnum) {
-                    ttitle = g_strdup(realstr);
-                }
-                else {
-                    cdda_cdinfo_track_set(cdinfo, oldnum + 1, NULL, ttitle);
-                    ttitle = g_strdup(realstr);
-                }
-                oldnum = num;
-                break;
-            }
-            if (oldnum >= 0)
-                cdda_cdinfo_track_set(cdinfo, oldnum + 1, NULL, ttitle);
-
-            oldnum = -1;
-            command++;
-        case 6:
-            if (!strncmp(buffer, "EXTD", 4)) {
-                break;
-            }
-            command++;
-        case 7:
-            if (!strncmp(buffer, "EXTT", 4)) {
-                break;
-            }
-            command++;
-        case 8:
-            if (!strncmp(buffer, "PLAYORDER", 9)) {
-                break;
-            }
-            command++;
-        default:
-            g_log(NULL, G_LOG_LEVEL_WARNING, "%s: illegal cddb-data: %s",
-                  PACKAGE_NAME, buffer);
-            break;
-        }
-
-    } while (http_read_line(sock, buffer, 256) >= 0);
-
-    if (oldnum >= 0)
-        cdda_cdinfo_track_set(cdinfo, oldnum + 1, NULL, ttitle);
-
-    http_close_connection(sock);
-    return TRUE;
-}
-
-static gint
-cddb_get_protocol_level(void)
-{
-    if (cdda_cfg.cddb_protocol_level < 1)
-        cdda_cfg.cddb_protocol_level =
-            cddb_check_protocol_level(cdda_cfg.cddb_server);
-
-    return cdda_cfg.cddb_protocol_level;
-}
-
-static GList *
-cddb_get_server_list(const gchar * server, gint protocol_level)
-{
-    gint sock;
-    gchar *getstr;
-    gchar buffer[256];
-    gchar **message;
-    GList *list = NULL;
-    gint ret;
-
-    if ((sock = cddb_http_open_connection(server, 80)) == 0)
-        return NULL;
-
-    cddb_log("Sending sites-command");
-
-    getstr =
-        g_strdup_printf
-        ("GET /~cddb/cddb.cgi?cmd=sites%s&proto=%d HTTP/1.0\r\n\r\n",
-         cddb_generate_hello_string(), protocol_level);
-	cddb_log(getstr);
-
-    ret = write(sock, getstr, strlen(getstr));
-    if(ret != strlen(getstr)){
-        g_free(getstr);
-        http_close_connection(sock);
-        return NULL;
-    }
-    g_free(getstr);
-
-    if (http_read_first_line(sock, buffer, 256) < 0) {
-        http_close_connection(sock);
-        return NULL;
-    }
-
-    cddb_log("Sites response: %s", buffer);
-
-    switch (atoi(buffer)) {
-    case 210:
-        while ((http_read_line(sock, buffer, 256)) > 1) {
-            message = g_strsplit(buffer, " ", 6);
-            if (message && message[0] && message[1] &&
-                !strcasecmp(message[1], "http")) {
-                list = g_list_prepend(list, message);
-            }
-            else {
-                /* Ignore non-http servers */
-                g_strfreev(message);
-            }
-        }
-        list = g_list_reverse(list);
-        break;
-    case 401:
-        /* No site information available */
-        break;
-    default:
-        break;
-    }
-    http_close_connection(sock);
-    return list;
-}
-
-gint
-search_for_discid(gchar * abs_filename, gchar ** cddb_file, guint32 disc_id)
-{
-    GDir *dir;
-    const gchar *dir_entry;
-    gchar tmp_id[10];
-
-    if (!(dir = g_dir_open(abs_filename, 0, NULL)))
-        return (0);
-
-    memset(tmp_id, 0, 10);
-
-    snprintf(tmp_id, sizeof(tmp_id), "%08x", disc_id);
-    while ((dir_entry = g_dir_read_name(dir))) {
-        if (!strncmp(tmp_id, dir_entry, 8)) {
-            cddb_file[0] = g_build_filename(abs_filename, dir_entry, NULL);
-            g_dir_close(dir);
-            return (1);
-        }
-    }
-    g_dir_close(dir);
-
-    return (0);
-}
-
-gint
-scan_cddb_dir(gchar * server, gchar ** cddb_file, guint32 disc_id)
-{
-
-    GDir *dir;
-    const gchar *dir_entry;
-    gchar abs_filename[FILENAME_MAX];
-
-    if (!(dir = g_dir_open(&server[7], 0, NULL))) {
-        return 0;
-    }
-
-    while ((dir_entry = g_dir_read_name(dir))) {
-        strcpy(abs_filename, &server[7]);
-        if (abs_filename[strlen(abs_filename) - 1] != '/') {
-            strcat(abs_filename, "/");
-        }
-        strcat(abs_filename, dir_entry);
-
-        if (dir_entry[0] != '.' &&
-            g_file_test(abs_filename, G_FILE_TEST_IS_DIR) &&
-            search_for_discid(abs_filename, cddb_file, disc_id)) {
-            break;
-        }
-    }
-
-    g_dir_close(dir);
-    return (cddb_file[0] != NULL);
-}
-
-gint
-cddb_read_file(gchar * file, cddb_disc_header_t * cddb_info,
-               cdinfo_t * cdinfo)
-{
-    FILE *fd;
-    gchar buffer[256];
-    gchar *realstr, *temp;
-    gchar *discid = NULL, *dartist = NULL, *dtitle = NULL,
-	    *dyear = NULL, *dgenre = NULL, *ttitle = NULL;
-    gint len, command;
-    gint num, oldnum;
-
-    if ((fd = fopen(file, "r")) == NULL)
-        return 0;
-
-    command = 1;
-    oldnum = -1;
-    while (fgets(buffer, 256, fd) != NULL) {
-        realstr = strchr(buffer, '=');
-        if (buffer[0] == '#' || !realstr)
-            continue;
-
-        realstr++;
-        len = strlen(realstr);
-        if (realstr[len - 1] == '\n')
-            realstr[--len] = '\0';  /* remove newline */
-
-        switch (command) {
-        case 1:
-            if (!strncmp(buffer, "DISCID", 6)) {
-                discid = g_strdup(realstr);
-                break;
-            }
-            command++;
-        case 2:
-            if (!strncmp(buffer, "DTITLE", 6)) {
-                if((temp = strstr(buffer, " / ")) != NULL) {
-                    dtitle = g_strdup(temp+3);
-                    dartist = g_strndup(realstr, temp - realstr);
-                }
-                else {
-                    dtitle = g_strdup(realstr);
-                }
-                break;
-            }
-            command++;
-        case 3:
-            if (!strncmp(buffer, "DYEAR", 5)) {
-                dyear = g_strdup(realstr);
-                break;
-            }
-            command++;
-        case 4:
-            if (!strncmp(buffer, "DGENRE", 6)) {
-                dgenre = g_strdup(realstr);
-                break;
-            }
-
-            // we have obtained all necessary data to set discinfo
-            cdda_cdinfo_cd_set(cdinfo, dtitle, dartist, discid, dgenre, dyear);
-
-            command++;
-        case 5:
-            if (!strncmp(buffer, "TTITLE", 6)) {
-                num = atoi(buffer + 6);
-                if (oldnum < 0 || num == oldnum) {
-                    ttitle = g_strdup(realstr);
-                }
-                else {
-                    cdda_cdinfo_track_set(cdinfo, oldnum + 1, NULL, ttitle);
-                    ttitle = g_strdup(realstr);
-                }
-                oldnum = num;
-                break;
-            }
-            if (oldnum >= 0)
-                cdda_cdinfo_track_set(cdinfo, oldnum + 1, NULL, ttitle);
-
-            oldnum = -1;
-            command++;
-        case 6:
-            if (!strncmp(buffer, "EXTD", 4)) {
-                break;
-            }
-            command++;
-        case 7:
-            if (!strncmp(buffer, "EXTT", 4)) {
-                break;
-            }
-            command++;
-        case 8:
-            if (!strncmp(buffer, "PLAYORDER", 9)) {
-                break;
-            }
-            command++;
-        default:
-            g_log(NULL, G_LOG_LEVEL_WARNING, "%s: illegal cddb-data: %s",
-                  PACKAGE_NAME, buffer);
-            break;
-        }
-
-    }
-
-    if (oldnum >= 0)
-        cdda_cdinfo_track_set(cdinfo, oldnum + 1, NULL, ttitle);
-
-    fclose(fd);
-    return (1);
-}
-
-
-void
-cdda_cddb_get_info(cdda_disc_toc_t * toc, cdinfo_t * cdinfo)
-{
-    guint32 disc_id;
-    cddb_disc_header_t cddb_disc_info;
-    gchar *cddb_file[1];
-    disc_id = cdda_cddb_compute_discid(toc);
-    cddb_file[0] = NULL;
-
-    if ((cached_id != disc_id)
-        && (strncmp(cdda_cfg.cddb_server, "file://", 7) != 0)) {
-        if (cddb_get_protocol_level() == 0)
-            return;
-
-        cached_id = disc_id;
-        if (!cddb_query(cdda_cfg.cddb_server, toc, &cddb_disc_info))
-            return;
-        if (!cddb_read(cdda_cfg.cddb_server, &cddb_disc_info, cdinfo))
-            return;
-        cdinfo->is_valid = TRUE;
-
-    }
-    else if ((cached_id != disc_id)
-             && (strncmp(cdda_cfg.cddb_server, "file://", 7) == 0)) {
-        cached_id = disc_id;
-        if (!scan_cddb_dir(cdda_cfg.cddb_server, cddb_file, disc_id))
-            return;
-        if (!cddb_read_file(cddb_file[0], &cddb_disc_info, cdinfo)) {
-            g_free(cddb_file[0]);
-            return;
-        }
-        cdinfo->is_valid = TRUE;
-        g_free(cddb_file[0]);
-    }
-}
-
-void
-cdda_cddb_set_server(const gchar * new_server)
-{
-    if (strcmp(cdda_cfg.cddb_server, new_server)) {
-        g_free(cdda_cfg.cddb_server);
-        cdda_cfg.cddb_server = g_strdup(new_server);
-        cdda_cfg.cddb_protocol_level = 0;
-        cached_id = 0;
-    }
-}
-
-
-static gchar *
-cddb_position_string(gchar * input)
-{
-    gchar deg[4], min[3];
-    if (input == NULL || strlen(input) < 7)
-        return g_strdup("");
-    strncpy(deg, input + 1, 3);
-    deg[3] = '\0';
-    strncpy(min, input + 5, 2);
-    min[2] = '\0';
-    return g_strdup_printf("%2d°%s'%c", atoi(deg), min, input[0]);
-}
-
-static void
-cddb_server_dialog_ok_cb(GtkWidget * w, gpointer data)
-{
-    gchar *text;
-    gint pos;
-    GtkEntry *entry = GTK_ENTRY(data);
-
-    if (!GTK_CLIST(server_clist)->selection)
-        return;
-    pos = GPOINTER_TO_INT(GTK_CLIST(server_clist)->selection->data);
-    gtk_clist_get_text(GTK_CLIST(server_clist), pos, 0, &text);
-    cdda_cddb_set_server(text);
-    gtk_entry_set_text(entry, text);
-    gtk_widget_destroy(server_dialog);
-}
-
-static void
-cddb_server_dialog_select(GtkWidget * w, gint row, gint column,
-                          GdkEvent * event, gpointer data)
-{
-    if (event->type == GDK_2BUTTON_PRESS)
-        cddb_server_dialog_ok_cb(NULL, NULL);
-}
-
-void
-cdda_cddb_show_server_dialog(GtkWidget * w, gpointer data)
-{
-    GtkWidget *vbox, *bbox, *okbutton, *cancelbutton;
-    GtkEntry *server_entry = GTK_ENTRY(data);
-    gchar *titles[] = { "Server", "Latitude", "Longitude", "Description" };
-    GList *servers;
-    const gchar *server;
-    gint level;
-
-    if (server_dialog)
-        return;
-
-    server = gtk_entry_get_text(server_entry);
-
-    if ((level = cddb_check_protocol_level(server)) < 3) {
-        if (!level)
-            xmms_show_message("CDDB",
-                              "Unable to connect to CDDB-server",
-                              "Ok", FALSE, NULL, NULL);
-        else
-            /* CDDB level < 3 has the "sites" command,
-               but the format is different. Not supported yet */
-            xmms_show_message("CDDB",
-                              "Can't get server list from the current CDDB-server\n"
-                              "Unsupported CDDB protocol level",
-                              "Ok", FALSE, NULL, NULL);
-        return;
-    }
-
-    if ((servers = cddb_get_server_list(server, level)) == NULL) {
-        xmms_show_message("CDDB",
-                          "No site information available",
-                          "Ok", FALSE, NULL, NULL);
-        return;
-    }
-
-    server_dialog = gtk_dialog_new();
-    g_signal_connect(G_OBJECT(server_dialog), "destroy",
-                     G_CALLBACK(gtk_widget_destroyed), &server_dialog);
-    gtk_window_set_title(GTK_WINDOW(server_dialog), "CDDB servers");
-    gtk_window_set_modal(GTK_WINDOW(server_dialog), TRUE);
-
-    vbox = gtk_vbox_new(FALSE, 0);
-    gtk_container_set_border_width(GTK_CONTAINER(vbox), 15);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(server_dialog)->vbox), vbox,
-                       TRUE, TRUE, 0);
-
-    server_clist = gtk_clist_new_with_titles(4, titles);
-    g_signal_connect(G_OBJECT(server_clist), "select-row",
-                     G_CALLBACK(cddb_server_dialog_select), NULL);
-    gtk_box_pack_start(GTK_BOX(vbox), server_clist, TRUE, TRUE, 0);
-
-    bbox = gtk_hbutton_box_new();
-    gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
-    gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(server_dialog)->action_area),
-                       bbox, TRUE, TRUE, 0);
-
-    okbutton = gtk_button_new_with_label("Ok");
-    g_signal_connect(G_OBJECT(okbutton), "clicked",
-                     G_CALLBACK(cddb_server_dialog_ok_cb), data);
-    gtk_box_pack_start(GTK_BOX(bbox), okbutton, TRUE, TRUE, 0);
-    cancelbutton = gtk_button_new_with_label("Cancel");
-    g_signal_connect_swapped(G_OBJECT(cancelbutton), "clicked",
-                             G_CALLBACK(gtk_widget_destroy),
-                             GTK_OBJECT(server_dialog));
-    gtk_box_pack_start(GTK_BOX(bbox), cancelbutton, TRUE, TRUE, 0);
-    GTK_WIDGET_SET_FLAGS(okbutton, GTK_CAN_DEFAULT);
-    GTK_WIDGET_SET_FLAGS(cancelbutton, GTK_CAN_DEFAULT);
-    gtk_widget_grab_default(okbutton);
-
-    while (servers) {
-        gchar *row[4];
-        gint i;
-
-        row[0] = g_strdup(((gchar **) servers->data)[0]);
-        row[1] = cddb_position_string(((gchar **) servers->data)[4]);
-        row[2] = cddb_position_string(((gchar **) servers->data)[5]);
-        row[3] = g_strdup(((gchar **) servers->data)[6]);
-        gtk_clist_append(GTK_CLIST(server_clist), row);
-        for (i = 0; i < 4; i++)
-            g_free(row[i]);
-        g_strfreev(servers->data);
-        servers = g_list_next(servers);
-    }
-    g_list_free(servers);
-    gtk_clist_columns_autosize(GTK_CLIST(server_clist));
-    gtk_widget_show_all(server_dialog);
-}
-
-static gboolean
-cddb_update_log_window(gpointer data)
-{
-    if (!debug_window) {
-        cddb_timeout_id = 0;
-        return FALSE;
-    }
-
-    G_LOCK(list);
-    if (temp_messages != NULL) {
-        GList *temp;
-        GDK_THREADS_ENTER();
-        gtk_clist_freeze(GTK_CLIST(debug_clist));
-        for (temp = temp_messages; temp; temp = temp->next) {
-            gchar *text = temp->data;
-            gtk_clist_append(GTK_CLIST(debug_clist), &text);
-            g_free(text);
-        }
-        gtk_clist_columns_autosize(GTK_CLIST(debug_clist));
-        gtk_clist_thaw(GTK_CLIST(debug_clist));
-        gtk_clist_moveto(GTK_CLIST(debug_clist),
-                         GTK_CLIST(debug_clist)->rows - 1, -1, 0.5, 0);
-        GDK_THREADS_LEAVE();
-        g_list_free(temp_messages);
-        temp_messages = NULL;
-    }
-    G_UNLOCK(list);
-    return TRUE;
-}
-
-
-void
-cdda_cddb_show_network_window(GtkWidget * w, gpointer data)
-{
-    GtkWidget *vbox, *bbox, *close, *scroll_win;
-    GList *temp;
-
-    if (debug_window)
-        return;
-
-    debug_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-    g_signal_connect(G_OBJECT(debug_window), "destroy",
-                     G_CALLBACK(gtk_widget_destroyed), &debug_window);
-    gtk_window_set_title(GTK_WINDOW(debug_window), "CDDB networkdebug");
-    gtk_window_set_resizable(GTK_WINDOW(debug_window), TRUE);
-    gtk_window_set_default_size(GTK_WINDOW(debug_window), 400, 150);
-    gtk_container_border_width(GTK_CONTAINER(debug_window), 10);
-
-    vbox = gtk_vbox_new(FALSE, 10);
-    gtk_container_add(GTK_CONTAINER(debug_window), vbox);
-
-    scroll_win = gtk_scrolled_window_new(NULL, NULL);
-    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win),
-                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
-    debug_clist = gtk_clist_new(1);
-    gtk_container_add(GTK_CONTAINER(scroll_win), debug_clist);
-    gtk_box_pack_start(GTK_BOX(vbox), scroll_win, TRUE, TRUE, 0);
-
-    temp = debug_messages;
-    while (temp) {
-        gtk_clist_prepend(GTK_CLIST(debug_clist), (gchar **) & temp->data);
-        temp = g_list_next(temp);
-    }
-
-    bbox = gtk_hbutton_box_new();
-    gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
-    gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
-    gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
-
-    close = gtk_button_new_with_label("Close");
-    g_signal_connect_swapped(G_OBJECT(close), "clicked",
-                             G_CALLBACK(gtk_widget_destroy),
-                             GTK_OBJECT(debug_window));
-    GTK_WIDGET_SET_FLAGS(close, GTK_CAN_DEFAULT);
-    gtk_box_pack_start(GTK_BOX(bbox), close, TRUE, TRUE, 0);
-    gtk_widget_grab_default(close);
-
-    gtk_clist_columns_autosize(GTK_CLIST(debug_clist));
-    gtk_clist_set_button_actions(GTK_CLIST(debug_clist), 0,
-                                 GTK_BUTTON_IGNORED);
-    gtk_clist_moveto(GTK_CLIST(debug_clist),
-                     GTK_CLIST(debug_clist)->rows - 1, -1, 0, 0);
-
-    cddb_timeout_id = gtk_timeout_add(500, cddb_update_log_window, NULL);
-    gtk_widget_show_all(debug_window);
-}
-
-void
-cddb_quit(void)
-{
-    if (cddb_timeout_id)
-        gtk_timeout_remove(cddb_timeout_id);
-    cddb_timeout_id = 0;
-}
--- a/src/cdaudio/cddb.h	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- *  cddb.h  Copyright 1999 Håvard Kvålen <havardk@sol.no>
- *
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef CDDB_H
-#define CDDB_H
-
-#include <glib.h>
-
-typedef struct {
-    gchar *category;
-    guint32 discid;
-} cddb_disc_header_t;
-
-#define CDDB_MAX_PROTOCOL_LEVEL 6
-#define CDDB_HOSTNAME_LEN 100
-#define CDDB_LOG_MAX 100
-
-#endif
--- a/src/cdaudio/cdinfo.c	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-/*
- *  cdinfo.c   Copyright 1999 Espen Skoglund <esk@ira.uka.de>
- *             Copyright 1999 Håvard Kvålen <havardk@sol.no>
- *
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "cdinfo.h"
-#include "cdaudio.h"
-
-#include <glib.h>
-#include <audacious/i18n.h>
-#include <audacious/rcfile.h>
-
-#include <stdlib.h>
-
-
-/*
- * Function cdda_cdinfo_flush (cdinfo)
- *
- *    Free all information stored about the CD.
- *
- */
-void
-cdda_cdinfo_flush(cdinfo_t * cdinfo)
-{
-    trackinfo_t *t;
-    gint i;
-
-    if (cdinfo->albname)
-        g_free(cdinfo->albname);
-    if (cdinfo->artname)
-        g_free(cdinfo->artname);
-
-    cdinfo->albname = cdinfo->artname = NULL;
-
-    for (t = cdinfo->tracks, i = 0; i < 100; i++, t++) {
-        if (t->artist)
-            g_free(t->artist);
-        if (t->title)
-            g_free(t->title);
-
-        t->artist = t->title = NULL;
-        t->num = -1;
-    }
-    cdinfo->is_valid = FALSE;
-}
-
-
-/*
- * Function cdda_cdinfo_delete (cdinfo)
- *
- *    Free the indicated `cdinfo' structure.
- *
- */
-void
-cdda_cdinfo_delete(cdinfo_t * cdinfo)
-{
-    cdda_cdinfo_flush(cdinfo);
-    g_free(cdinfo);
-}
-
-
-/*
- * Function cdda_cdinfo_new ()
- *
- *    Allocate a new `cdinfo' structure and return it.
- *
- */
-cdinfo_t *
-cdda_cdinfo_new(void)
-{
-    cdinfo_t *ret;
-    ret = g_malloc0(sizeof(cdinfo_t));
-    cdda_cdinfo_flush(ret);
-
-    return ret;
-}
-
-
-/*
- * Function cdda_cdinfo_track_set (cdinfo, num, artist, title)
- *
- *    Set `artist', and `title' for a track `num'.  If the CD is a
- *    singleartist disc, the `artist' on each track should be set to
- *    NULL.
- *
- */
-void
-cdda_cdinfo_track_set(cdinfo_t * cdinfo, gint num, gchar * artist,
-                      gchar * title)
-{
-    trackinfo_t *track = cdinfo->tracks + num;
-
-    /* Check bounds */
-    if (num < 1 || num >= 100)
-        return;
-
-    track->artist = artist;
-    track->title = title;
-    track->num = num;
-    cdinfo->is_valid = TRUE;
-}
-
-
-/*
- * Function cdda_cdinfo_cd_set (cdinfo, cdname, cdartist, discid,
- * genre, year)
- *
- *    Set name, artist, discid, genre and year for a cd. If CD is a
- *    multiartist disc, the `artist' should be set to NULL.
- *
- */
-void
-cdda_cdinfo_cd_set(cdinfo_t * cdinfo, gchar * cdname, gchar * cdartist,
-                   gchar * discid, gchar * genre, gchar *year)
-{
-    cdinfo->is_valid = TRUE;
-    cdinfo->albname = cdname;
-    cdinfo->artname = cdartist;
-    cdinfo->discid = discid ? atoi(discid) : 0;
-    cdinfo->genre = genre;
-    cdinfo->year = year ? atoi(year) : 0;
-}
-
-
-/*
- * Function cdda_cdinfo_get (cdinfo, num, artist, album, title)
- *
- *    Get artist, album, and title of the indicated track (i.e. store
- *    them in the specified pointers).  Return 0 upon success, or -1
- *    of track did not exist.  The returned name must be subsequently
- *    freed using g_free().
- *
- */
-gint
-cdda_cdinfo_get(cdinfo_t * cdinfo, gint num, gchar ** artist,
-                gchar ** album, gchar ** title)
-{
-    trackinfo_t *track = cdinfo->tracks + num;
-
-    /* Check validity */
-    if (!cdinfo->is_valid || num < 1 || num >= 100)
-        return -1;
-
-    *artist = track->artist ? track->artist :
-        cdinfo->artname ? cdinfo->artname : _("(unknown)");
-    *album = cdinfo->albname ? cdinfo->albname : _("(unknown)");
-    *title = track->title ? track->title : _("(unknown)");
-
-    return track->num == -1 ? -1 : 0;
-}
-
-
-/*
- * Function cdda_cdinfo_write_file
- *
- * Writes the cdinfo_t structure to disk.
- */
-
-
-void
-cdda_cdinfo_write_file(guint32 cddb_discid, cdinfo_t * cdinfo)
-{
-    gchar *filename;
-    RcFile *rcfile;
-    gchar sectionname[10], trackstr[16];
-    gint i, numtracks = cddb_discid & 0xff;
-
-    sprintf(sectionname, "%08x", cddb_discid);
-
-    filename =
-        g_strconcat(g_get_home_dir(), "/", BMP_RCPATH, "/cdinfo", NULL);
-    if ((rcfile = bmp_rcfile_open(filename)) == NULL)
-        rcfile = bmp_rcfile_new();
-
-    if (cdinfo->albname)
-        bmp_rcfile_write_string(rcfile, sectionname, "Albumname",
-                                cdinfo->albname);
-    else
-        bmp_rcfile_write_string(rcfile, sectionname, "Albumname", "");
-
-    if (cdinfo->artname)
-        bmp_rcfile_write_string(rcfile, sectionname, "Artistname",
-                                cdinfo->artname);
-    if (cdinfo->year) {
-        gchar *yearstr = g_strdup_printf("%4d", cdinfo->year);
-        bmp_rcfile_write_string(rcfile, sectionname, "Year", yearstr);
-        g_free(yearstr);
-    }
-
-    if (cdinfo->genre)
-        bmp_rcfile_write_string(rcfile, sectionname, "Genre", cdinfo->genre);
-
-
-    for (i = 1; i <= numtracks; i++) {
-        if (cdinfo->tracks[i].artist) {
-            sprintf(trackstr, "track_artist%d", i);
-            bmp_rcfile_write_string(rcfile, sectionname, trackstr,
-                                    cdinfo->tracks[i].artist);
-        }
-        if (cdinfo->tracks[i].title) {
-            sprintf(trackstr, "track_title%d", i);
-            bmp_rcfile_write_string(rcfile, sectionname, trackstr,
-                                    cdinfo->tracks[i].title);
-        }
-    }
-    bmp_rcfile_write(rcfile, filename);
-    bmp_rcfile_free(rcfile);
-    g_free(filename);
-}
-
-/*
- * Function cdda_cdinfo_read_file
- *
- * Tries to find and read a album from the disk-cache.
- *
- * Returns true if the album is found.
- */
-
-gboolean
-cdda_cdinfo_read_file(guint32 cddb_discid, cdinfo_t * cdinfo)
-{
-    gchar *filename;
-    RcFile *rcfile;
-    gchar sectionname[10], trackstr[16];
-    gint i, numtracks = cddb_discid & 0xff;
-    gboolean track_found;
-    gchar *yearstr = NULL;
-
-    sprintf(sectionname, "%08x", cddb_discid);
-
-    filename =
-        g_strconcat(g_get_home_dir(), "/", BMP_RCPATH, "/cdinfo", NULL);
-    if ((rcfile = bmp_rcfile_open(filename)) == NULL) {
-        g_free(filename);
-        return FALSE;
-    }
-    g_free(filename);
-
-    if (!bmp_rcfile_read_string
-        (rcfile, sectionname, "Albumname", &cdinfo->albname))
-        return FALSE;
-
-    bmp_rcfile_read_string(rcfile, sectionname, "Artistname",
-                           &cdinfo->artname);
-
-    bmp_rcfile_read_string(rcfile, sectionname, "Year", &yearstr);
-    if (yearstr) {
-        cdinfo->year = atoi(yearstr);
-	g_free(yearstr);
-	yearstr = NULL;
-    }
-
-    bmp_rcfile_read_string(rcfile, sectionname, "Genre", &cdinfo->genre);
-
-    for (i = 1; i <= numtracks; i++) {
-        track_found = FALSE;
-        sprintf(trackstr, "track_artist%d", i);
-        if (bmp_rcfile_read_string
-            (rcfile, sectionname, trackstr, &cdinfo->tracks[i].artist))
-            track_found = TRUE;
-        sprintf(trackstr, "track_title%d", i);
-        if (bmp_rcfile_read_string
-            (rcfile, sectionname, trackstr, &cdinfo->tracks[i].title))
-            track_found = TRUE;
-        if (track_found)
-            cdinfo->tracks[i].num = i;
-    }
-    cdinfo->is_valid = TRUE;
-    bmp_rcfile_free(rcfile);
-    return TRUE;
-}
--- a/src/cdaudio/cdinfo.h	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- *  cdinfo.h   Copyright 1999 Espen Skoglund <esk@ira.uka.de>
- *             Copyright 1999 Håvard Kvålen <havardk@sol.no>
- *
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#ifndef CDINFO_H
-#define CDINFO_H
-
-#include <glib.h>
-
-/*
- * For holding info on a single CD track.
- */
-typedef struct {
-    gchar *artist;
-    gchar *title;
-    gint num;
-} trackinfo_t;
-
-/*
- * For holding info on a complete CD.
- */
-typedef struct {
-    gboolean is_valid;
-    gint discid;
-    gchar *albname;
-    gchar *artname;
-    gchar *genre;
-    gint year;
-    trackinfo_t tracks[100];
-} cdinfo_t;
-
-void cdda_cdinfo_flush(cdinfo_t * cdinfo);
-cdinfo_t *cdda_cdinfo_new(void);
-void cdda_cdinfo_delete(cdinfo_t * info);
-void cdda_cdinfo_track_set(cdinfo_t * cdinfo, gint, gchar *, gchar *);
-void cdda_cdinfo_cd_set(cdinfo_t * cdinfo, gchar *, gchar *, gchar *, gchar *, gchar *);
-gint cdda_cdinfo_get(cdinfo_t * cdinfo, gint num, gchar **, gchar **, gchar **);
-gboolean cdda_cdinfo_read_file(guint32 cddb_discid, cdinfo_t * cdinfo);
-void cdda_cdinfo_write_file(guint32 cddb_discid, cdinfo_t * cdinfo);
-
-
-#endif
--- a/src/cdaudio/configure.c	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,658 +0,0 @@
-/*  BMP - Cross-platform multimedia player
- *  Copyright (C) 2003-2004  BMP development team.
- *
- *  Based on XMMS:
- *  Copyright (C) 1998-2003  XMMS development team.
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "cdaudio.h"
-
-#include <glib.h>
-#include <audacious/i18n.h>
-#include <glib/gprintf.h>
-#include <string.h>
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-#include <audacious/configdb.h>
-#include <audacious/titlestring.h>
-
-
-#define GET_TB(b) gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(b))
-#define SET_TB(b) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b), TRUE)
-
-struct driveconfig {
-    GtkWidget *device, *directory;
-    GtkWidget *mixer_oss, *mixer_drive;
-    GtkWidget *remove_button;
-    GtkWidget *dae;
-};
-
-static GList *drives;
-
-static GtkWidget *cdda_configure_win;
-static GtkWidget *cdi_name, *cdi_name_override;
-static GtkWidget *cdi_use_cddb, *cdi_cddb_server;
-
-void cdda_cddb_show_server_dialog(GtkWidget * w, gpointer data);
-void cdda_cddb_show_network_window(GtkWidget * w, gpointer data);
-void cdda_cddb_set_server(const char *new_server);
-
-static GtkWidget *configurewin_add_drive(struct driveinfo *drive,
-                                         gpointer nb);
-
-static void
-cdda_configurewin_ok_cb(GtkWidget * w, gpointer data)
-{
-    ConfigDb *db;
-    struct driveinfo *drive;
-    GList *node;
-    gint olddrives, ndrives, i;
-
-    olddrives = g_list_length(cdda_cfg.drives);
-    for (node = cdda_cfg.drives; node; node = node->next) {
-        drive = node->data;
-        g_free(drive->device);
-        g_free(drive->directory);
-        g_free(drive);
-    }
-    g_list_free(cdda_cfg.drives);
-    cdda_cfg.drives = NULL;
-
-    for (node = drives; node; node = node->next) {
-        struct driveconfig *config = node->data;
-        const gchar *tmp;
-
-        drive = g_new0(struct driveinfo, 1);
-        drive->device =
-            g_strdup(gtk_entry_get_text(GTK_ENTRY(config->device)));
-
-        tmp = gtk_entry_get_text(GTK_ENTRY(config->directory));
-//              if (strlen(tmp) < 2 || tmp[strlen(tmp) - 1] == '/')
-        drive->directory = g_strdup(tmp);
-//              else
-//                      drive->directory = g_strconcat(tmp, "/", NULL);
-
-//              drive->directory = "CD_AUDIO";
-
-        if (GET_TB(config->mixer_oss))
-            drive->mixer = CDDA_MIXER_OSS;
-        else if (GET_TB(config->mixer_drive))
-            drive->mixer = CDDA_MIXER_DRIVE;
-        else
-            drive->mixer = CDDA_MIXER_NONE;
-        if (GET_TB(config->dae))
-            drive->dae = CDDA_READ_DAE;
-        else
-            drive->dae = CDDA_READ_ANALOG;
-
-        cdda_cfg.drives = g_list_append(cdda_cfg.drives, drive);
-    }
-
-    cdda_cfg.title_override = GET_TB(cdi_name_override);
-    g_free(cdda_cfg.name_format);
-    cdda_cfg.name_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(cdi_name)));
-
-    cdda_cfg.use_cddb = GET_TB(cdi_use_cddb);
-    cdda_cddb_set_server(gtk_entry_get_text(GTK_ENTRY(cdi_cddb_server)));
-
-    db = bmp_cfg_db_open();
-
-    drive = cdda_cfg.drives->data;
-    bmp_cfg_db_set_string(db, "CDDA", "device", drive->device);
-    bmp_cfg_db_set_string(db, "CDDA", "directory", drive->directory);
-    bmp_cfg_db_set_int(db, "CDDA", "mixer", drive->mixer);
-    bmp_cfg_db_set_int(db, "CDDA", "readmode", drive->dae);
-
-/*  	bmp_cfg_db_set_bool(db, "CDDA", "use_oss_mixer", cdda_cfg.use_oss_mixer); */
-
-    for (node = cdda_cfg.drives->next, i = 1; node; node = node->next, i++) {
-        char label[20];
-        drive = node->data;
-
-        sprintf(label, "device%d", i);
-        bmp_cfg_db_set_string(db, "CDDA", label, drive->device);
-
-        sprintf(label, "directory%d", i);
-        bmp_cfg_db_set_string(db, "CDDA", label, drive->directory);
-
-        sprintf(label, "mixer%d", i);
-        bmp_cfg_db_set_int(db, "CDDA", label, drive->mixer);
-
-        sprintf(label, "readmode%d", i);
-        bmp_cfg_db_set_int(db, "CDDA", label, drive->dae);
-    }
-
-    ndrives = g_list_length(cdda_cfg.drives);
-
-    for (i = ndrives; i < olddrives; i++)
-        /* FIXME: Clear old entries */ ;
-
-    bmp_cfg_db_set_int(db, "CDDA", "num_drives", ndrives);
-
-    bmp_cfg_db_set_bool(db, "CDDA", "title_override",
-                        cdda_cfg.title_override);
-    bmp_cfg_db_set_string(db, "CDDA", "name_format", cdda_cfg.name_format);
-    bmp_cfg_db_set_bool(db, "CDDA", "use_cddb", cdda_cfg.use_cddb);
-    bmp_cfg_db_set_string(db, "CDDA", "cddb_server", cdda_cfg.cddb_server);
-    bmp_cfg_db_set_int(db, "CDDA", "cddb_protocol_level",
-                       cdda_cfg.cddb_protocol_level);
-    bmp_cfg_db_close(db);
-}
-
-static void
-configurewin_close(GtkButton * w, gpointer data)
-{
-    GList *node;
-
-    for (node = drives; node; node = node->next)
-        g_free(node->data);
-    g_list_free(drives);
-    drives = NULL;
-
-    gtk_widget_destroy(cdda_configure_win);
-}
-
-static void
-toggle_set_sensitive_cb(GtkToggleButton * w, gpointer data)
-{
-    gboolean set = gtk_toggle_button_get_active(w);
-    gtk_widget_set_sensitive(GTK_WIDGET(data), set);
-}
-
-static void
-configurewin_add_page(GtkButton * w, gpointer data)
-{
-    GtkNotebook *nb = GTK_NOTEBOOK(data);
-    GtkWidget *box = configurewin_add_drive(NULL, nb);
-    gchar *label = g_strdup_printf(_("Drive %d"), g_list_length(drives));
-
-    gtk_widget_show_all(box);
-    gtk_notebook_append_page(GTK_NOTEBOOK(nb), box, gtk_label_new(label));
-    g_free(label);
-}
-
-static void
-redo_nb_labels(GtkNotebook * nb)
-{
-    gint i;
-    GtkWidget *child;
-
-    for (i = 0; (child = gtk_notebook_get_nth_page(nb, i)) != NULL; i++) {
-        gchar *label = g_strdup_printf(_("Drive %d"), i + 1);
-
-        gtk_notebook_set_tab_label_text(nb, child, label);
-        g_free(label);
-    }
-}
-
-
-static void
-configurewin_remove_page(GtkButton * w, gpointer data)
-{
-    GList *node;
-    GtkNotebook *nb = GTK_NOTEBOOK(data);
-    gtk_notebook_remove_page(nb, gtk_notebook_get_current_page(nb));
-    for (node = drives; node; node = node->next) {
-        struct driveconfig *drive = node->data;
-
-        if (GTK_WIDGET(w) == drive->remove_button) {
-            if (node->next)
-                redo_nb_labels(nb);
-            drives = g_list_remove(drives, drive);
-            g_free(drive);
-            break;
-        }
-    }
-    if (g_list_length(drives) == 1) {
-        struct driveconfig *drive = drives->data;
-        gtk_widget_set_sensitive(drive->remove_button, FALSE);
-    }
-}
-
-
-static void
-configurewin_check_drive(GtkButton * w, gpointer data)
-{
-    struct driveconfig *drive = data;
-    GtkWidget *window, *vbox, *label, *bbox, *closeb;
-    const gchar *device, *directory;
-    gint fd, dae_track = -1;
-    GString *str = g_string_new("");
-    struct stat stbuf;
-
-    device = gtk_entry_get_text(GTK_ENTRY(drive->device));
-    directory = gtk_entry_get_text(GTK_ENTRY(drive->directory));
-
-    if ((fd = open(device, CDOPENFLAGS) < 0))
-        g_string_sprintfa(str, _("Failed to open device %s\n"
-                                 "Error: %s\n\n"), device, strerror(errno));
-    else {
-        cdda_disc_toc_t toc;
-        close(fd);
-        if (!cdda_get_toc(&toc, device))
-            g_string_append(str,
-                            _("Failed to read \"Table of Contents\""
-                              "\nMaybe no disc in the drive?\n\n"));
-        else {
-            gint i, data = 0;
-            g_string_sprintfa(str, _("Device %s OK.\n"
-                                     "Disc has %d tracks"), device,
-                              toc.last_track - toc.first_track + 1);
-            for (i = toc.first_track; i <= toc.last_track; i++)
-                if (toc.track[i].flags.data_track)
-                    data++;
-                else if (dae_track < 0)
-                    dae_track = i;
-            if (data > 0)
-                g_string_sprintfa(str, _(" (%d data tracks)"), data);
-            g_string_sprintfa(str, _("\nTotal length: %d:%d\n"),
-                              toc.leadout.minute, toc.leadout.second);
-#ifdef CDDA_HAS_READAUDIO
-            if (dae_track == -1)
-                g_string_sprintfa(str,
-                                  _("Digital audio extraction "
-                                    "not tested as the disc has "
-                                    "no audio tracks\n"));
-            else {
-                gint fd = open(device, CDOPENFLAGS);
-                gint start, end, fr;
-                gchar buffer[CD_FRAMESIZE_RAW];
-                start = LBA(toc.track[dae_track]);
-
-                if (dae_track == toc.last_track)
-                    end = LBA(toc.leadout);
-                else
-                    end = LBA(toc.track[dae_track + 1]);
-                fr = read_audio_data(fd, start + (end - start) / 2,
-                                     1, buffer);
-                if (fr > 0)
-                    g_string_sprintfa(str,
-                                      _("Digital audio extraction "
-                                        "test: OK\n\n"));
-                else
-                    g_string_sprintfa(str,
-                                      _("Digital audio extraction "
-                                        "test failed: %s\n\n"),
-                                      strerror(-fr));
-            }
-#else
-            g_string_sprintfa(str, "\n");
-#endif
-        }
-    }
-    if (stat(directory, &stbuf) < 0) {
-        g_string_sprintfa(str, _("Failed to check directory %s\n"
-                                 "Error: %s"), directory, strerror(errno));
-    }
-    else {
-        if (!S_ISDIR(stbuf.st_mode))
-            g_string_sprintfa(str,
-                              _("Error: %s exist, but is not a directory"),
-                              directory);
-        else
-            g_string_sprintfa(str, _("Directory %s OK."), directory);
-    }
-
-
-    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-    gtk_window_set_transient_for(GTK_WINDOW(window),
-                                 GTK_WINDOW(cdda_configure_win));
-    gtk_container_set_border_width(GTK_CONTAINER(window), 10);
-    vbox = gtk_vbox_new(FALSE, 10);
-    gtk_container_add(GTK_CONTAINER(window), vbox);
-    label = gtk_label_new(str->str);
-    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
-    gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
-
-    bbox = gtk_hbutton_box_new();
-    gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
-    gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
-    gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
-
-    closeb = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-    GTK_WIDGET_SET_FLAGS(closeb, GTK_CAN_DEFAULT);
-    g_signal_connect_swapped(G_OBJECT(closeb), "clicked",
-                             G_CALLBACK(gtk_widget_destroy),
-                             GTK_OBJECT(window));
-    gtk_box_pack_start(GTK_BOX(bbox), closeb, TRUE, TRUE, 0);
-    gtk_widget_grab_default(closeb);
-
-    g_string_free(str, TRUE);
-
-    gtk_widget_show_all(window);
-}
-
-static GtkWidget *
-configurewin_add_drive(struct driveinfo *drive, gpointer nb)
-{
-    GtkWidget *vbox, *bbox, *dev_frame, *dev_table, *dev_label;
-    GtkWidget *dev_dir_label, *check_btn;
-    GtkWidget *volume_frame, *volume_box, *volume_none;
-    GtkWidget *readmode_frame, *readmode_box, *readmode_analog;
-    struct driveconfig *d = g_new0(struct driveconfig, 1);
-
-    vbox = gtk_vbox_new(FALSE, 5);
-    gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
-
-    dev_frame = gtk_frame_new(_("Device:"));
-    gtk_box_pack_start(GTK_BOX(vbox), dev_frame, FALSE, FALSE, 0);
-    dev_table = gtk_table_new(2, 2, FALSE);
-    gtk_container_set_border_width(GTK_CONTAINER(dev_table), 5);
-    gtk_container_add(GTK_CONTAINER(dev_frame), dev_table);
-    gtk_table_set_row_spacings(GTK_TABLE(dev_table), 5);
-    gtk_table_set_col_spacings(GTK_TABLE(dev_table), 5);
-
-    dev_label = gtk_label_new_with_mnemonic(_("_Device:"));
-    gtk_misc_set_alignment(GTK_MISC(dev_label), 1.0, 0.5);
-    gtk_table_attach(GTK_TABLE(dev_table), dev_label, 0, 1, 0, 1,
-                     GTK_FILL, 0, 0, 0);
-
-    d->device = gtk_entry_new();
-    gtk_label_set_mnemonic_widget(GTK_LABEL(dev_label), d->device);
-    gtk_table_attach(GTK_TABLE(dev_table), d->device, 1, 2, 0, 1,
-                     GTK_FILL | GTK_EXPAND, 0, 0, 0);
-
-    dev_dir_label = gtk_label_new_with_mnemonic(_("Dir_ectory:"));
-    gtk_misc_set_alignment(GTK_MISC(dev_dir_label), 1.0, 0.5);
-    gtk_table_attach(GTK_TABLE(dev_table), dev_dir_label, 0, 1, 1, 2,
-                     GTK_FILL, 0, 0, 0);
-
-
-    d->directory = gtk_entry_new();
-    gtk_label_set_mnemonic_widget(GTK_LABEL(dev_dir_label), d->directory);
-    gtk_table_attach(GTK_TABLE(dev_table), d->directory, 1, 2, 1, 2,
-                     GTK_FILL | GTK_EXPAND, 0, 0, 0);
-
-
-    readmode_frame = gtk_frame_new(_("Play mode:"));
-    gtk_box_pack_start(GTK_BOX(vbox), readmode_frame, FALSE, FALSE, 0);
-
-    readmode_box = gtk_vbox_new(5, FALSE);
-    gtk_container_add(GTK_CONTAINER(readmode_frame), readmode_box);
-
-    readmode_analog = gtk_radio_button_new_with_label(NULL, _("Analog"));
-    gtk_box_pack_start(GTK_BOX(readmode_box), readmode_analog, FALSE,
-                       FALSE, 0);
-
-    d->dae =
-        gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON
-                                                    (readmode_analog),
-                                                    _
-                                                    ("Digital audio extraction"));
-    gtk_box_pack_start(GTK_BOX(readmode_box), d->dae, FALSE, FALSE, 0);
-#ifndef CDDA_HAS_READAUDIO
-    gtk_widget_set_sensitive(readmode_frame, FALSE);
-#endif
-
-    /*
-     * Volume config
-     */
-
-    volume_frame = gtk_frame_new(_("Volume control:"));
-    gtk_box_pack_start(GTK_BOX(vbox), volume_frame, FALSE, FALSE, 0);
-
-    volume_box = gtk_vbox_new(5, FALSE);
-    gtk_container_add(GTK_CONTAINER(volume_frame), volume_box);
-
-    volume_none = gtk_radio_button_new_with_label(NULL, _("No mixer"));
-    gtk_box_pack_start(GTK_BOX(volume_box), volume_none, FALSE, FALSE, 0);
-
-    d->mixer_drive =
-        gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON
-                                                    (volume_none),
-                                                    _("CDROM drive"));
-    gtk_box_pack_start(GTK_BOX(volume_box), d->mixer_drive, FALSE, FALSE, 0);
-
-    d->mixer_oss =
-        gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON
-                                                    (volume_none),
-                                                    _("OSS mixer"));
-    gtk_box_pack_start(GTK_BOX(volume_box), d->mixer_oss, FALSE, FALSE, 0);
-
-    g_signal_connect(G_OBJECT(readmode_analog), "toggled",
-                     G_CALLBACK(toggle_set_sensitive_cb), volume_frame);
-#ifndef HAVE_OSS
-    gtk_widget_set_sensitive(d->mixer_oss, FALSE);
-#endif
-    if (drive) {
-        gtk_entry_set_text(GTK_ENTRY(d->device), drive->device);
-        gtk_entry_set_text(GTK_ENTRY(d->directory), drive->directory);
-        if (drive->mixer == CDDA_MIXER_DRIVE)
-            SET_TB(d->mixer_drive);
-        else if (drive->mixer == CDDA_MIXER_OSS)
-            SET_TB(d->mixer_oss);
-        if (drive->dae == CDDA_READ_DAE)
-            SET_TB(d->dae);
-    }
-
-    bbox = gtk_hbutton_box_new();
-    gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
-    gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
-
-    check_btn = gtk_button_new_with_label(_("Check drive..."));
-    GTK_WIDGET_SET_FLAGS(check_btn, GTK_CAN_DEFAULT);
-    gtk_box_pack_start_defaults(GTK_BOX(bbox), check_btn);
-    g_signal_connect(G_OBJECT(check_btn), "clicked",
-                     G_CALLBACK(configurewin_check_drive), d);
-
-    d->remove_button = gtk_button_new_with_label(_("Remove drive"));
-    GTK_WIDGET_SET_FLAGS(d->remove_button, GTK_CAN_DEFAULT);
-    gtk_box_pack_start_defaults(GTK_BOX(bbox), d->remove_button);
-    g_signal_connect(G_OBJECT(d->remove_button), "clicked",
-                     G_CALLBACK(configurewin_remove_page), nb);
-
-
-    if (drives == NULL)
-        gtk_widget_set_sensitive(d->remove_button, FALSE);
-    else {
-        struct driveconfig *tmp = drives->data;
-        gtk_widget_set_sensitive(tmp->remove_button, TRUE);
-    }
-
-    drives = g_list_append(drives, d);
-
-    return vbox;
-}
-
-void
-cdda_configure(void)
-{
-    GtkWidget *vbox, *notebook;
-    GtkWidget *dev_vbox, *dev_notebook, *add_drive, *add_bbox;
-    GtkWidget *cdi_vbox;
-    GtkWidget *cdi_cddb_frame, *cdi_cddb_vbox, *cdi_cddb_hbox;
-    GtkWidget *cdi_cddb_server_hbox, *cdi_cddb_server_label;
-    GtkWidget *cdi_cddb_server_list, *cdi_cddb_debug_win;
-    GtkWidget *cdi_name_frame, *cdi_name_vbox, *cdi_name_hbox;
-    GtkWidget *cdi_name_label, *cdi_desc;
-    GtkWidget *cdi_name_enable_vbox;
-    GtkWidget *bbox, *ok, *cancel;
-
-    GList *node;
-    gint i = 1;
-
-    if (cdda_configure_win)
-        return;
-
-    cdda_configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-    g_signal_connect(G_OBJECT(cdda_configure_win), "destroy",
-                     G_CALLBACK(gtk_widget_destroyed), &cdda_configure_win);
-    gtk_window_set_title(GTK_WINDOW(cdda_configure_win),
-                         _("CD Audio Player Configuration"));
-    gtk_window_set_type_hint(GTK_WINDOW(cdda_configure_win),
-                             GDK_WINDOW_TYPE_HINT_DIALOG);
-    gtk_window_set_resizable(GTK_WINDOW(cdda_configure_win), FALSE);
-    gtk_window_set_position(GTK_WINDOW(cdda_configure_win),
-                            GTK_WIN_POS_MOUSE);
-    gtk_container_border_width(GTK_CONTAINER(cdda_configure_win), 10);
-
-    vbox = gtk_vbox_new(FALSE, 10);
-    gtk_container_add(GTK_CONTAINER(cdda_configure_win), vbox);
-
-    notebook = gtk_notebook_new();
-    gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
-
-    /*
-     * Device config
-     */
-    dev_vbox = gtk_vbox_new(FALSE, 5);
-    gtk_container_set_border_width(GTK_CONTAINER(dev_vbox), 5);
-
-    dev_notebook = gtk_notebook_new();
-    gtk_notebook_set_scrollable(GTK_NOTEBOOK(dev_notebook), TRUE);
-    gtk_box_pack_start(GTK_BOX(dev_vbox), dev_notebook, FALSE, FALSE, 0);
-
-    for (node = cdda_cfg.drives; node; node = node->next) {
-        struct driveinfo *drive = node->data;
-        gchar *label = g_strdup_printf(_("Drive %d"), i++);
-        GtkWidget *w;
-
-        w = configurewin_add_drive(drive, dev_notebook);
-        gtk_notebook_append_page(GTK_NOTEBOOK(dev_notebook), w,
-                                 gtk_label_new(label));
-        g_free(label);
-
-    }
-
-    add_bbox = gtk_hbutton_box_new();
-    gtk_box_pack_start(GTK_BOX(dev_vbox), add_bbox, FALSE, FALSE, 0);
-    add_drive = gtk_button_new_with_label(_("Add drive"));
-    g_signal_connect(G_OBJECT(add_drive), "clicked",
-                     G_CALLBACK(configurewin_add_page), dev_notebook);
-    GTK_WIDGET_SET_FLAGS(add_drive, GTK_CAN_DEFAULT);
-    gtk_box_pack_start(GTK_BOX(add_bbox), add_drive, FALSE, FALSE, 0);
-
-
-    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dev_vbox,
-                             gtk_label_new(_("Device")));
-
-    /*
-     * CD Info config
-     */
-    cdi_vbox = gtk_vbox_new(FALSE, 5);
-    gtk_container_set_border_width(GTK_CONTAINER(cdi_vbox), 5);
-
-
-    /* CDDB */
-    cdi_cddb_frame = gtk_frame_new(_("CDDB:"));
-    gtk_box_pack_start(GTK_BOX(cdi_vbox), cdi_cddb_frame, FALSE, FALSE, 0);
-
-    cdi_cddb_vbox = gtk_vbox_new(FALSE, 10);
-    gtk_container_border_width(GTK_CONTAINER(cdi_cddb_vbox), 5);
-    gtk_container_add(GTK_CONTAINER(cdi_cddb_frame), cdi_cddb_vbox);
-
-    cdi_cddb_hbox = gtk_hbox_new(FALSE, 10);
-    gtk_container_border_width(GTK_CONTAINER(cdi_cddb_hbox), 0);
-    gtk_box_pack_start(GTK_BOX(cdi_cddb_vbox),
-                       cdi_cddb_hbox, FALSE, FALSE, 0);
-    cdi_use_cddb = gtk_check_button_new_with_label(_("Use CDDB"));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cdi_use_cddb),
-                                 cdda_cfg.use_cddb);
-    gtk_box_pack_start(GTK_BOX(cdi_cddb_hbox), cdi_use_cddb, FALSE, FALSE, 0);
-    cdi_cddb_server_list = gtk_button_new_with_label(_("Get server list"));
-    gtk_box_pack_end(GTK_BOX(cdi_cddb_hbox), cdi_cddb_server_list, FALSE,
-                     FALSE, 0);
-    cdi_cddb_debug_win = gtk_button_new_with_label(_("Show network window"));
-    g_signal_connect(G_OBJECT(cdi_cddb_debug_win), "clicked",
-                     G_CALLBACK(cdda_cddb_show_network_window), NULL);
-    gtk_box_pack_end(GTK_BOX(cdi_cddb_hbox), cdi_cddb_debug_win, FALSE,
-                     FALSE, 0);
-
-    cdi_cddb_server_hbox = gtk_hbox_new(FALSE, 5);
-    gtk_box_pack_start(GTK_BOX(cdi_cddb_vbox),
-                       cdi_cddb_server_hbox, FALSE, FALSE, 0);
-
-    cdi_cddb_server_label = gtk_label_new(_("CDDB server:"));
-    gtk_box_pack_start(GTK_BOX(cdi_cddb_server_hbox),
-                       cdi_cddb_server_label, FALSE, FALSE, 0);
-
-    cdi_cddb_server = gtk_entry_new();
-    gtk_entry_set_text(GTK_ENTRY(cdi_cddb_server), cdda_cfg.cddb_server);
-    gtk_box_pack_start(GTK_BOX(cdi_cddb_server_hbox), cdi_cddb_server,
-                       TRUE, TRUE, 0);
-    g_signal_connect(G_OBJECT(cdi_cddb_server_list), "clicked",
-                     G_CALLBACK(cdda_cddb_show_server_dialog),
-                     cdi_cddb_server);
-
-    /*
-     * Track names
-     */
-    cdi_name_frame = gtk_frame_new(_("Track names:"));
-    gtk_box_pack_start(GTK_BOX(cdi_vbox), cdi_name_frame, FALSE, FALSE, 0);
-
-    cdi_name_vbox = gtk_vbox_new(FALSE, 10);
-    gtk_container_add(GTK_CONTAINER(cdi_name_frame), cdi_name_vbox);
-    gtk_container_border_width(GTK_CONTAINER(cdi_name_vbox), 5);
-    cdi_name_override =
-        gtk_check_button_new_with_label(_("Override generic titles"));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cdi_name_override),
-                                 cdda_cfg.title_override);
-    gtk_box_pack_start(GTK_BOX(cdi_name_vbox), cdi_name_override, FALSE,
-                       FALSE, 0);
-
-    cdi_name_enable_vbox = gtk_vbox_new(FALSE, 10);
-    gtk_container_add(GTK_CONTAINER(cdi_name_vbox), cdi_name_enable_vbox);
-    gtk_widget_set_sensitive(cdi_name_enable_vbox, cdda_cfg.title_override);
-    g_signal_connect(G_OBJECT(cdi_name_override), "toggled",
-                     G_CALLBACK(toggle_set_sensitive_cb),
-                     cdi_name_enable_vbox);
-
-    cdi_name_hbox = gtk_hbox_new(FALSE, 5);
-    gtk_box_pack_start(GTK_BOX(cdi_name_enable_vbox), cdi_name_hbox, FALSE,
-                       FALSE, 0);
-    cdi_name_label = gtk_label_new(_("Name format:"));
-    gtk_box_pack_start(GTK_BOX(cdi_name_hbox), cdi_name_label, FALSE,
-                       FALSE, 0);
-    cdi_name = gtk_entry_new();
-    gtk_entry_set_text(GTK_ENTRY(cdi_name), cdda_cfg.name_format);
-    gtk_box_pack_start(GTK_BOX(cdi_name_hbox), cdi_name, TRUE, TRUE, 0);
-
-    cdi_desc = xmms_titlestring_descriptions("patn", 2);
-    gtk_box_pack_start(GTK_BOX(cdi_name_enable_vbox), cdi_desc, FALSE,
-                       FALSE, 0);
-
-    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), cdi_vbox,
-                             gtk_label_new(_("CD Info")));
-
-    bbox = gtk_hbutton_box_new();
-    gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
-    gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
-    gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
-
-
-    cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
-    g_signal_connect(G_OBJECT(cancel), "clicked",
-                     G_CALLBACK(configurewin_close), NULL);
-    GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
-    gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
-
-    ok = gtk_button_new_from_stock(GTK_STOCK_OK);
-    g_signal_connect(G_OBJECT(ok), "clicked",
-                     G_CALLBACK(cdda_configurewin_ok_cb), NULL);
-    g_signal_connect(G_OBJECT(ok), "clicked",
-                     G_CALLBACK(configurewin_close), NULL);
-    GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
-    gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
-    gtk_widget_grab_default(ok);
-
-
-    gtk_widget_show_all(cdda_configure_win);
-}
--- a/src/cdaudio/http.c	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
- *  http.c
- *  Some simple routines for connecting to a remote tcp socket
- *  Copyright 1999 Håvard Kvålen <havardk@sol.no>
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/* FIXME: We need to have *one* place in xmms where you configure proxies */
-
-#include "http.h"
-
-gint
-http_open_connection(const gchar * server, gint port)
-{
-    gint sock;
-#ifdef USE_IPV6
-    struct addrinfo hints, *res, *res0;
-    char service[6];
-#else
-    struct hostent *host;
-    struct sockaddr_in address;
-#endif
-
-#ifdef USE_IPV6
-    snprintf(service, 6, "%d", port);
-    memset(&hints, 0, sizeof(hints));
-    hints.ai_socktype = SOCK_STREAM;
-
-    if (getaddrinfo(server, service, &hints, &res0))
-        return 0;
-
-    for (res = res0; res; res = res->ai_next) {
-        sock = socket (res->ai_family, res->ai_socktype, res->ai_protocol);
-        if (sock < 0) {
-            if (res->ai_next)
-                continue;
-            else {
-                freeaddrinfo(res0);
-                return 0;
-            }
-        }
-        if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) {
-            if (res->ai_next) {
-                close(sock);
-                continue;
-            } else {
-                freeaddrinfo(res0);
-                return 0;
-            }
-        }
-        freeaddrinfo(res0);
-        return sock;
-    }
-#else
-    sock = socket(AF_INET, SOCK_STREAM, 0);
-    address.sin_family = AF_INET;
-
-    if (!(host = gethostbyname(server)))
-        return 0;
-
-    memcpy(&address.sin_addr.s_addr, *(host->h_addr_list),
-           sizeof(address.sin_addr.s_addr));
-    address.sin_port = g_htons(port);
-
-    if (connect
-        (sock, (struct sockaddr *) &address,
-         sizeof(struct sockaddr_in)) == -1)
-        return 0;
-#endif
-
-    return sock;
-}
-
-void
-http_close_connection(gint sock)
-{
-    shutdown(sock, 2);
-    close(sock);
-}
-
-gint
-http_read_line(gint sock, gchar * buf, gint size)
-{
-    gint i = 0;
-
-    while (i < size - 1) {
-        if (read(sock, buf + i, 1) <= 0) {
-            if (i == 0)
-                return -1;
-            else
-                break;
-        }
-        if (buf[i] == '\n')
-            break;
-        if (buf[i] != '\r')
-            i++;
-    }
-    buf[i] = '\0';
-    return i;
-}
-
-gint
-http_read_first_line(gint sock, gchar * buf, gint size)
-{
-    /* Skips the HTTP-header, if there is one, and reads the first line into buf.
-       Returns number of bytes read. */
-
-    gint i;
-    /* Skip the HTTP-header */
-    if ((i = http_read_line(sock, buf, size)) < 0)
-        return -1;
-    if (!strncmp(buf, "HTTP", 4)) { /* Check to make sure its not HTTP/0.9 */
-        while (http_read_line(sock, buf, size) > 0)
-            /* nothing */ ;
-        if ((i = http_read_line(sock, buf, size)) < 0)
-            return -1;
-    }
-
-    return i;
-}
-
-gchar *
-http_get(gchar * url)
-{
-    gchar *server, *getstr, *buf = NULL, *bptr;
-    gchar *gs, *gc, *turl = url;
-    gint sock, n, bsize, port = 0;
-
-    /* Skip past ``http://'' part of URL */
-    if (!strncmp(turl, "http:", 5)) {
-        turl += 5;
-        if (!strncmp(turl, "//", 2))
-            turl += 2;
-    }
-
-    /* If path starts with a '/', we are referring to localhost */
-    if (turl[0] == '/')
-        server = "localhost";
-    else
-        server = turl;
-
-    /* Check if URL contains port specification */
-    gc = strchr(turl, ':');
-    gs = strchr(turl, '/');
-
-    if (gc != NULL && gc < gs) {
-        port = atoi(gc + 1);
-        *gc = '\0';
-    }
-    if (port == 0)
-        port = 80;
-
-    /* Make sure that server string is null terminated. */
-    if (gs)
-        *gs = '\0';
-
-
-    /*
-     * Now, open connection to server.
-     */
-    sock = http_open_connection(server, port);
-
-    /* Repair the URL string that we broke earlier on */
-    if (gs)
-        *gs = '/';
-    if (gc && gc == '\0')
-        *gc = ':';
-
-    if (sock == 0)
-        return NULL;
-
-    /*
-     * Send query to socket.
-     */
-    getstr = g_strdup_printf("GET %s HTTP/1.0\r\n\r\n", gs ? gs : "/");
-/*  	getstr = g_strdup_printf("GET %s HTTP/1.0\r\n\r\n", url ? url : "/"); */
-
-    if (write(sock, getstr, strlen(getstr)) == -1) {
-        http_close_connection(sock);
-        return NULL;
-    }
-
-    /*
-     * Start receiving result.
-     */
-    bsize = 4096;
-    bptr = buf = g_malloc(bsize);
-
-    if ((n = http_read_first_line(sock, bptr, bsize)) == -1) {
-        g_free(buf);
-        buf = NULL;
-        goto Done;
-    }
-
-    bsize -= n;
-    bptr += n;
-
-    while (bsize > 0 && (n = http_read_line(sock, bptr, bsize)) != -1) {
-        bptr += n;
-        bsize -= n;
-    }
-
-  Done:
-    http_close_connection(sock);
-
-    /*
-     * Return result buffer to caller.
-     */
-    return buf;
-}
--- a/src/cdaudio/http.h	Fri Jul 27 16:20:08 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- *  Copyright 1999 Håvard Kvålen <havardk@sol.no>
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef XMMS_HTTP_H
-#define XMMS_HTTP_H
-
-#include "config.h"
-#include <glib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <netdb.h>
-#include <stdlib.h>
-
-
-gint http_open_connection(const gchar * server, gint port);
-void http_close_connection(gint sock);
-gint http_read_line(gint sock, gchar * buf, gint size);
-gint http_read_first_line(gint sock, gchar * buf, gint size);
-gchar *http_get(gchar * url);
-
-#endif
--- a/src/cue/cuesheet.c	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/cue/cuesheet.c	Fri Jul 27 16:20:15 2007 -0500
@@ -35,7 +35,6 @@
 
 #define MAX_CUE_LINE_LENGTH 1000
 #define MAX_CUE_TRACKS 1000
-#define TRANSITION_GUARD_TIME 500000
 
 static void cache_cue_file(gchar *f);
 static void free_cue_info(void);
@@ -80,6 +79,8 @@
 
 static gint last_cue_track = 0;
 static gint cur_cue_track = 0;
+static gint target_time = 0;
+static GMutex *cue_target_time_mutex;
 
 static struct {
 	gchar *title;
@@ -131,6 +132,7 @@
     cue_cond = g_cond_new();
     cue_block_mutex = g_mutex_new();
     cue_block_cond = g_cond_new();
+    cue_target_time_mutex = g_mutex_new();
 
     /* create watchdog thread */
     g_mutex_lock(cue_mutex);
@@ -155,6 +157,7 @@
     g_mutex_free(cue_mutex);
     g_cond_free(cue_block_cond);
     g_mutex_free(cue_block_mutex);
+    g_mutex_free(cue_target_time_mutex);
 }
 
 static int is_our_file(gchar *filename)
@@ -319,12 +322,18 @@
 
 static void seek(InputPlayback * data, gint time)
 {
+    g_mutex_lock(cue_target_time_mutex);
+    target_time = time * 1000;
+    g_mutex_unlock(cue_target_time_mutex);
+
 #ifdef DEBUG
     g_print("seek: playback = %p\n", data);
+    g_print("cue: seek: target_time = %d\n", target_time);
 #endif
 
-	if (real_ip != NULL)
+	if (real_ip != NULL) {
 		real_ip->plugin->seek(real_ip, time);
+    }
 }
 
 static void stop(InputPlayback * data)
@@ -410,15 +419,13 @@
 #ifdef DEBUG
     g_print("do_setpos: pos = %d\n\n", pos);
 #endif
+
+    if (!playlist)
+        return FALSE;
+
     /* being done from the main loop thread, does not require locks */
     playlist_set_position(playlist, (guint)pos);
 
-    /* kick watchdog */
-    g_mutex_lock(cue_mutex);
-    watchdog_state = RUN;
-    g_mutex_unlock(cue_mutex);
-    g_cond_signal(cue_cond);
-
     return FALSE; //one-shot
 }
 
@@ -501,21 +508,29 @@
 		real_ip->data = data->data;
 
 		real_play_thread = g_thread_create((GThreadFunc)(real_ip->plugin->play_file), (gpointer)real_ip, TRUE, NULL);
-		g_usleep(10000); // wait for 10msec while real input plugin is initializing.
+		g_usleep(50000); // wait for 50msec while real input plugin is initializing.
 
 		if(real_ip->plugin->mseek) {
+#ifdef DEBUG
+            g_print("mseek\n");
+#endif
 			real_ip->plugin->mseek(real_ip, finetune_seek ? finetune_seek : cue_tracks[track].index);
 		}
 		else
 			real_ip->plugin->seek(real_ip, finetune_seek ? finetune_seek / 1000 : cue_tracks[track].index / 1000 + 1);
 
+        g_mutex_lock(cue_target_time_mutex);
+        target_time = finetune_seek ? finetune_seek : cue_tracks[track].index;
+        g_mutex_unlock(cue_target_time_mutex);
+#ifdef DEBUG
+        g_print("cue: play_cue_uri: target_time = %d\n", target_time);
+#endif
 		/* in some plugins, NULL as 2nd arg causes crash. */
 		real_ip->plugin->get_song_info(cue_file, &dummy, &file_length);
 		g_free(dummy);
 		cue_tracks[last_cue_track].index = file_length;
 
         /* kick watchdog thread */
-        g_usleep(TRANSITION_GUARD_TIME);
         g_mutex_lock(cue_mutex);
         watchdog_state = RUN;
         g_mutex_unlock(cue_mutex);
@@ -573,7 +588,7 @@
 #endif
 #endif
         g_get_current_time(&sleep_time);
-        g_time_val_add(&sleep_time, 10000); // 10msec
+        g_time_val_add(&sleep_time, 10000); // interval is 10msec.
 
         g_mutex_lock(cue_mutex);
         switch(watchdog_state) {
@@ -606,10 +621,10 @@
         time = get_output_time();
 #if 0
 #ifdef DEBUG
-        printf("t = %d\n", time);
+        g_print("time = %d target_time = %d\n", time, target_time);
 #endif
 #endif
-        if(time == 0)
+        if(time == 0 || time <= target_time)
             continue;
 
         // prev track
@@ -628,12 +643,19 @@
                 incr = cur_cue_track - oldpos; // relative position
                 if (time >= cue_tracks[cur_cue_track].index)
                     finetune_seek = time;
+#ifdef DEBUG
+                g_print("cue: prev_track: time = %d cue_tracks[cur_cue_track].index = %d\n",
+                       time, cue_tracks[cur_cue_track].index);
+                g_print("cue: prev_track: finetune_seek = %d\n", finetune_seek);
+#endif
             }
 
-            g_mutex_lock(cue_mutex);
-            watchdog_state = STOP;
-            g_mutex_unlock(cue_mutex);
-
+            g_mutex_lock(cue_target_time_mutex);
+            target_time = finetune_seek ? finetune_seek : cue_tracks[cur_cue_track].index;
+            g_mutex_unlock(cue_target_time_mutex);
+#ifdef DEBUG
+            g_print("cue: prev_track: target_time = %d\n", target_time);
+#endif
             g_idle_add_full(G_PRIORITY_HIGH , do_setpos, &incr, NULL);
             continue;
         }
@@ -653,14 +675,21 @@
             while(time > cue_tracks[cur_cue_track + 1].index) {
                 cur_cue_track++;
                 incr = cur_cue_track - oldpos; // relative position
-                if (time <= cue_tracks[cur_cue_track].index)
+                if (time >= cue_tracks[cur_cue_track].index)
                     finetune_seek = time;
+#ifdef DEBUG
+                g_print("cue: next_track: time = %d cue_tracks[cur_cue_track].index = %d\n",
+                       time, cue_tracks[cur_cue_track].index);
+                g_print("cue: next_track: finetune_seek = %d\n", finetune_seek);
+#endif
             }
 
-            g_mutex_lock(cue_mutex);
-            watchdog_state = STOP;
-            g_mutex_unlock(cue_mutex);
-
+            g_mutex_lock(cue_target_time_mutex);
+            target_time = finetune_seek ? finetune_seek : cue_tracks[cur_cue_track].index;
+            g_mutex_unlock(cue_target_time_mutex);
+#ifdef DEBUG
+            g_print("cue: next_track: target_time = %d\n", target_time);
+#endif
             if(cfg.stopaftersong) {
                 g_idle_add_full(G_PRIORITY_HIGH, do_stop, (void *)real_ip, NULL);
                 continue;
@@ -681,10 +710,6 @@
 #ifdef DEBUG
                     g_print("i: watchdog eof reached\n\n");
 #endif
-                    g_mutex_lock(cue_mutex);
-                    watchdog_state = STOP;
-                    g_mutex_unlock(cue_mutex);
-
                     if(cfg.repeat) {
                         static gint incr = 0;
                         incr = -pos;
--- a/src/madplug/SFMT-alti.h	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/madplug/SFMT-alti.h	Fri Jul 27 16:20:15 2007 -0500
@@ -14,28 +14,143 @@
  * see LICENSE.txt
  */
 
-#include <altivec.h>
 #ifndef SFMT_ALTI_H
 #define SFMT_ALTI_H
 
-union W128_T {
-    vector unsigned int s;
-    uint32_t u[4];
-};
-
-typedef union W128_T w128_t;
-
-#ifdef __GNUC__
 inline static vector unsigned int vec_recursion(vector unsigned int a,
 						vector unsigned int b,
 						vector unsigned int c,
 						vector unsigned int d)
-    __attribute__((always_inline));
-#else
+    ALWAYSINLINE;
+
+/**
+ * This function represents the recursion formula in AltiVec and BIG ENDIAN.
+ * @param a a 128-bit part of the interal state array
+ * @param b a 128-bit part of the interal state array
+ * @param c a 128-bit part of the interal state array
+ * @param d a 128-bit part of the interal state array
+ * @return output
+ */
 inline static vector unsigned int vec_recursion(vector unsigned int a,
 						vector unsigned int b,
 						vector unsigned int c,
-						vector unsigned int d);
+						vector unsigned int d) {
+
+    const vector unsigned int sl1 = ALTI_SL1;
+    const vector unsigned int sr1 = ALTI_SR1;
+#ifdef ONLY64
+    const vector unsigned int mask = ALTI_MSK64;
+    const vector unsigned char perm_sl = ALTI_SL2_PERM64;
+    const vector unsigned char perm_sr = ALTI_SR2_PERM64;
+#else
+    const vector unsigned int mask = ALTI_MSK;
+    const vector unsigned char perm_sl = ALTI_SL2_PERM;
+    const vector unsigned char perm_sr = ALTI_SR2_PERM;
+#endif
+    vector unsigned int v, w, x, y, z;
+    x = vec_perm(a, (vector unsigned int)perm_sl, perm_sl);
+    v = a;
+    y = vec_sr(b, sr1);
+    z = vec_perm(c, (vector unsigned int)perm_sr, perm_sr);
+    w = vec_sl(d, sl1);
+    z = vec_xor(z, w);
+    y = vec_and(y, mask);
+    v = vec_xor(v, x);
+    z = vec_xor(z, y);
+    z = vec_xor(z, v);
+    return z;
+}
+
+/**
+ * This function fills the internal state array with pseudorandom
+ * integers.
+ */
+inline static void gen_rand_all(void) {
+    int i;
+    vector unsigned int r, r1, r2;
+
+    r1 = sfmt[N - 2].s;
+    r2 = sfmt[N - 1].s;
+    for (i = 0; i < N - POS1; i++) {
+	r = vec_recursion(sfmt[i].s, sfmt[i + POS1].s, r1, r2);
+	sfmt[i].s = r;
+	r1 = r2;
+	r2 = r;
+    }
+    for (; i < N; i++) {
+	r = vec_recursion(sfmt[i].s, sfmt[i + POS1 - N].s, r1, r2);
+	sfmt[i].s = r;
+	r1 = r2;
+	r2 = r;
+    }
+}
+
+/**
+ * This function fills the user-specified array with pseudorandom
+ * integers.
+ *
+ * @param array an 128-bit array to be filled by pseudorandom numbers.  
+ * @param size number of 128-bit pesudorandom numbers to be generated.
+ */
+inline static void gen_rand_array(w128_t *array, int size) {
+    int i, j;
+    vector unsigned int r, r1, r2;
+
+    r1 = sfmt[N - 2].s;
+    r2 = sfmt[N - 1].s;
+    for (i = 0; i < N - POS1; i++) {
+	r = vec_recursion(sfmt[i].s, sfmt[i + POS1].s, r1, r2);
+	array[i].s = r;
+	r1 = r2;
+	r2 = r;
+    }
+    for (; i < N; i++) {
+	r = vec_recursion(sfmt[i].s, array[i + POS1 - N].s, r1, r2);
+	array[i].s = r;
+	r1 = r2;
+	r2 = r;
+    }
+    /* main loop */
+    for (; i < size - N; i++) {
+	r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2);
+	array[i].s = r;
+	r1 = r2;
+	r2 = r;
+    }
+    for (j = 0; j < 2 * N - size; j++) {
+	sfmt[j].s = array[j + size - N].s;
+    }
+    for (; i < size; i++) {
+	r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2);
+	array[i].s = r;
+	sfmt[j++].s = r;
+	r1 = r2;
+	r2 = r;
+    }
+}
+
+#ifndef ONLY64
+#if defined(__APPLE__)
+#define ALTI_SWAP (vector unsigned char) \
+	(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11)
+#else
+#define ALTI_SWAP {4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11}
+#endif
+/**
+ * This function swaps high and low 32-bit of 64-bit integers in user
+ * specified array.
+ *
+ * @param array an 128-bit array to be swaped.
+ * @param size size of 128-bit array.
+ */
+inline static void swap(w128_t *array, int size) {
+    int i;
+    const vector unsigned char perm = ALTI_SWAP;
+
+    for (i = 0; i < size; i++) {
+	array[i].s = vec_perm(array[i].s, (vector unsigned int)perm, perm);
+    }
+}
 #endif
 
 #endif
--- a/src/madplug/SFMT-params.h	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/madplug/SFMT-params.h	Fri Jul 27 16:20:15 2007 -0500
@@ -1,3 +1,6 @@
+#ifndef SFMT_PARAMS_H
+#define SFMT_PARAMS_H
+
 #if !defined(MEXP)
 #ifdef __GNUC__
   #warning "MEXP is not defined. I assume MEXP is 19937."
@@ -79,6 +82,8 @@
   #include "SFMT-params86243.h"
 #elif MEXP == 132049
   #include "SFMT-params132049.h"
+#elif MEXP == 216091
+  #include "SFMT-params216091.h"
 #else
 #ifdef __GNUC__
   #error "MEXP is not valid."
@@ -88,3 +93,5 @@
 #endif
 
 #endif
+
+#endif /* SFMT_PARAMS_H */
--- a/src/madplug/SFMT-params19937.h	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/madplug/SFMT-params19937.h	Fri Jul 27 16:20:15 2007 -0500
@@ -1,3 +1,6 @@
+#ifndef SFMT_PARAMS19937_H
+#define SFMT_PARAMS19937_H
+
 #define POS1	122
 #define SL1	18
 #define SL2	1
@@ -11,12 +14,33 @@
 #define PARITY2	0x00000000U
 #define PARITY3	0x00000000U
 #define PARITY4	0x13c9e684U
-#define ALTI_SL2_PERM \
-(vector unsigned char){1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
-#define ALTI_SL2_PERM64 \
-(vector unsigned char){1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
-#define ALTI_SR2_PERM \
-(vector unsigned char){7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
-#define ALTI_SR2_PERM64 \
-(vector unsigned char){15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
+
+
+/* PARAMETERS FOR ALTIVEC */
+#if defined(__APPLE__)	/* For OSX */
+    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
+    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
+    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
+    #define ALTI_MSK64 \
+	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
+    #define ALTI_SL2_PERM \
+	(vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
+    #define ALTI_SL2_PERM64 \
+	(vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
+    #define ALTI_SR2_PERM \
+	(vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
+    #define ALTI_SR2_PERM64 \
+	(vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
+#else	/* For OTHER OSs(Linux?) */
+    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
+    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
+    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
+    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
+    #define ALTI_SL2_PERM	{1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
+    #define ALTI_SL2_PERM64	{1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
+    #define ALTI_SR2_PERM	{7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
+    #define ALTI_SR2_PERM64	{15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
+#endif	/* For OSX */
 #define IDSTR	"SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6"
+
+#endif /* SFMT_PARAMS19937_H */
--- a/src/madplug/SFMT-sse2.h	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/madplug/SFMT-sse2.h	Fri Jul 27 16:20:15 2007 -0500
@@ -1,36 +1,121 @@
 /** 
- * @file SFMT-sse2.h 
- *
- * @brief SIMD oriented Fast Mersenne Twister(SFMT)
- * pseudorandom number generator
+ * @file  SFMT-sse2.h
+ * @brief SIMD oriented Fast Mersenne Twister(SFMT) for Intel SSE2
  *
  * @author Mutsuo Saito (Hiroshima University)
  * @author Makoto Matsumoto (Hiroshima University)
  *
- * Copyright (C) 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
+ * @note We assume LITTLE ENDIAN in this file
+ *
+ * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
  * University. All rights reserved.
  *
- * The new BSD License is applied to this software.
- * see LICENSE.txt
+ * The new BSD License is applied to this software, see LICENSE.txt
  */
 
 #ifndef SFMT_SSE2_H
 #define SFMT_SSE2_H
-#include <emmintrin.h>
+
+inline static __m128i mm_recursion(__m128i *a, __m128i *b, __m128i c,
+				   __m128i d, __m128i mask) ALWAYSINLINE;
 
-union W128_T {
-    __m128i si;
-    uint32_t u[4];
-};
+/**
+ * This function represents the recursion formula.
+ * @param a a 128-bit part of the interal state array
+ * @param b a 128-bit part of the interal state array
+ * @param c a 128-bit part of the interal state array
+ * @param d a 128-bit part of the interal state array
+ * @param mask 128-bit mask
+ * @return output
+ */
+inline static __m128i mm_recursion(__m128i *a, __m128i *b, 
+				   __m128i c, __m128i d, __m128i mask) {
+    __m128i v, x, y, z;
+    
+    x = _mm_load_si128(a);
+    y = _mm_srli_epi32(*b, SR1);
+    z = _mm_srli_si128(c, SR2);
+    v = _mm_slli_epi32(d, SL1);
+    z = _mm_xor_si128(z, x);
+    z = _mm_xor_si128(z, v);
+    x = _mm_slli_si128(x, SL2);
+    y = _mm_and_si128(y, mask);
+    z = _mm_xor_si128(z, x);
+    z = _mm_xor_si128(z, y);
+    return z;
+}
 
-typedef union W128_T w128_t;
+/**
+ * This function fills the internal state array with pseudorandom
+ * integers.
+ */
+inline static void gen_rand_all(void) {
+    int i;
+    __m128i r, r1, r2, mask;
+    mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1);
 
-#ifdef __GNUC__
-inline static __m128i mm_recursion(__m128i *a, __m128i *b, __m128i c,
-				   __m128i d, __m128i mask)
-    __attribute__((always_inline));
-#else
-inline static __m128i mm_recursion(__m128i *a, __m128i *b,
-				   __m128i c, __m128i d, __m128i mask);
+    r1 = _mm_load_si128(&sfmt[N - 2].si);
+    r2 = _mm_load_si128(&sfmt[N - 1].si);
+    for (i = 0; i < N - POS1; i++) {
+	r = mm_recursion(&sfmt[i].si, &sfmt[i + POS1].si, r1, r2, mask);
+	_mm_store_si128(&sfmt[i].si, r);
+	r1 = r2;
+	r2 = r;
+    }
+    for (; i < N; i++) {
+	r = mm_recursion(&sfmt[i].si, &sfmt[i + POS1 - N].si, r1, r2, mask);
+	_mm_store_si128(&sfmt[i].si, r);
+	r1 = r2;
+	r2 = r;
+    }
+}
+
+/**
+ * This function fills the user-specified array with pseudorandom
+ * integers.
+ *
+ * @param array an 128-bit array to be filled by pseudorandom numbers.  
+ * @param size number of 128-bit pesudorandom numbers to be generated.
+ */
+inline static void gen_rand_array(w128_t *array, int size) {
+    int i, j;
+    __m128i r, r1, r2, mask;
+    mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1);
+
+    r1 = _mm_load_si128(&sfmt[N - 2].si);
+    r2 = _mm_load_si128(&sfmt[N - 1].si);
+    for (i = 0; i < N - POS1; i++) {
+	r = mm_recursion(&sfmt[i].si, &sfmt[i + POS1].si, r1, r2, mask);
+	_mm_store_si128(&array[i].si, r);
+	r1 = r2;
+	r2 = r;
+    }
+    for (; i < N; i++) {
+	r = mm_recursion(&sfmt[i].si, &array[i + POS1 - N].si, r1, r2, mask);
+	_mm_store_si128(&array[i].si, r);
+	r1 = r2;
+	r2 = r;
+    }
+    /* main loop */
+    for (; i < size - N; i++) {
+	r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2,
+			 mask);
+	_mm_store_si128(&array[i].si, r);
+	r1 = r2;
+	r2 = r;
+    }
+    for (j = 0; j < 2 * N - size; j++) {
+	r = _mm_load_si128(&array[j + size - N].si);
+	_mm_store_si128(&sfmt[j].si, r);
+    }
+    for (; i < size; i++) {
+	r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2,
+			 mask);
+	_mm_store_si128(&array[i].si, r);
+	_mm_store_si128(&sfmt[j++].si, r);
+	r1 = r2;
+	r2 = r;
+    }
+}
+
 #endif
-#endif
--- a/src/madplug/SFMT.c	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/madplug/SFMT.c	Fri Jul 27 16:20:15 2007 -0500
@@ -14,21 +14,51 @@
 #include <assert.h>
 #include "SFMT.h"
 #include "SFMT-params.h"
-#include "SFMT-params19937.h"
 
-#if defined(ALTIVEC)
-  #include "SFMT-alti.h"
-#elif defined(SSE2)
-  #include "SFMT-sse2.h"
+#if defined(__BIG_ENDIAN__) && !defined(__amd64) && !defined(BIG_ENDIAN64)
+#define BIG_ENDIAN64 1
+#endif
+#if defined(HAVE_ALTIVEC) && !defined(BIG_ENDIAN64)
+#define BIG_ENDIAN64 1
+#endif
+#if defined(ONLY64) && !defined(BIG_ENDIAN64)
+  #if defined(__GNUC__)
+    #error "-DONLY64 must be specified with -DBIG_ENDIAN64"
+  #endif
+#undef ONLY64
+#endif
+/*------------------------------------------------------
+  128-bit SIMD data type for Altivec, SSE2 or standard C
+  ------------------------------------------------------*/
+#if defined(HAVE_ALTIVEC)
+  #if !defined(__APPLE__)
+    #include <altivec.h>
+  #endif
+/** 128-bit data structure */
+union W128_T {
+    vector unsigned int s;
+    uint32_t u[4];
+};
+/** 128-bit data type */
+typedef union W128_T w128_t;
+
+#elif defined(HAVE_SSE2)
+  #include <emmintrin.h>
+
+/** 128-bit data structure */
+union W128_T {
+    __m128i si;
+    uint32_t u[4];
+};
+/** 128-bit data type */
+typedef union W128_T w128_t;
+
 #else
-/*------------------------------------------
-  128-bit SIMD like data type for standard C
-  ------------------------------------------*/
+
 /** 128-bit data structure */
 struct W128_T {
     uint32_t u[4];
 };
-
 /** 128-bit data type */
 typedef struct W128_T w128_t;
 
@@ -61,18 +91,18 @@
 inline static void rshift128(w128_t *out,  w128_t const *in, int shift);
 inline static void lshift128(w128_t *out,  w128_t const *in, int shift);
 inline static void gen_rand_all(void);
-inline static void gen_rand_array(w128_t array[], int size);
+inline static void gen_rand_array(w128_t *array, int size);
 inline static uint32_t func1(uint32_t x);
 inline static uint32_t func2(uint32_t x);
 static void period_certification(void);
 #if defined(BIG_ENDIAN64) && !defined(ONLY64)
-inline static void swap(w128_t array[], int size);
+inline static void swap(w128_t *array, int size);
 #endif
 
-#if defined(ALTIVEC)
-  #include "SFMT-alti.c"
-#elif defined(SSE2)
-  #include "SFMT-sse2.c"
+#if defined(HAVE_ALTIVEC)
+  #include "SFMT-alti.h"
+#elif defined(HAVE_SSE2)
+  #include "SFMT-sse2.h"
 #endif
 
 /**
@@ -211,7 +241,7 @@
 }
 #endif
 
-#if (!defined(ALTIVEC)) && (!defined(SSE2))
+#if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2))
 /**
  * This function fills the internal state array with pseudorandom
  * integers.
@@ -241,7 +271,7 @@
  * @param array an 128-bit array to be filled by pseudorandom numbers.  
  * @param size number of 128-bit pseudorandom numbers to be generated.
  */
-inline static void gen_rand_array(w128_t array[], int size) {
+inline static void gen_rand_array(w128_t *array, int size) {
     int i, j;
     w128_t *r1, *r2;
 
@@ -274,8 +304,8 @@
 }
 #endif
 
-#if defined(BIG_ENDIAN64) && !defined(ONLY64) && !defined(ALTIVEC)
-inline static void swap(w128_t array[], int size) {
+#if defined(BIG_ENDIAN64) && !defined(ONLY64) && !defined(HAVE_ALTIVEC)
+inline static void swap(w128_t *array, int size) {
     int i;
     uint32_t x, y;
 
@@ -317,13 +347,11 @@
     int i, j;
     uint32_t work;
 
-    for (i = 0; i < 4; i++) {
-	work = psfmt32[idxof(i)] & parity[i];
-	for (j = 0; j < 32; j++) {
-	    inner ^= work & 1;
-	    work = work >> 1;
-	}
-    }
+    for (i = 0; i < 4; i++)
+	inner ^= psfmt32[idxof(i)] & parity[i];
+    for (i = 16; i > 0; i >>= 1)
+	inner ^= inner >> i;
+    inner &= 1;
     /* check OK */
     if (inner == 1) {
 	return;
@@ -349,7 +377,7 @@
  * The string shows the word size, the Mersenne exponent,
  * and all parameters of this generator.
  */
-char *get_idstring(void) {
+const char *get_idstring(void) {
     return IDSTR;
 }
 
@@ -377,7 +405,7 @@
  * init_gen_rand or init_by_array must be called before this function.
  * @return 32-bit pseudorandom number
  */
-inline uint32_t gen_rand32(void) {
+uint32_t gen_rand32(void) {
     uint32_t r;
 
     assert(initialized);
@@ -396,7 +424,7 @@
  * unless an initialization is again executed. 
  * @return 64-bit pseudorandom number
  */
-inline uint64_t gen_rand64(void) {
+uint64_t gen_rand64(void) {
 #if defined(BIG_ENDIAN64) && !defined(ONLY64)
     uint32_t r1, r2;
 #else
@@ -448,7 +476,7 @@
  * memory. Mac OSX doesn't have these functions, but \b malloc of OSX
  * returns the pointer to the aligned memory block.
  */
-inline void fill_array32(uint32_t array[], int size) {
+void fill_array32(uint32_t *array, int size) {
     assert(initialized);
     assert(idx == N32);
     assert(size % 4 == 0);
@@ -484,7 +512,7 @@
  * memory. Mac OSX doesn't have these functions, but \b malloc of OSX
  * returns the pointer to the aligned memory block.
  */
-inline void fill_array64(uint64_t array[], int size) {
+void fill_array64(uint64_t *array, int size) {
     assert(initialized);
     assert(idx == N32);
     assert(size % 2 == 0);
@@ -524,7 +552,7 @@
  * @param init_key the array of 32-bit integers, used as a seed.
  * @param key_length the length of init_key.
  */
-void init_by_array(uint32_t init_key[], int key_length) {
+void init_by_array(uint32_t *init_key, int key_length) {
     int i, j, count;
     uint32_t r;
     int lag;
@@ -554,7 +582,7 @@
     r += key_length;
     psfmt32[idxof(mid + lag)] += r;
     psfmt32[idxof(0)] = r;
-    i = 1;
+
     count--;
     for (i = 1, j = 0; (j < count) && (j < key_length); j++) {
 	r = func1(psfmt32[idxof(i)] ^ psfmt32[idxof((i + mid) % N32)] 
--- a/src/madplug/SFMT.h	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/madplug/SFMT.h	Fri Jul 27 16:20:15 2007 -0500
@@ -35,10 +35,10 @@
 
 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
   #include <inttypes.h>
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) || defined(__BORLANDC__)
   typedef unsigned int uint32_t;
-  typedef unsigned long long uint64_t;
-  #define inline
+  typedef unsigned __int64 uint64_t;
+  #define inline __inline
 #else
   #include <inttypes.h>
   #if defined(__GNUC__)
@@ -47,7 +47,7 @@
 #endif
 
 #ifndef PRIu64
-  #if defined(_MSC_VER)
+  #if defined(_MSC_VER) || defined(__BORLANDC__)
     #define PRIu64 "I64u"
     #define PRIx64 "I64x"
   #else
@@ -56,13 +56,17 @@
   #endif
 #endif
 
-inline uint32_t gen_rand32(void);
-inline uint64_t gen_rand64(void);
-inline void fill_array32(uint32_t array[], int size);
-inline void fill_array64(uint64_t array[], int size);
+#if defined(__GNUC__)
+#define ALWAYSINLINE __attribute__((always_inline))
+#endif
+
+uint32_t gen_rand32(void);
+uint64_t gen_rand64(void);
+void fill_array32(uint32_t *array, int size);
+void fill_array64(uint64_t *array, int size);
 void init_gen_rand(uint32_t seed);
-void init_by_array(uint32_t init_key[], int key_length);
-char *get_idstring(void);
+void init_by_array(uint32_t *init_key, int key_length);
+const char *get_idstring(void);
 int get_min_array_size32(void);
 int get_min_array_size64(void);
 
--- a/src/wav/wav-sndfile.c	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/wav/wav-sndfile.c	Fri Jul 27 16:20:15 2007 -0500
@@ -232,7 +232,6 @@
 
 	playback->output->close_audio();
 
-	g_thread_exit (NULL);
 	return NULL;
 }
 
--- a/src/wav/wav.c	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/wav/wav.c	Fri Jul 27 16:20:15 2007 -0500
@@ -261,38 +261,37 @@
     rate =
         wav_file->samples_per_sec * wav_file->channels *
         (wav_file->bits_per_sample / 8);
-    while (wav_file->going) {
-        if (!wav_file->eof) {
+    while (playback->playing) {
+        if (!playback->eof) {
             bytes = blk_size;
             if (wav_file->length - wav_file->position < bytes)
                 bytes = wav_file->length - wav_file->position;
             if (bytes > 0) {
                 actual_read = vfs_fread(data, 1, bytes, wav_file->file);
 
-                if (actual_read == 0) {
-                    wav_file->eof = 1;
-                    playback->output->buffer_free();
-                    playback->output->buffer_free();
-                }
+                if (actual_read == 0)
+                    playback->eof = TRUE;
                 else {
                     if (wav_file->seek_to == -1)
                         produce_audio(playback->output->written_time(),
                                       (wav_file->bits_per_sample ==
                                        16) ? FMT_S16_LE : FMT_U8,
                                       wav_file->channels, bytes, data,
-                                      &wav_file->going);
+                                      &playback->playing);
                     wav_file->position += actual_read;
                 }
             }
-            else {
-                wav_file->eof = TRUE;
-                playback->output->buffer_free();
-                playback->output->buffer_free();
-                xmms_usleep(10000);
-            }
+            else
+                playback->eof = TRUE;
         }
-        else
-            xmms_usleep(10000);
+        else {
+            playback->output->buffer_free ();
+            playback->output->buffer_free ();
+            while (playback->output->buffer_playing())
+                g_usleep(10000);                  
+            playback->playing = 0;
+        }
+
         if (wav_file->seek_to != -1) {
             wav_file->position = (unsigned long)((gint64)wav_file->seek_to * (gint64)rate / 1000L);
             vfs_fseek(wav_file->file,
@@ -400,7 +399,7 @@
         wav_file->length = len;
 
         wav_file->position = 0;
-        wav_file->going = 1;
+        playback->playing = 1;
 
         if (playback->output->
             open_audio((wav_file->bits_per_sample ==
@@ -428,8 +427,8 @@
 static void
 stop(InputPlayback * playback)
 {
-    if (wav_file && wav_file->going) {
-        wav_file->going = 0;
+    if (wav_file && playback->playing) {
+        playback->playing = 0;
         g_thread_join(decode_thread);
         playback->output->close_audio();
         g_free(wav_file);
@@ -444,11 +443,11 @@
 }
 
 static void
-mseek(InputPlayback * data, gulong millisecond)
+mseek(InputPlayback * playback, gulong millisecond)
 {
     wav_file->seek_to = millisecond;
 
-    wav_file->eof = FALSE;
+    playback->eof = FALSE;
 
     while (wav_file->seek_to != -1)
         xmms_usleep(10000);
@@ -468,8 +467,8 @@
         return -2;
     if (!wav_file)
         return -1;
-    if (!wav_file->going
-        || (wav_file->eof && !playback->output->buffer_playing()))
+    if (!playback->playing
+        || (playback->eof && !playback->output->buffer_playing()))
         return -1;
     else {
         return playback->output->output_time();
--- a/src/wav/wav.h	Fri Jul 27 16:20:08 2007 -0500
+++ b/src/wav/wav.h	Fri Jul 27 16:20:15 2007 -0500
@@ -45,11 +45,11 @@
 
 typedef struct {
     VFSFile *file;
-    short format_tag, channels, block_align, bits_per_sample, eof;
+    short format_tag, channels, block_align, bits_per_sample;
     long samples_per_sec, avg_bytes_per_sec;
     unsigned long position, length;
     glong seek_to;
-    int data_offset, going;
+    int data_offset;
     pid_t pid;
 } WaveFile;