--- gnome-media-2.4.1.1/config.h.in	2003-12-19 13:54:21.000000000 +0100
+++ /root/gnome-media-2.4.1.1-colin/config.h.in	2003-12-17 19:38:10.000000000 +0100
@@ -173,6 +173,8 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if we have paranoia */
+#undef HAVE_PARANOIA
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
--- gnome-media-2.4.1.1/configure.in	2003-12-19 13:54:21.000000000 +0100
+++ /root/gnome-media-2.4.1.1-colin/configure.in	2003-12-17 19:38:10.000000000 +0100
@@ -146,6 +146,14 @@
     fi
 fi
 
+AC_ARG_ENABLE(paranoia, 
+[  --enable-paranoia=[no/yes]      Enable support for paranoia library],,enable_paranoia=no)
+if test "x$enable_paranoia" = "xyes"; then
+    HAVE_PARANOIA="yes"
+    AC_DEFINE(HAVE_PARANOIA)
+    LIBS="$LIBS -lcdda_interface -lcdda_paranoia -lm"
+fi
+
 ALL_LINGUAS="am ar az be bg bn ca cs cy da de el en_GB es et eu fa fi fr ga gl he hi hu id it ja ko lt lv mk ml mn ms nl nn no pl pt pt_BR ro ru sk sl sq sr sr@Latn sv tr uk vi wa zh_TW zh_CN"
 AM_GLIB_GNU_GETTEXT
 
diff -ub gnome-media-2.4.1.1/gnome-cd/callbacks.c /root/gnome-media-2.4.1.1-colin/gnome-cd/callbacks.c
--- gnome-media-2.4.1.1/gnome-cd/callbacks.c	2003-12-19 13:54:21.000000000 +0100
+++ /root/gnome-media-2.4.1.1-colin/gnome-cd/callbacks.c	2003-12-18 12:36:12.000000000 +0100
@@ -96,6 +96,11 @@
 	int end_track;
 	GnomeCDRomMSF *endmsf;
 
