Index: cd-recorder.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/cd-recorder.c,v
retrieving revision 1.20
diff -u -r1.20 cd-recorder.c
--- cd-recorder.c	28 May 2003 10:10:37 -0000	1.20
+++ cd-recorder.c	18 Jun 2003 20:33:26 -0000
@@ -66,6 +66,8 @@
 	LAST_SIGNAL
 };
 
+#define MAX_ARGS 200
+
 static int cd_recorder_table_signals[LAST_SIGNAL] = { 0 };
 
 static GObjectClass *parent_class = NULL;
@@ -279,13 +281,14 @@
 				 gboolean music,
 		       gboolean dummy_write)
 {
-	const char *argv[200]; /* Shouldn't need more than 200 arguments */
+	const char *argv[MAX_ARGS]; /* Shouldn't need more than MAX_ARGS arguments */
 	char *speed_str, *dev_str;
 	int stdout_pipe, stderr_pipe;
 	guint stdout_tag, stderr_tag;
 	GIOChannel *channel;
 	GError *error;
 	int i, saved_i;
+    char *wavdir = NULL;
 
 	i = 0;
 	saved_i = 0;
@@ -310,7 +313,7 @@
 		argv[i++] = "-pad";
 		argv[i++] = "-audio";
 		saved_i = i;
-		cdrecorder->priv->music_count = build_list_of_music_arguments ("burn:///", &i, argv, 200-i-5);
+		cdrecorder->priv->music_count = build_list_of_music_arguments ("burn:///", &i, argv, MAX_ARGS-i-5, &wavdir);
 	} else {
 		cdrecorder->priv->music_count = 0;
 		argv[i++] = "-data";
@@ -399,9 +402,24 @@
 
 	if (music) {
 		int j;
+        
 		for (j=0;j<cdrecorder->priv->music_count;j++) {
 			g_free ((char *)argv[saved_i+j]);
 		}
+        if (wavdir) {
+            GDir *dir;
+            const char *file;
+
+            dir = g_dir_open(wavdir, 0, NULL);
+            while ((file = g_dir_read_name(dir))) {
+                char *fullname = g_strdup_printf("%s/%s", wavdir, file);
+                rc = remove(fullname);
+                g_free(fullname);
+            }
+            g_dir_close(dir);
+            rc = remove(wavdir);
+            free(wavdir);
+        }
 	}
 
 	g_signal_emit (G_OBJECT (cdrecorder),
Index: make-iso.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/make-iso.c,v
retrieving revision 1.20
diff -u -r1.20 make-iso.c
--- make-iso.c	27 May 2003 08:07:06 -0000	1.20
+++ make-iso.c	18 Jun 2003 20:33:26 -0000
@@ -647,8 +647,26 @@
 	return mkisofs_output.result;
 }
 
+static char *
+make_wav(const char *orig, const char *wavdir)
+{
+    char *qbacking = g_shell_quote(orig);
+    char *tmp = g_strdup(orig);
+    char *base = g_path_get_basename(tmp);
+    char *wav = g_strdup_printf("%s/%s.wav", wavdir, base);
+    char *qwav = g_shell_quote(wav);
+    char *cmd = g_strdup_printf("mpg123 -s %s | sox -t raw -r 44100 -s -w -c 2 - %s", qbacking, qwav);
+    system(cmd);
+    g_free(cmd);
+    g_free(qwav);
+    g_free(base);
+    g_free(tmp);
+    g_free(qbacking);
+    return wav;
+}
+
 gint 
-build_list_of_music_arguments (char *uri, int *argc, const char **argv, int max_num_args)
+build_list_of_music_arguments (char *uri, int *argc, const char **argv, int max_num_args, char **wavdir)
 {
 	GnomeVFSFileInfo *info;
 	GnomeVFSDirectoryHandle *handle;
@@ -672,8 +690,26 @@
 
 		if (is_audio (info->mime_type)) {
 			backing = get_backing_file (info->name);
-			argv[(*argc)++] = backing;
-			count++;
+            if (strcmp(info->mime_type, "audio/mpeg") == 0) {
+                char *wav = NULL;
+                
+                if (!*wavdir) {
+                    const char *tmpdir = g_get_tmp_dir();
+                    *wavdir = g_strdup_printf("%s/cd-burner-XXXXXX", tmpdir);
+                    mktemp(*wavdir);
+                    mkdir(*wavdir, 0700);
+                    //FIXME: should this be freed?
+                    //g_free(tmpdir);
+                }
+                wav = make_wav(backing, *wavdir);
+                if (wav) {
+                    argv[(*argc)++] = wav;
+                    count++;  
+                }
+            } else {
+                argv[(*argc)++] = backing;
+                count++;
+            }
 		}
 		
 		if (count == max_num_args) {
Index: make-iso.h
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/make-iso.h,v
retrieving revision 1.5
diff -u -r1.5 make-iso.h
--- make-iso.h	27 May 2003 08:07:06 -0000	1.5
+++ make-iso.h	18 Jun 2003 20:33:26 -0000
@@ -22,5 +22,5 @@
    Authors: Alexander Larsson <alexl@redhat.com>
 */
 int make_iso (const char *filename, const char *label);
-gint build_list_of_music_arguments (char *uri, int *argc, const char **argv, int max_num_args);
+gint build_list_of_music_arguments (char *uri, int *argc, const char **argv, int max_num_args, char **wavdir);
 extern gboolean is_audio (char *mime_type);
Index: nautilus-cd-burner.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/nautilus-cd-burner.c,v
retrieving revision 1.31
diff -u -r1.31 nautilus-cd-burner.c
--- nautilus-cd-burner.c	27 May 2003 08:07:06 -0000	1.31
+++ nautilus-cd-burner.c	18 Jun 2003 20:33:26 -0000
@@ -394,7 +394,8 @@
 gboolean
 is_audio (char *mime_type) 
 {
-	if (strcmp (mime_type, "audio/x-wav") == 0 || strcmp (mime_type, "audio/x-ulaw") == 0) {
+	if (strcmp (mime_type, "audio/x-wav") == 0 || strcmp (mime_type, "audio/x-ulaw") == 0
+        || strcmp(mime_type, "audio/mpeg") == 0) {
 		return TRUE;
 	}
 	return FALSE;
@@ -850,7 +851,7 @@
 	CDDrive *rec;
 	GtkWidget *dialog, *entry, *eject_check, *blank_check, *music_check, *reuse_check, *progress_window;
 	GtkWidget *cancel_button, *dummy_check, *option_menu, *item;
-	const char *label;
+	const char *label = NULL;
 	int res, speed;
 	gboolean eject, blank, music, reuse, dummy;
 	GnomeVFSURI *uri;
@@ -952,9 +953,6 @@
 	if (res == 0) {
 		rec = lookup_current_recorder (xml);
 		
-		entry = glade_xml_get_widget (xml, "cdname_entry");
-		label = gtk_entry_get_text (GTK_ENTRY (entry));
-
 		eject_check = glade_xml_get_widget (xml, "eject_check");
 		eject = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (eject_check));
 
@@ -965,6 +963,11 @@
 		music = (rec->type != CDDRIVE_TYPE_FILE) &&
 			gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (music_check));
 	
+		entry = glade_xml_get_widget (xml, "cdname_entry");
+        if (!music) {
+    		label = gtk_entry_get_text (GTK_ENTRY (entry));
+        }
+
 		dummy = FALSE;
 
 #ifdef ENABLE_DUMMY_WRITE
Index: nautilus-cd-burner.h
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/nautilus-cd-burner.h,v
retrieving revision 1.13
diff -u -r1.13 nautilus-cd-burner.h
--- nautilus-cd-burner.h	27 May 2003 08:07:06 -0000	1.13
+++ nautilus-cd-burner.h	18 Jun 2003 20:33:26 -0000
@@ -31,7 +31,7 @@
 
 extern int make_iso (const char *filename,
 		     const char *label);
-extern gint build_list_of_music_arguments (char *uri, int *argc, const char **argv, int max_num_args);
+extern gint build_list_of_music_arguments (char *uri, int *argc, const char **argv, int max_num_args, char **wavdir);
 gboolean is_audio (char *mime_type);
 
 /* UI callbacks: */