+#ifdef HAVE_PARANOIA	
+	gnome_cdrom_set_paranoia(gcd->cdrom, gcd->preferences->use_paranoia, &error);
+	gnome_cdrom_set_out_device(gcd->cdrom, gcd->preferences->out_device, &error);
+#endif
+
 	if (gnome_cdrom_get_status (gcd->cdrom, &status, &error) == FALSE) {
 		gcd_warning ("%s", error);
 		g_error_free (error);
@@ -492,6 +497,12 @@
 	gtk_widget_set_sensitive (gcd->next_b, TRUE);
 	gtk_widget_set_sensitive (gcd->eject_b, TRUE);
 
+
+#ifdef HAVE_PARANOIA
+	if (gcd->preferences->use_paranoia && status->track <= 1)
+		gtk_widget_set_sensitive (gcd->back_b, FALSE);
+#endif
+
 	switch (status->audio) {
 	case GNOME_CDROM_AUDIO_NOTHING:
 		break;
@@ -593,7 +604,10 @@
 				msf.minute = 0;
 				msf.second = 0;
 				msf.frame = 0;
-				
+#ifdef HAVE_PARANOIA
+				if (gcd->preferences->use_paranoia)
+					gnome_cdrom_stop(gcd->cdrom, &error);
+#endif				
 				if (gnome_cdrom_play (gcd->cdrom, start_track, &msf,
 						      end_track, &msf, &error) == FALSE) {
 					gcd_warning ("%s", error);
@@ -713,8 +727,15 @@
 		status_ok (gcd, status);
 		if (status->track >= gcd->disc_info->ntracks)
                        gtk_widget_set_sensitive (gcd->next_b, FALSE);
+
+#ifndef HAVE_PARANOIA
                if (status->track <= 1 && (status->audio == GNOME_CDROM_AUDIO_STOP || status->audio == GNOME_CDROM_AUDIO_COMPLETE))
                        gtk_widget_set_sensitive (gcd->back_b, FALSE);
+#else
+		/* paranoia back is always track-1 */
+                if (status->track <= 1 && (status->audio == GNOME_CDROM_AUDIO_STOP || status->audio == GNOME_CDROM_AUDIO_COMPLETE))
+                       gtk_widget_set_sensitive (gcd->back_b, !gcd->preferences->use_paranoia);
+#endif
 		break;
 		
 	case GNOME_CDROM_STATUS_NO_DISC:
diff -ub gnome-media-2.4.1.1/gnome-cd/cdrom.c /root/gnome-media-2.4.1.1-colin/gnome-cd/cdrom.c
--- gnome-media-2.4.1.1/gnome-cd/cdrom.c	2003-12-19 13:54:21.000000000 +0100
+++ /root/gnome-media-2.4.1.1-colin/gnome-cd/cdrom.c	2003-12-19 09:28:30.000000000 +0100
@@ -22,6 +22,12 @@
 #include <glib-object.h>
 #include <libgnome/gnome-i18n.h>
 
+#ifdef HAVE_PARANOIA
+#include <cdda_interface.h>
+#include <cdda_paranoia.h>
+#define CD_FRAMES 75
+#endif
+
 #include "cdrom.h"
 #include "gnome-cd.h"
 
@@ -44,8 +50,82 @@
 	guint             update_id;
 	GnomeCDRomUpdate  update;
 	GnomeCDRomStatus *recent_status;
+
+#ifdef HAVE_PARANOIA
+	int use_paranoia;	
+	paranoia_struct *ps;
+	char *out_device;
+#endif
 };
 
+#ifdef HAVE_PARANOIA
+static void 
+paranoia_cb(long inpos, int function) 
+{
+}
+
+static void *
+play_thread(void *data)
+{
+	paranoia_struct *ps = (paranoia_struct *)data;
+
+	if (ps->stopped != 1) {
+		/* already running */
+		pthread_cancel(pthread_self());
+		return;
+	}
+
+	ps->stopped = 0; 
+	ps->stop = 0;
+	ps->cursor = ps->first_sector;
+	paranoia_seek(ps->cdp, ps->cursor, SEEK_SET);
+
+	while (!ps->stop && ps->dsp 
+	    && (ps->data = paranoia_read(ps->cdp, paranoia_cb)) != NULL) {
+	    	char *err = cdda_errors(ps->cdd);
+		
+		if (err) {
+			ps->stop = 1;
+			continue;
+		}
+		
+		if (ps->skip != 0) {
+			ps->cursor += ps->skip;
+			if (ps->cursor >= ps->last_sector) {
+				ps->stop = 1;
+				ps->skip = 0;
+				continue;
+			}
+			paranoia_seek(ps->cdp, ps->cursor, SEEK_SET);
+			ps->skip = 0;
+			continue;
+		} 
+		
+		while (ps->paused) {
+			sleep(1);
+			if (ps->stop) {
+				ps->paused = 0;
+				break;
+			}
+		}
+		
+		fwrite(ps->data, sizeof(short), CD_FRAMESIZE_RAW/2, ps->dsp);
+		ps->cursor++;
+		if (ps->cursor >= ps->last_sector) {
+			break;
+		}
+	}
+	ps->stop = 0;
+	if (ps->dsp) {
+		fclose(ps->dsp);
+		ps->dsp = NULL;
+	}
+	ps->stopped = 1;
+	ps->paused = 0;
+	pthread_cancel(pthread_self());
+}
+#endif
+
 GQuark
 gnome_cdrom_error_quark (void)
 {
@@ -493,8 +573,23 @@
 {
 	GnomeCDRomClass *klass;
 
+#ifdef HAVE_PARANOIA
+	if (cdrom->priv->use_paranoia) {
+		if (cdrom->priv->ps) {
+			int next, last;
+			next = cdrom->priv->ps->start_track+1;
+			last = cdrom->playmode == GNOME_CDROM_WHOLE_CD ? -1 : next + 1;  
+			gnome_cdrom_stop(cdrom, &(*error));
+			return gnome_cdrom_play(cdrom, next, NULL, last, NULL, &*(error));
+			}
+		return TRUE;
+	}
+#else
+	{
 	klass = GNOME_CDROM_GET_CLASS (cdrom);
 	return klass->next (cdrom, error);
+	}
+#endif
 }
 
 gboolean
@@ -503,8 +598,16 @@
 {
 	GnomeCDRomClass *klass;
 
+#ifdef HAVE_PARANOIA
+	if (cdrom->priv->use_paranoia && cdrom->priv->ps) {
+		cdrom->priv->ps->skip = +100;
+		return TRUE;
+	} else
+#endif
+	{
 	klass = GNOME_CDROM_GET_CLASS (cdrom);
 	return klass->ffwd (cdrom, error);
+	}
 }
 
 gboolean
@@ -517,8 +620,81 @@
 {
 	GnomeCDRomClass *klass;
 
+#ifdef HAVE_PARANOIA
+	if (cdrom->priv->use_paranoia) {
+		static cdrom_drive *cdd = NULL;
+		static cdrom_paranoia* cdp = NULL;
+		int ps_thread = 0;
+		pthread_t thread;
+		int i;
+		GnomeCDRomPrivate *priv = cdrom->priv;
+	
+		if (cdd == NULL) {
+			cdd = cdda_identify(cdrom->priv->device ,0, NULL);
+		}
+		if (!cdd || cdda_open(cdd)) {
+			gcd_warning(_("Cannot open device with cdparanoia."), NULL);
+			return FALSE;
+		}
+
+		if (cdp == NULL) {
+			cdp = paranoia_init(cdd);
+		}
+
+		if (cdp == NULL) {
+			gcd_warning(_("Cannot initialize cdparanoia."), NULL);
+			return FALSE;
+		}
+		
+		if (priv->ps == NULL) {
+			priv->ps = g_new0(paranoia_struct, 1);
+			priv->ps->stopped = 1;
+			priv->ps->paused = 0;
+		}
+		
+		if (priv->ps->paused) {
+			priv->ps->paused = 0;
+			return TRUE;
+		} else if (!priv->ps->paused && !priv->ps->stopped && start != NULL) {
+			int track = cdda_sector_gettrack(priv->ps->cdd, priv->ps->cursor);
+			unsigned long fsec = cdda_track_firstsector(priv->ps->cdd, track);
+			unsigned long offset = fsec + start->minute*60 + start->second;
+			
+			offset *= CD_FRAMES;
+			priv->ps->skip = offset - priv->ps->cursor;
+			return TRUE;
+		}
+		
+		if (!priv->ps->dsp)
+			priv->ps->dsp = fopen(cdrom->priv->out_device, "w");
+		
+		if (!priv->ps->dsp) {
+			gcd_warning(_("Cannot open output device."), NULL);
+			return FALSE;
+		}
+		
+		priv->ps->cdd = cdd;
+		priv->ps->cdp = cdp;
+		priv->ps->start_track = start_track;
+		priv->ps->finish_track = (finish_track == -1 ? cdda_tracks(cdd)+1:finish_track);
+		
+		if (priv->ps->start_track < 1)
+			priv->ps->start_track = 1;
+		if (priv->ps->finish_track > cdda_tracks(cdd)+1)
+			priv->ps->finish_track = cdda_tracks(cdd)+1;
+		if (priv->ps->start_track > cdda_tracks(cdd))
+			priv->ps->start_track = cdda_tracks(cdd);
+		
+		priv->ps->first_sector = cdda_track_firstsector(cdd, priv->ps->start_track);
+		priv->ps->last_sector = cdda_track_lastsector(cdd, priv->ps->finish_track - 1);
+		ps_thread = pthread_create(&thread, NULL, play_thread, priv->ps);
+		return TRUE;
+	} else 
+#endif
+	{
 	klass = GNOME_CDROM_GET_CLASS (cdrom);
 	return klass->play (cdrom, start_track, start, finish_track, finish, error);
+	}
 }
 
 gboolean
@@ -526,9 +702,16 @@
 		   GError **error)
 {
 	GnomeCDRomClass *klass;
-
+#ifdef HAVE_PARANOIA
+	if (cdrom->priv->use_paranoia) {
+		cdrom->priv->ps->paused = 1;
+		return TRUE;
+	} else
+#endif
+	{
 	klass = GNOME_CDROM_GET_CLASS (cdrom);
 	return klass->pause (cdrom, error);
+	}
 }
 
 gboolean
@@ -537,8 +720,23 @@
 {
 	GnomeCDRomClass *klass;
 
+#ifdef HAVE_PARANOIA
+	if (cdrom->priv->use_paranoia) {
+		if (cdrom->priv->ps) {
+			int i = 0;
+			cdrom->priv->ps->stop = 1;
+			while (cdrom->priv->ps->stopped != 1 && i++ < 10) {
+				sleep(1);
+			}
+			cdrom->priv->ps->paused = 0;
+			return (i < 9);
+		}
+	} else 
+#endif
+	{
 	klass = GNOME_CDROM_GET_CLASS (cdrom);
 	return klass->stop (cdrom, error);
+	}
 }
 
 gboolean
@@ -547,8 +745,16 @@
 {
 	GnomeCDRomClass *klass;
 
+#ifdef HAVE_PARANOIA
+	if (cdrom->priv->use_paranoia && cdrom->priv->ps) {
+		cdrom->priv->ps->skip = -100;
+		return TRUE;
+	} else
+#endif
+	{
 	klass = GNOME_CDROM_GET_CLASS (cdrom);
 	return klass->rewind (cdrom, error);
+	}
 }
 
 gboolean
@@ -556,9 +762,23 @@
 		  GError **error)
 {
 	GnomeCDRomClass *klass;
-
+#ifdef HAVE_PARANOIA
+	if (cdrom->priv->use_paranoia) {
+		if (cdrom->priv->ps) {
+			int next, last;
+			next = cdrom->priv->ps->start_track-1;
+			last = cdrom->playmode == GNOME_CDROM_WHOLE_CD ? -1 : next + 1;
+			gnome_cdrom_stop(cdrom, &(*error));
+			return gnome_cdrom_play(cdrom, next, NULL, last, NULL, &(*error));
+			}
+		return TRUE;
+	}
+#else
+	{
 	klass = GNOME_CDROM_GET_CLASS (cdrom);
 	return klass->back (cdrom, error);
+	}
+#endif
 }
 
 gboolean
@@ -569,7 +789,34 @@
 	GnomeCDRomClass *klass;
 
 	klass = GNOME_CDROM_GET_CLASS (cdrom);
-	return klass->get_status (cdrom, status, error);
+	int result = klass->get_status (cdrom, status, error);
+#ifdef HAVE_PARANOIA
+	if (cdrom->priv->ps != NULL && cdrom->priv->use_paranoia) {
+		unsigned long fsec = 0;
+		unsigned long lsec = 0;
+		unsigned long len = 0;
+		paranoia_struct *ps = cdrom->priv->ps;
+		(*status)->track = cdda_sector_gettrack(ps->cdd, ps->cursor);
+		if (ps->stopped == 0 && ps->paused == 0) {
+			(*status)->audio = GNOME_CDROM_AUDIO_PLAY;
+		}
+		else if (ps->paused == 1) {
+			(*status)->audio = GNOME_CDROM_AUDIO_PAUSE;
+		}
+		else if (ps->stopped == 1) {
+			(*status)->audio = GNOME_CDROM_AUDIO_STOP;
+		}
+		fsec = cdda_track_firstsector(ps->cdd, (*status)->track);
+		lsec = cdda_track_lastsector(ps->cdd, (*status)->track);
+		len = lsec - fsec;
+		(*status)->length.minute = (int)(len/(60*CD_FRAMES));
+		(*status)->length.second = (int)((len/CD_FRAMES)%60);
+		(*status)->relative.minute = (int)((ps->cursor-fsec)/(60*CD_FRAMES));
+		(*status)->relative.second = (int)(((ps->cursor-fsec)/CD_FRAMES)%60);
+	}
+		
+#endif
+	return result;
 }
 
 gboolean
@@ -693,6 +940,34 @@
 	return klass->set_volume (cdrom, volume, error);
 }
 
+#ifdef HAVE_PARANOIA
+gboolean
+gnome_cdrom_set_paranoia(GnomeCDRom *cdrom,
+		 	 int use_paranoia,
+			 GError **error)
+{
+	if (cdrom->priv->use_paranoia!= use_paranoia) {
+		gnome_cdrom_stop(cdrom, &(*error));
+	}
+	cdrom->priv->use_paranoia = use_paranoia;
+	return TRUE;
+}
+gboolean
+gnome_cdrom_set_out_device(GnomeCDRom *cdrom,
+		 	   const char *out_device,
+			   GError **error)
+{
+	if (cdrom->priv->out_device && strcmp(cdrom->priv->out_device, out_device)) {
+		gnome_cdrom_stop(cdrom, &(*error));
+	}
+	if (cdrom->priv->out_device)
+		g_free(cdrom->priv->out_device);
+
+	cdrom->priv->out_device = g_strdup(out_device);
+	return TRUE;
+}
+#endif 
+
 gboolean
 gnome_cdrom_is_cdrom_device (GnomeCDRom *cdrom,
 			     const char *device,
@@ -876,3 +1151,4 @@
 	g_free (cdrom->priv->recent_status);
 	cdrom->priv->recent_status = NULL;
 }
+
diff -ub gnome-media-2.4.1.1/gnome-cd/cdrom.h /root/gnome-media-2.4.1.1-colin/gnome-cd/cdrom.h
--- gnome-media-2.4.1.1/gnome-cd/cdrom.h	2003-12-19 13:54:21.000000000 +0100
+++ /root/gnome-media-2.4.1.1-colin/gnome-cd/cdrom.h	2003-12-18 12:30:52.000000000 +0100
@@ -11,6 +11,11 @@
 #include <glib/gerror.h>
 #include <glib-object.h>
 
+#ifdef HAVE_PARANOIA
+#include "cdda_interface.h"
+#include "cdda_paranoia.h"
+#endif
+
 G_BEGIN_DECLS
 
 #define GNOME_CDROM_TYPE (gnome_cdrom_get_type ())
@@ -144,6 +149,7 @@
 	gboolean (*set_volume) (GnomeCDRom *cdrom,
 				int volume,
 				GError **error);
+
 	gboolean (*is_cdrom_device) (GnomeCDRom *cdrom,
 				     const char *device,
 				     GError **error);
@@ -203,6 +209,16 @@
 gboolean gnome_cdrom_set_volume (GnomeCDRom *cdrom,
 				 int volume,
 				 GError **error);
+
+#ifdef HAVE_PARANOIA
+gboolean gnome_cdrom_set_paranoia(GnomeCDRom *cdrom,
+				  int use_paranoia,
+				  GError **error);
+gboolean gnome_cdrom_set_out_device(GnomeCDRom *cdrom,
+				    const char *out_device,
+				    GError **error);
+#endif
+
 gboolean gnome_cdrom_is_cdrom_device (GnomeCDRom *cdrom,
 				      const char *device,
 				      GError **error);
@@ -243,6 +259,24 @@
 				    gboolean         force_close);
 void        gnome_cdrom_force_status_rescan (GnomeCDRom *cdrom);
 
+#ifdef HAVE_PARANOIA
+typedef struct _paranoia_struct {
+	cdrom_drive *cdd;
+	cdrom_paranoia *cdp;
+	short int *data;
+	FILE *dsp;
+	int stop;
+	int stopped;
+	int paused;
+	int start_track;
+	int finish_track;
+	unsigned long first_sector;
+	unsigned long last_sector;
+	unsigned long cursor;
+	unsigned long skip;
+} paranoia_struct;
+#endif
+
 G_END_DECLS
 
 #endif
diff -ub gnome-media-2.4.1.1/gnome-cd/gnome-cd.c /root/gnome-media-2.4.1.1-colin/gnome-cd/gnome-cd.c
--- gnome-media-2.4.1.1/gnome-cd/gnome-cd.c	2003-12-19 13:54:21.000000000 +0100
+++ /root/gnome-media-2.4.1.1-colin/gnome-cd/gnome-cd.c	2003-12-17 19:38:12.000000000 +0100
@@ -95,7 +95,10 @@
 		end_track = -1;
 		endmsf = NULL;
 	}
-	
+#ifdef HAVE_PARANOIA
+	if (gcd->preferences->use_paranoia)
+		gnome_cdrom_stop(GNOME_CDROM (gcd->cdrom), &error);
+#endif
 	if (gnome_cdrom_play (GNOME_CDROM (gcd->cdrom), track + 1, &msf, end_track, endmsf, &error) == FALSE) {
 		gcd_warning ("Error skipping %s", error);
 		g_error_free (error);
diff -ub gnome-media-2.4.1.1/gnome-cd/preferences.c /root/gnome-media-2.4.1.1-colin/gnome-cd/preferences.c
--- gnome-media-2.4.1.1/gnome-cd/preferences.c	2003-12-19 13:54:21.000000000 +0100
+++ /root/gnome-media-2.4.1.1-colin/gnome-cd/preferences.c	2003-12-18 12:34:35.000000000 +0100
@@ -88,10 +88,14 @@
 			gtk_widget_show (dialog);
 			g_error_free (error);
 		}
-		
+#ifdef HAVE_PARANOIA
+		gnome_cdrom_set_paranoia(prefs->gcd->cdrom, prefs->use_paranoia, &error);
+		gnome_cdrom_set_out_device(prefs->gcd->cdrom, prefs->out_device, &error);
+#endif
 		cd_selection_stop (prefs->gcd->cd_selection);
 		prefs->gcd->cd_selection = cd_selection_start (prefs->device);
 	}
+	
 }
 
 static void
@@ -133,6 +137,23 @@
 	/* This doesn't take effect till we quit... */
 }
 
+#ifdef HAVE_PARANOIA
+static void
+paranoia_changed (GConfClient *_client,
+		  guint cnxn_id,
+		  GConfEntry *entry,
+		  gpointer user_data)
+{
+	GnomeCDPreferences *prefs = user_data;
+	GConfValue *value = gconf_entry_get_value (entry);
+	gchar *tmp = g_strdup(prefs->device);
+	
+	prefs->use_paranoia = gconf_value_get_bool (value);
+	do_device_changed (prefs, tmp);
+	g_free(tmp);
+}
+#endif
+
 static void
 do_theme_changed (GnomeCDPreferences *prefs,
 		  const char *theme_name)
@@ -195,6 +216,15 @@
 		g_warning ("Error: %s", error->message);
 	}
 						    
+#ifdef HAVE_PARANOIA
+	prefs->out_device = gconf_client_get_string (client,
+						 "/apps/gnome-cd/out-device", NULL);
+	if (prefs->out_device == NULL) {
+		g_warning ("GConf schemas are not correctly installed.");
+		prefs->out_device = g_strdup ("/dev/dsp");
+	}
+#endif
+						    
 	prefs->start_play = gconf_client_get_bool (client,
 					     "/apps/gnome-cd/on-start-play",
 					      NULL);
@@ -222,12 +252,24 @@
 						   "/apps/gnome-cd/theme-name",
 						   theme_changed, prefs,
 						   NULL, NULL);
+#ifdef HAVE_PARANOIA
+	prefs->use_paranoia = gconf_client_get_bool (client,
+						   "/apps/gnome-cd/use-paranoia",
+						   NULL);
+	prefs->paranoia_id = gconf_client_notify_add (client,
+						   "/apps/gnome-cd/use-paranoia",
+						   paranoia_changed, prefs,
+						   NULL, NULL);
+#endif
 }
 
 void
 preferences_free (GnomeCDPreferences *prefs)
 {
 	g_free (prefs->device);
+#ifdef HAVE_PARANOIA
+	g_free (prefs->out_device);
+#endif
 	g_free (prefs->theme_name);
 
 	/* Remove the listeners */
@@ -235,7 +277,10 @@
 	gconf_client_notify_remove (client, prefs->start_id);
 	gconf_client_notify_remove (client, prefs->stop_id);
 	gconf_client_notify_remove (client, prefs->theme_id);
-
+#ifdef HAVE_PARANOIA
+	gconf_client_notify_remove (client, prefs->out_device_id);
+	gconf_client_notify_remove (client, prefs->paranoia_id);
+#endif
 	g_free (prefs);
 }
 
@@ -265,7 +310,10 @@
 	GtkWidget *start_stop;
 	
 	GtkWidget *stop_open;
-	
+#ifdef HAVE_PARANOIA	
+	GtkWidget *use_paranoia;
+	GtkWidget *out_device;
+#endif
 	GtkWidget *theme_list;
 	
 	guint start_id;
@@ -273,6 +321,10 @@
 	
 	guint stop_id;
 	guint theme_id;
+#ifdef HAVE_PARANOIA	
+	guint paranoia_id;
+	guint out_device_id;
+#endif
 } PropertyDialog;
 
 static void
@@ -324,7 +376,10 @@
 	gconf_client_notify_remove (client, pd->start_id);
 	gconf_client_notify_remove (client, pd->stop_id); 
 	gconf_client_notify_remove (client, pd->theme_id);
-	
+#ifdef HAVE_PARANOIA
+	gconf_client_notify_remove (client, pd->paranoia_id);
+	gconf_client_notify_remove (client, pd->out_device_id);
+#endif
 	g_free (pd);
 }
 
@@ -399,6 +454,39 @@
 					   0, 0, NULL, G_CALLBACK (device_changed_cb), pd);
 }
 
+#ifdef HAVE_PARANOIA
+static void
+out_device_changed_cb (GtkWidget *entry,
+		       PropertyDialog *pd)
+{
+	const char *new_device;
+		
+	new_device = gtk_entry_get_text (GTK_ENTRY (entry));
+	if (new_device == NULL || *new_device == 0) {
+		return;
+	}
+
+	gconf_client_set_string (client, "/apps/gnome-cd/out-device", new_device, NULL);
+	
+}
+
+static void
+change_out_device_widget (GConfClient *_client,
+		          guint cnxn,
+		          GConfEntry *entry,
+		          gpointer user_data)
+{
+	PropertyDialog *pd = user_data;
+	GConfValue *value = gconf_entry_get_value (entry);
+	
+	g_signal_handlers_block_matched (G_OBJECT (pd->out_device), G_SIGNAL_MATCH_FUNC,
+					 0, 0, NULL, G_CALLBACK (out_device_changed_cb), pd);
+	gtk_entry_set_text (GTK_ENTRY (pd->out_device), gconf_value_get_string (value));
+	g_signal_handlers_unblock_matched (G_OBJECT (pd->out_device), G_SIGNAL_MATCH_FUNC,
+					   0, 0, NULL, G_CALLBACK (out_device_changed_cb), pd);
+}
+#endif
+
 static void
 start_play_toggled_cb (GtkToggleButton *tb,
 		       PropertyDialog *pd)
@@ -432,6 +520,17 @@
 			       gtk_toggle_button_get_active (tb), NULL);
 }
 
+#ifdef HAVE_PARANOIA
+static void
+use_paranoia_toggled_cb (GtkToggleButton *tb,
+		      PropertyDialog *pd)
+{
+	gconf_client_set_bool (client, "/apps/gnome-cd/use-paranoia",
+			       gtk_toggle_button_get_active (tb), NULL);
+}
+
+#endif
+
 static void
 change_stop_widget (GConfClient *_client,
 		    guint cnxn,
@@ -449,6 +548,26 @@
 					   0, 0, NULL, G_CALLBACK (stop_open_toggled_cb), pd);
 }
 
+#ifdef HAVE_PARANOIA
+static void
+change_paranoia_widget (GConfClient *_client,
+		    guint cnxn,
+		    GConfEntry *entry,
+		    gpointer user_data)
+{
+	PropertyDialog *pd = user_data;
+	GConfValue *value = gconf_entry_get_value (entry);
+
+	g_signal_handlers_block_matched (G_OBJECT (pd->use_paranoia), G_SIGNAL_MATCH_FUNC,
+					 0, 0, NULL, G_CALLBACK (use_paranoia_toggled_cb), pd);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pd->use_paranoia),
+				      gconf_value_get_bool (value));
+	g_signal_handlers_unblock_matched (G_OBJECT (pd->use_paranoia), G_SIGNAL_MATCH_FUNC,
+					   0, 0, NULL, G_CALLBACK (use_paranoia_toggled_cb), pd);
+}
+
+#endif
+
 static void
 theme_selection_changed_cb (GtkTreeSelection *selection,
 			    PropertyDialog *pd)
@@ -740,6 +859,36 @@
 	pd->stop_id = gconf_client_notify_add (client,
 					       "/apps/gnome-cd/on-stop-eject",
 					       change_stop_widget, pd, NULL, NULL);
+#ifdef HAVE_PARANOIA	
+	inner_hbox = gtk_hbox_new (FALSE, 6);
+
+	pd->use_paranoia = gtk_check_button_new_with_mnemonic (_("Use digital read, output to "));
+	add_description (pd->use_paranoia, _("Use libparanoia to read CDs"));
+	if (gcd->preferences->use_paranoia) {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pd->use_paranoia), TRUE);
+	}
+	g_signal_connect (G_OBJECT (pd->use_paranoia), "toggled",
+			  G_CALLBACK (use_paranoia_toggled_cb), pd);
+	gtk_box_pack_start (GTK_BOX (inner_hbox), pd->use_paranoia, FALSE, FALSE, 0);
+
+	pd->paranoia_id = gconf_client_notify_add(client,
+						   "/apps/gnome-cd/use-paranoia",
+						   change_paranoia_widget, pd, NULL, NULL);
+	pd->out_device = gtk_entry_new ();
+	gtk_entry_set_text (GTK_ENTRY (pd->out_device), gcd->preferences->out_device);
+	
+	g_signal_connect (G_OBJECT (pd->out_device), "changed",
+			  G_CALLBACK (out_device_changed_cb), pd);
+	g_signal_connect (G_OBJECT (pd->out_device), "activate",
+			  G_CALLBACK (apply_clicked_cb), pd);
+	gtk_box_pack_start (GTK_BOX (inner_hbox), pd->out_device, TRUE, TRUE, 0);
+	
+	pd->out_device_id = gconf_client_notify_add (client,
+						 "/apps/gnome-cd/out-device",
+						 change_out_device_widget, pd, NULL, NULL);
+	gtk_box_pack_start (GTK_BOX (action_vbox), inner_hbox, FALSE, FALSE, 0);
+
+#endif
 	
 	if (only_device == TRUE) {
 		gtk_widget_set_sensitive (hbox, FALSE);
diff -ub gnome-media-2.4.1.1/gnome-cd/preferences.h /root/gnome-media-2.4.1.1-colin/gnome-cd/preferences.h
--- gnome-media-2.4.1.1/gnome-cd/preferences.h	2003-12-19 13:54:21.000000000 +0100
+++ /root/gnome-media-2.4.1.1-colin/gnome-cd/preferences.h	2003-12-18 10:17:22.000000000 +0100
@@ -32,12 +32,20 @@
 	
 	gboolean start_play;
 	gboolean stop_eject;
+#ifdef HAVE_PARANOIA
+	gboolean use_paranoia;
+	char *out_device;
+#endif
 	
 	/* GConf IDs */
 	guint device_id;
 	guint start_id;
 	guint stop_id;
 	guint theme_id;
+#ifdef HAVE_PARANOIA
+	guint paranoia_id;
+	guint out_device_id;
+#endif
 } GnomeCDPreferences;
 
 GnomeCDPreferences *preferences_new         (GnomeCD *gcd);
