[brasero] Fix #349124 - Bonfire transcodes DTS-Wav into normal stereo WAV



commit 1644bf504fb49c1de8274e3d8916d9504cdbe9c3
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Sun Sep 20 20:21:35 2009 +0200

    Fix #349124 -  Bonfire transcodes DTS-Wav into normal stereo WAV
    Now instead of transcoding that type of wav files, brasero detects them and ask the user whether he wants to create a disc with DTS tracks. If so brasero will simply pipe or write the audio data to the burn engine.
    In the process there were some more changes:
    - a flag was changed (it was useless) 4_CHANNELS and replaced by DTS
    - remove also in the plugin definitions flags 44100 Hz or 48000 Hz as it was useless
    - added a new tag for BraseroBurnSession to set the format of the output audio stream for BraseroTranscode plugin
    - make sure that when gst_element_link* is used we check the return values so as not to get stuck (further work needed)

 libbrasero-burn/brasero-enums.h            |    5 +-
 libbrasero-burn/brasero-image-properties.c |    2 -
 libbrasero-burn/brasero-tags.h             |    3 +-
 libbrasero-burn/brasero-track-stream-cfg.c |   23 ++-
 libbrasero-burn/burn-debug.c               |    4 +-
 libbrasero-utils/brasero-metadata.c        |   73 +++++++--
 plugins/cdrkit/burn-wodim.c                |    4 +-
 plugins/cdrtools/burn-cdrecord.c           |    4 +-
 plugins/dvdauthor/burn-dvdauthor.c         |    4 -
 plugins/libburnia/burn-libburn.c           |    3 +-
 plugins/local-track/burn-local-image.c     |   10 +-
 plugins/transcode/burn-normalize.c         |   96 +++++++++---
 plugins/transcode/burn-transcode.c         |  244 +++++++++++++++++++++-------
 plugins/transcode/burn-vob.c               |    6 -
 src/brasero-audio-disc.c                   |   92 +++++++++++-
 15 files changed, 437 insertions(+), 136 deletions(-)
---
diff --git a/libbrasero-burn/brasero-enums.h b/libbrasero-burn/brasero-enums.h
index a03593b..232044a 100644
--- a/libbrasero-burn/brasero-enums.h
+++ b/libbrasero-burn/brasero-enums.h
@@ -125,12 +125,15 @@ typedef enum {
 typedef enum {
 	BRASERO_AUDIO_FORMAT_NONE		= 0,
 	BRASERO_AUDIO_FORMAT_UNDEFINED		= 1,
-	BRASERO_AUDIO_FORMAT_4_CHANNEL		= 1 << 1,
+	BRASERO_AUDIO_FORMAT_DTS		= 1 << 1,
 	BRASERO_AUDIO_FORMAT_RAW		= 1 << 2,
 	BRASERO_AUDIO_FORMAT_AC3		= 1 << 3,
 	BRASERO_AUDIO_FORMAT_MP2		= 1 << 4,
+
 	BRASERO_AUDIO_FORMAT_44100		= 1 << 5,
 	BRASERO_AUDIO_FORMAT_48000		= 1 << 6,
+
+
 	BRASERO_VIDEO_FORMAT_UNDEFINED		= 1 << 7,
 	BRASERO_VIDEO_FORMAT_VCD		= 1 << 8,
 	BRASERO_VIDEO_FORMAT_VIDEO_DVD		= 1 << 9,
diff --git a/libbrasero-burn/brasero-image-properties.c b/libbrasero-burn/brasero-image-properties.c
index bf31fcf..e550d23 100644
--- a/libbrasero-burn/brasero-image-properties.c
+++ b/libbrasero-burn/brasero-image-properties.c
@@ -46,8 +46,6 @@
 #include "brasero-image-properties.h"
 #include "brasero-image-type-chooser.h"
 
-#include "brasero-session-helper.h"
-
 typedef struct _BraseroImagePropertiesPrivate BraseroImagePropertiesPrivate;
 struct _BraseroImagePropertiesPrivate
 {
diff --git a/libbrasero-burn/brasero-tags.h b/libbrasero-burn/brasero-tags.h
index 7e4df3e..f3c109e 100644
--- a/libbrasero-burn/brasero-tags.h
+++ b/libbrasero-burn/brasero-tags.h
@@ -84,7 +84,8 @@ G_BEGIN_DECLS
 /**
  * Define the audio streams for a DVD
  */
-#define BRASERO_DVD_STREAM_FORMAT		"session::DVD::stream::format"
+#define BRASERO_DVD_STREAM_FORMAT		"session::DVD::stream::format"			/* Int */
+#define BRASERO_SESSION_STREAM_AUDIO_FORMAT	"session::stream::audio::format"	/* Int */
 
 /**
  * Define the format: whether VCD or SVCD
diff --git a/libbrasero-burn/brasero-track-stream-cfg.c b/libbrasero-burn/brasero-track-stream-cfg.c
index 71a215b..2100ec4 100644
--- a/libbrasero-burn/brasero-track-stream-cfg.c
+++ b/libbrasero-burn/brasero-track-stream-cfg.c
@@ -39,6 +39,8 @@
 
 #include "brasero-misc.h"
 
+#include "burn-debug.h"
+
 #include "brasero-track-stream-cfg.h"
 #include "brasero-io.h"
 #include "brasero-tags.h"
@@ -102,8 +104,8 @@ brasero_track_stream_cfg_results_cb (GObject *obj,
 				     GFileInfo *info,
 				     gpointer user_data)
 {
-	guint64 len;
 	GFile *file;
+	guint64 len;
 	GObject *snapshot;
 	BraseroTrackStreamCfgPrivate *priv;
 
@@ -169,13 +171,20 @@ brasero_track_stream_cfg_results_cb (GObject *obj,
 		g_free (sym_uri);
 	}
 
-	if (BRASERO_TRACK_STREAM_CLASS (brasero_track_stream_cfg_parent_class)->set_format)
+	/* Check whether the stream is wav+dts as it can be burnt as such */
+	if (g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_DTS)) {
+		BRASERO_BURN_LOG ("Track has DTS");
+		BRASERO_TRACK_STREAM_CLASS (brasero_track_stream_cfg_parent_class)->set_format (BRASERO_TRACK_STREAM (obj), 
+		                                                                                BRASERO_AUDIO_FORMAT_DTS|
+		                                                                                BRASERO_METADATA_INFO);
+	}
+	else if (BRASERO_TRACK_STREAM_CLASS (brasero_track_stream_cfg_parent_class)->set_format)
 		BRASERO_TRACK_STREAM_CLASS (brasero_track_stream_cfg_parent_class)->set_format (BRASERO_TRACK_STREAM (obj),
-												(g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_VIDEO)?
-												 BRASERO_VIDEO_FORMAT_UNDEFINED:BRASERO_AUDIO_FORMAT_NONE)|
-												(g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_AUDIO)?
-												 BRASERO_AUDIO_FORMAT_UNDEFINED:BRASERO_AUDIO_FORMAT_NONE)|
-												BRASERO_METADATA_INFO);
+		                                                                                (g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_VIDEO)?
+		                                                                                 BRASERO_VIDEO_FORMAT_UNDEFINED:BRASERO_AUDIO_FORMAT_NONE)|
+		                                                                                (g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_AUDIO)?
+		                                                                                 BRASERO_AUDIO_FORMAT_UNDEFINED:BRASERO_AUDIO_FORMAT_NONE)|
+		                                                                                BRASERO_METADATA_INFO);
 
 	/* size */
 	len = g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN);
diff --git a/libbrasero-burn/burn-debug.c b/libbrasero-burn/burn-debug.c
index 9065aab..56523eb 100644
--- a/libbrasero-burn/burn-debug.c
+++ b/libbrasero-burn/burn-debug.c
@@ -238,8 +238,8 @@ brasero_debug_audio_format_to_string (gchar *buffer,
 	if (format & BRASERO_AUDIO_FORMAT_UNDEFINED)
 		strcat (buffer, "AUDIO UNDEFINED ");
 
-	if (format & BRASERO_AUDIO_FORMAT_4_CHANNEL)
-		strcat (buffer, "4 CHANNELS ");
+	if (format & BRASERO_AUDIO_FORMAT_DTS)
+		strcat (buffer, "DTS WAV ");
 
 	if (format & BRASERO_AUDIO_FORMAT_MP2)
 		strcat (buffer, "MP2 ");
diff --git a/libbrasero-utils/brasero-metadata.c b/libbrasero-utils/brasero-metadata.c
index b5ad6a1..3896eb4 100644
--- a/libbrasero-utils/brasero-metadata.c
+++ b/libbrasero-utils/brasero-metadata.c
@@ -533,34 +533,77 @@ brasero_metadata_get_mime_type (BraseroMetadata *self)
 	if (!strcmp (mime, "application/x-id3"))
 		priv->info->type = g_strdup ("audio/mpeg");
 	else if (!strcmp (mime, "audio/x-wav")) {
-		GstElement *wavparse;
+		GstElement *wavparse = NULL;
+		gpointer element = NULL;
+		GstIteratorResult res;
+		GstIterator *iter;
 
 		priv->info->type = g_strdup (mime);
 
 		/* make sure it doesn't have dts inside */
-		wavparse = gst_bin_get_by_name (GST_BIN (priv->decode), "wavparse0");
+		iter = gst_bin_iterate_recurse (GST_BIN (priv->decode));
+
+		res = gst_iterator_next (iter, &element);
+		while (res == GST_ITERATOR_OK) {
+			gchar *name;
+
+			name = gst_object_get_name (GST_OBJECT (element));
+			if (name) {
+				if (!strncmp (name, "wavparse", 8)) {
+					wavparse = element;
+					g_free (name);
+					break;
+				}
+				g_free (name);
+			}
+
+			gst_object_unref (element);
+			element = NULL;
+
+			res = gst_iterator_next (iter, &element);
+		}
+		gst_iterator_free (iter);
+
 		if (wavparse) {
 			GstPad *src_pad;
-			GstCaps *src_caps;
-			const gchar *name;
-			GstStructure *structure;
 
-			src_pad = gst_element_get_static_pad (wavparse, "src");
-			src_caps = gst_pad_get_caps (src_pad);
-			gst_object_unref (src_pad);
+			iter = gst_element_iterate_src_pads (wavparse);
+
+			res = gst_iterator_next (iter, (gpointer *) &src_pad);
+			while (res == GST_ITERATOR_OK) {
+				GstCaps *src_caps;
+
+				src_caps = gst_pad_get_caps (src_pad);
+				if (src_caps) {
+					GstStructure *structure;
+
+					structure = gst_caps_get_structure (src_caps, 0);
+					if (structure) {
+						const gchar *name;
 
-			structure = gst_caps_get_structure (caps, 0);
-			gst_caps_unref (caps);
-			if (!structure)
-				return TRUE;
+						name = gst_structure_get_name (structure);
+						priv->info->has_dts = (g_strrstr (name, "audio/x-dts") != NULL);
+						if (priv->info->has_dts) {
+							gst_object_unref (src_pad);
+							gst_caps_unref (src_caps);
+							src_pad = NULL;
+							break;
+						}
+					}
+					gst_caps_unref (src_caps);
+				}
 
-			name = gst_structure_get_name (structure);
-			priv->info->has_dts = (g_strrstr (name, "audio") != NULL);
+				gst_object_unref (src_pad);
+				src_pad = NULL;
 
-			BRASERO_UTILS_LOG ("Wav file has dts: %s", priv->info->has_dts? "yes":"no");
+				res = gst_iterator_next (iter,  (gpointer *) &src_pad);
+			}
 
+			gst_iterator_free (iter);
 			gst_object_unref (wavparse);
 		}
+
+		BRASERO_UTILS_LOG ("Wav file has dts: %s", priv->info->has_dts? "yes":"no");
 	}
 	else
 		priv->info->type = g_strdup (mime);
diff --git a/plugins/cdrkit/burn-wodim.c b/plugins/cdrkit/burn-wodim.c
index 8ed095f..f80d8cb 100644
--- a/plugins/cdrkit/burn-wodim.c
+++ b/plugins/cdrkit/burn-wodim.c
@@ -1266,7 +1266,6 @@ brasero_wodim_export_caps (BraseroPlugin *plugin, gchar **error)
 	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_PIPE|
 					BRASERO_PLUGIN_IO_ACCEPT_FILE,
 					BRASERO_AUDIO_FORMAT_RAW|
-					BRASERO_AUDIO_FORMAT_44100|
 					BRASERO_METADATA_INFO);
 
 	brasero_plugin_link_caps (plugin, output, input);
@@ -1274,8 +1273,7 @@ brasero_wodim_export_caps (BraseroPlugin *plugin, gchar **error)
 
 	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_PIPE|
 					BRASERO_PLUGIN_IO_ACCEPT_FILE,
-					BRASERO_AUDIO_FORMAT_RAW|
-					BRASERO_AUDIO_FORMAT_44100);
+					BRASERO_AUDIO_FORMAT_RAW);
 
 	brasero_plugin_link_caps (plugin, output, input);
 	g_slist_free (output);
diff --git a/plugins/cdrtools/burn-cdrecord.c b/plugins/cdrtools/burn-cdrecord.c
index d3f8b6b..2e6e852 100644
--- a/plugins/cdrtools/burn-cdrecord.c
+++ b/plugins/cdrtools/burn-cdrecord.c
@@ -1187,7 +1187,6 @@ brasero_cdrecord_export_caps (BraseroPlugin *plugin, gchar **error)
 	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_PIPE|
 					BRASERO_PLUGIN_IO_ACCEPT_FILE,
 					BRASERO_AUDIO_FORMAT_RAW|
-					BRASERO_AUDIO_FORMAT_44100|
 					BRASERO_METADATA_INFO);
 
 	brasero_plugin_link_caps (plugin, output, input);
@@ -1195,8 +1194,7 @@ brasero_cdrecord_export_caps (BraseroPlugin *plugin, gchar **error)
 
 	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_PIPE|
 					BRASERO_PLUGIN_IO_ACCEPT_FILE,
-					BRASERO_AUDIO_FORMAT_RAW|
-					BRASERO_AUDIO_FORMAT_44100);
+					BRASERO_AUDIO_FORMAT_RAW);
 
 	brasero_plugin_link_caps (plugin, output, input);
 	g_slist_free (output);
diff --git a/plugins/dvdauthor/burn-dvdauthor.c b/plugins/dvdauthor/burn-dvdauthor.c
index 5cc41c3..095109e 100644
--- a/plugins/dvdauthor/burn-dvdauthor.c
+++ b/plugins/dvdauthor/burn-dvdauthor.c
@@ -377,8 +377,6 @@ brasero_dvd_author_export_caps (BraseroPlugin *plugin, gchar **error)
 					BRASERO_AUDIO_FORMAT_AC3|
 					BRASERO_AUDIO_FORMAT_MP2|
 					BRASERO_AUDIO_FORMAT_RAW|
-					BRASERO_AUDIO_FORMAT_44100|
-					BRASERO_AUDIO_FORMAT_48000|
 					BRASERO_METADATA_INFO|
 					BRASERO_VIDEO_FORMAT_VIDEO_DVD);
 
@@ -393,8 +391,6 @@ brasero_dvd_author_export_caps (BraseroPlugin *plugin, gchar **error)
 					BRASERO_AUDIO_FORMAT_AC3|
 					BRASERO_AUDIO_FORMAT_MP2|
 					BRASERO_AUDIO_FORMAT_RAW|
-					BRASERO_AUDIO_FORMAT_44100|
-					BRASERO_AUDIO_FORMAT_48000|
 					BRASERO_VIDEO_FORMAT_VIDEO_DVD);
 
 	brasero_plugin_link_caps (plugin, output, input);
diff --git a/plugins/libburnia/burn-libburn.c b/plugins/libburnia/burn-libburn.c
index f4c7dc5..502f318 100644
--- a/plugins/libburnia/burn-libburn.c
+++ b/plugins/libburnia/burn-libburn.c
@@ -938,8 +938,7 @@ brasero_libburn_export_caps (BraseroPlugin *plugin, gchar **error)
 	/* audio support for CDs only */
 	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_PIPE|
 					BRASERO_PLUGIN_IO_ACCEPT_FILE,
-					BRASERO_AUDIO_FORMAT_RAW|
-					BRASERO_AUDIO_FORMAT_44100);
+					BRASERO_AUDIO_FORMAT_RAW);
 	
 	output = brasero_caps_disc_new (media_cd);
 	brasero_plugin_link_caps (plugin, output, input);
diff --git a/plugins/local-track/burn-local-image.c b/plugins/local-track/burn-local-image.c
index 8470d8b..73fd19d 100644
--- a/plugins/local-track/burn-local-image.c
+++ b/plugins/local-track/burn-local-image.c
@@ -912,30 +912,26 @@ brasero_local_track_export_caps (BraseroPlugin *plugin, gchar **error)
 
 	caps = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
 				       BRASERO_AUDIO_FORMAT_UNDEFINED|
-				       BRASERO_AUDIO_FORMAT_4_CHANNEL|
+	                               BRASERO_AUDIO_FORMAT_DTS|
 				       BRASERO_AUDIO_FORMAT_RAW|
 				       BRASERO_VIDEO_FORMAT_UNDEFINED|
 				       BRASERO_VIDEO_FORMAT_VCD|
 				       BRASERO_VIDEO_FORMAT_VIDEO_DVD|
 				       BRASERO_AUDIO_FORMAT_AC3|
 				       BRASERO_AUDIO_FORMAT_MP2|
-				       BRASERO_AUDIO_FORMAT_44100|
-				       BRASERO_AUDIO_FORMAT_48000|
 				       BRASERO_METADATA_INFO);
 	brasero_plugin_process_caps (plugin, caps);
 	g_slist_free (caps);
 
 	caps = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
 				       BRASERO_AUDIO_FORMAT_UNDEFINED|
-				       BRASERO_AUDIO_FORMAT_4_CHANNEL|
+	                               BRASERO_AUDIO_FORMAT_DTS|
 				       BRASERO_AUDIO_FORMAT_RAW|
 				       BRASERO_VIDEO_FORMAT_UNDEFINED|
 				       BRASERO_VIDEO_FORMAT_VCD|
 				       BRASERO_VIDEO_FORMAT_VIDEO_DVD|
 				       BRASERO_AUDIO_FORMAT_AC3|
-				       BRASERO_AUDIO_FORMAT_MP2|
-				       BRASERO_AUDIO_FORMAT_44100|
-				       BRASERO_AUDIO_FORMAT_48000);
+				       BRASERO_AUDIO_FORMAT_MP2);
 	brasero_plugin_process_caps (plugin, caps);
 	g_slist_free (caps);
 	caps = brasero_caps_data_new (BRASERO_IMAGE_FS_ANY);
diff --git a/plugins/transcode/burn-normalize.c b/plugins/transcode/burn-normalize.c
index bee3c38..94f5519 100644
--- a/plugins/transcode/burn-normalize.c
+++ b/plugins/transcode/burn-normalize.c
@@ -40,6 +40,8 @@
 
 #include <gst/gst.h>
 
+#include "brasero-tags.h"
+
 #include "burn-job.h"
 #include "brasero-plugin-registration.h"
 #include "burn-normalize.h"
@@ -72,6 +74,7 @@ static gboolean
 brasero_normalize_bus_messages (GstBus *bus,
 				GstMessage *msg,
 				BraseroNormalize *normalize);
+
 static void
 brasero_normalize_stop_pipeline (BraseroNormalize *normalize)
 {
@@ -182,6 +185,10 @@ brasero_normalize_build_pipeline (BraseroNormalize *normalize,
 
 	if (!gst_element_link (source, decode)) {
 		BRASERO_JOB_LOG (normalize, "Elements could not be linked");
+		g_set_error (error,
+			     BRASERO_BURN_ERROR,
+			     BRASERO_BURN_ERROR_GENERAL,
+		             _("Impossible to link plugin pads"));
 		goto error;
 	}
 
@@ -234,11 +241,16 @@ brasero_normalize_build_pipeline (BraseroNormalize *normalize,
 	                  "new-decoded-pad",
 	                  G_CALLBACK (brasero_normalize_new_decoded_pad_cb),
 	                  normalize);
-	gst_element_link_many (resample,
-			       convert,
-			       analysis,
-			       sink,
-			       NULL);
+	if (!gst_element_link_many (resample,
+	                            convert,
+	                            analysis,
+	                            sink,
+	                            NULL)) {
+		g_set_error (error,
+			     BRASERO_BURN_ERROR,
+			     BRASERO_BURN_ERROR_GENERAL,
+		             _("Impossible to link plugin pads"));
+	}
 
 	/* connect to the bus */	
 	bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
@@ -262,17 +274,50 @@ error:
 	return FALSE;
 }
 
-static gboolean
+static BraseroBurnResult
 brasero_normalize_set_next_track (BraseroJob *job,
-				  BraseroTrack *track,
-				  GError **error)
+                                  GError **error)
 {
 	gchar *uri;
+	GValue *value;
+	BraseroTrack *track;
 	GstElement *analysis;
+	BraseroTrackType *type;
 	BraseroNormalizePrivate *priv;
+	gboolean dts_allowed = FALSE;
 
 	priv = BRASERO_NORMALIZE_PRIVATE (job);
 
+	/* See if dts is allowed */
+	value = NULL;
+	brasero_job_tag_lookup (job, BRASERO_SESSION_STREAM_AUDIO_FORMAT, &value);
+	if (value)
+		dts_allowed = (g_value_get_int (value) & BRASERO_AUDIO_FORMAT_DTS) != 0;
+
+	type = brasero_track_type_new ();
+	while (priv->tracks && priv->tracks->data) {
+		track = priv->tracks->data;
+		priv->tracks = g_slist_remove (priv->tracks, track);
+
+		brasero_track_get_track_type (track, type);
+		if (brasero_track_type_get_has_stream (type)) {
+			if (!dts_allowed)
+				break;
+
+			/* skip DTS tracks as we won't modify them */
+			if ((brasero_track_type_get_stream_format (type) & BRASERO_AUDIO_FORMAT_DTS) == 0) 
+				break;
+
+			BRASERO_JOB_LOG (job, "Skipped DTS track");
+		}
+
+		track = NULL;
+	}
+	brasero_track_type_free (type);
+
+	if (!track)
+		return BRASERO_BURN_OK;
+
 	if (!priv->analysis) {
 		analysis = gst_element_factory_make ("rganalysis", NULL);
 		if (analysis == NULL) {
@@ -281,7 +326,7 @@ brasero_normalize_set_next_track (BraseroJob *job,
 				     BRASERO_BURN_ERROR_GENERAL,
 				     _("%s element could not be created"),
 				     "\"Rganalysis\"");
-			return FALSE;
+			return BRASERO_BURN_ERR;
 		}
 
 		g_object_set (analysis,
@@ -308,11 +353,11 @@ brasero_normalize_set_next_track (BraseroJob *job,
 
 	if (!brasero_normalize_build_pipeline (BRASERO_NORMALIZE (job), uri, analysis, error)) {
 		g_free (uri);
-		return FALSE;
+		return BRASERO_BURN_ERR;
 	}
 
 	g_free (uri);
-	return TRUE;
+	return BRASERO_BURN_RETRY;
 }
 
 static BraseroBurnResult
@@ -367,8 +412,8 @@ static void
 brasero_normalize_song_end_reached (BraseroNormalize *normalize)
 {
 	GValue *value;
-	BraseroTrack *track;
 	GError *error = NULL;
+	BraseroBurnResult result;
 	BraseroNormalizePrivate *priv;
 
 	priv = BRASERO_NORMALIZE_PRIVATE (normalize);
@@ -396,7 +441,8 @@ brasero_normalize_song_end_reached (BraseroNormalize *normalize)
 	priv->track_peak = 0.0;
 	priv->track_gain = 0.0;
 
-	if (!priv->tracks) {
+	result = brasero_normalize_set_next_track (BRASERO_JOB (normalize), &error);
+	if (result == BRASERO_BURN_OK) {
 		BRASERO_JOB_LOG (normalize,
 				 "Setting album peak (%lf) and gain (%lf)",
 				 priv->album_peak,
@@ -422,11 +468,7 @@ brasero_normalize_song_end_reached (BraseroNormalize *normalize)
 	}
 
 	/* jump to next track */
-
-
-	track = priv->tracks->data;
-	priv->tracks = g_slist_remove (priv->tracks, track);
-	if (!brasero_normalize_set_next_track (BRASERO_JOB (normalize), track, &error)) {
+	if (result == BRASERO_BURN_ERR) {
 		brasero_job_error (BRASERO_JOB (normalize), error);
 		return;
 	}
@@ -479,7 +521,7 @@ brasero_normalize_start (BraseroJob *job,
 			 GError **error)
 {
 	BraseroNormalizePrivate *priv;
-	BraseroTrack *track;
+	BraseroBurnResult result;
 
 	priv = BRASERO_NORMALIZE_PRIVATE (job);
 
@@ -492,12 +534,14 @@ brasero_normalize_start (BraseroJob *job,
 		return BRASERO_BURN_ERR;
 
 	priv->tracks = g_slist_copy (priv->tracks);
-	track = priv->tracks->data;
-	priv->tracks = g_slist_remove (priv->tracks, track);
 
-	if (!brasero_normalize_set_next_track (job, track, error))
+	result = brasero_normalize_set_next_track (job, error);
+	if (result == BRASERO_BURN_ERR)
 		return BRASERO_BURN_ERR;
 
+	if (result == BRASERO_BURN_OK)
+		return BRASERO_BURN_NOT_RUNNING;
+
 	/* ready to go */
 	brasero_job_set_current_action (job,
 					BRASERO_BURN_ACTION_ANALYSING,
@@ -613,14 +657,20 @@ brasero_normalize_export_caps (BraseroPlugin *plugin, gchar **error)
 	}
 	gst_object_unref (element);
 
+	/* Add dts to make sure that when they are mixed with regular songs
+	 * this plugin will be called for the regular tracks */
 	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
 					BRASERO_AUDIO_FORMAT_UNDEFINED|
+	                                BRASERO_AUDIO_FORMAT_DTS|
 					BRASERO_METADATA_INFO);
 	brasero_plugin_process_caps (plugin, input);
 	g_slist_free (input);
 
+	/* Add dts to make sure that when they are mixed with regular songs
+	 * this plugin will be called for the regular tracks */
 	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
-					BRASERO_AUDIO_FORMAT_UNDEFINED);
+					BRASERO_AUDIO_FORMAT_UNDEFINED|
+	                                BRASERO_AUDIO_FORMAT_DTS);
 	brasero_plugin_process_caps (plugin, input);
 	g_slist_free (input);
 
diff --git a/plugins/transcode/burn-transcode.c b/plugins/transcode/burn-transcode.c
index e1c7039..8718b1a 100644
--- a/plugins/transcode/burn-transcode.c
+++ b/plugins/transcode/burn-transcode.c
@@ -268,7 +268,8 @@ brasero_transcode_create_volume (BraseroTranscode *transcode,
 static gboolean
 brasero_transcode_create_pipeline_size_mp3 (BraseroTranscode *transcode,
 					    GstElement *pipeline,
-					    GstElement *source,				       GError **error)
+					    GstElement *source,
+                                            GError **error)
 {
 	BraseroTranscodePrivate *priv;
 	GstElement *parse;
@@ -324,11 +325,69 @@ brasero_transcode_create_pipeline_size_mp3 (BraseroTranscode *transcode,
 	return TRUE;
 }
 
+static void
+brasero_transcode_error_on_pad_linking (BraseroTranscode *self,
+                                        const gchar *function_name)
+{
+	BraseroTranscodePrivate *priv;
+	GstMessage *message;
+	GstBus *bus;
+
+	priv = BRASERO_TRANSCODE_PRIVATE (self);
+
+	BRASERO_JOB_LOG (self, "Error on pad linking");
+	message = gst_message_new_error (GST_OBJECT (priv->pipeline),
+					 g_error_new (BRASERO_BURN_ERROR,
+						      BRASERO_BURN_ERROR_GENERAL,
+						      /* Translators: This message is sent
+						       * when brasero could not link together
+						       * two gstreamer plugins so that one
+						       * sends its data to the second for further
+						       * processing. This data transmission is
+						       * done through a pad. Maybe this is a bit
+						       * too technical and should be removed? */
+						      _("Impossible to link plugin pads")),
+					 function_name);
+
+	bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
+	gst_bus_post (bus, message);
+	g_object_unref (bus);
+}
+
+static void
+brasero_transcode_wavparse_pad_added_cb (GstElement *wavparse,
+                                         GstPad *new_pad,
+                                         gpointer user_data)
+{
+	GstPad *pad = NULL;
+	BraseroTranscodePrivate *priv;
+
+	priv = BRASERO_TRANSCODE_PRIVATE (user_data);
+
+	pad = gst_element_get_static_pad (priv->sink, "sink");
+	if (!pad) 
+		goto error;
+
+	if (gst_pad_link (new_pad, pad) != GST_PAD_LINK_OK)
+		goto error;
+
+	gst_element_set_state (priv->sink, GST_STATE_PLAYING);
+	return;
+
+error:
+
+	if (pad)
+		gst_object_unref (pad);
+
+	brasero_transcode_error_on_pad_linking (BRASERO_TRANSCODE (user_data), "Sent by brasero_transcode_wavparse_pad_added_cb");
+}
+
 static gboolean
 brasero_transcode_create_pipeline (BraseroTranscode *transcode,
 				   GError **error)
 {
 	gchar *uri;
+	GValue *value = NULL;
 	GstElement *decode;
 	GstElement *source;
 	GstBus *bus = NULL;
@@ -342,6 +401,7 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
 	BraseroTrack *track = NULL;
 	GstElement *resample = NULL;
 	BraseroTranscodePrivate *priv;
+	BraseroStreamFormat session_format;
 
 	priv = BRASERO_TRANSCODE_PRIVATE (transcode);
 
@@ -446,7 +506,68 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
 	g_object_set (sink,
 		      "sync", FALSE,
 		      NULL);
-		
+
+	session_format = BRASERO_AUDIO_FORMAT_RAW;
+	brasero_job_tag_lookup (BRASERO_JOB (transcode), BRASERO_SESSION_STREAM_AUDIO_FORMAT, &value);
+	if (value)
+		session_format = g_value_get_int (value);
+	
+	if (action == BRASERO_JOB_ACTION_IMAGE
+	&& (session_format & BRASERO_AUDIO_FORMAT_DTS) != 0
+	&& (brasero_track_stream_get_format (BRASERO_TRACK_STREAM (track)) & BRASERO_AUDIO_FORMAT_DTS) != 0) {
+		GstElement *wavparse;
+		GstPad *sinkpad;
+
+		BRASERO_JOB_LOG (transcode, "DTS wav pipeline");
+
+		/* FIXME: volume normalization won't work here. We'd need to 
+		 * reencode it afterwards otherwise. */
+		/* This is a special case. This is DTS wav. So we only decode wav. */
+		wavparse = gst_element_factory_make ("wavparse", NULL);
+		if (wavparse == NULL) {
+			g_set_error (error,
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_GENERAL,
+				     _("%s element could not be created"),
+				     "\"Wavparse\"");
+			goto error;
+		}
+		gst_bin_add (GST_BIN (pipeline), wavparse);
+
+		priv->link = NULL;
+		priv->sink = sink;
+		priv->decode = NULL;
+		priv->source = source;
+		priv->convert = NULL;
+		priv->pipeline = pipeline;
+
+		if (!gst_element_link (source, wavparse)) {
+			g_set_error (error,
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_GENERAL,
+			             _("Impossible to link plugin pads"));
+			goto error;
+		}
+
+		g_signal_connect (wavparse,
+		                  "pad-added",
+		                  G_CALLBACK (brasero_transcode_wavparse_pad_added_cb),
+		                  transcode);
+
+		/* This is an ugly workaround for the lack of accuracy with
+		 * gstreamer. Yet this is unfortunately a necessary evil. */
+		priv->pos = 0;
+		priv->size = 0;
+		sinkpad = gst_element_get_pad (priv->sink, "sink");
+		priv->probe = gst_pad_add_buffer_probe (sinkpad,
+							G_CALLBACK (brasero_transcode_buffer_handler),
+							transcode);
+		gst_object_unref (sinkpad);
+
+		gst_element_set_state (priv->pipeline, GST_STATE_PLAYING);
+		return TRUE;
+	}
+
 	/* audioconvert */
 	convert = gst_element_factory_make ("audioconvert", NULL);
 	if (convert == NULL) {
@@ -516,8 +637,16 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
 
 	if (action == BRASERO_JOB_ACTION_IMAGE) {
 		GstPad *sinkpad;
+		gboolean res;
+
+		if (!gst_element_link_many (source, decode, NULL)) {
+			g_set_error (error,
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_GENERAL,
+			             _("Impossible to link plugin pads"));
+			goto error;
+		}
 
-		gst_element_link_many (source, decode, NULL);
 		priv->link = resample;
 		g_signal_connect (G_OBJECT (decode),
 				  "new-decoded-pad",
@@ -526,19 +655,28 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
 
 		if (volume) {
 			gst_bin_add (GST_BIN (pipeline), volume);
-			gst_element_link_many (resample,
-					       convert,
-					       volume,
-					       filter,
-					       sink,
-					       NULL);
+			res = gst_element_link_many (resample,
+			                             convert,
+			                             volume,
+			                             filter,
+			                             sink,
+			                             NULL);
+
 		}
 		else
-			gst_element_link_many (resample,
-					       convert,
-					       filter,
-					       sink,
-					       NULL);
+			res = gst_element_link_many (resample,
+			                             convert,
+			                             filter,
+			                             sink,
+			                             NULL);
+
+		if (!res) {
+			g_set_error (error,
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_GENERAL,
+				     _("Impossible to link plugin pads"));
+			goto error;
+		}
 
 		/* This is an ugly workaround for the lack of accuracy with
 		 * gstreamer. Yet this is unfortunately a necessary evil. */
@@ -551,8 +689,14 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
 		gst_object_unref (sinkpad);
 	}
 	else {
-		gst_element_link (source, decode);
-		gst_element_link (convert, sink);
+		if (!gst_element_link (source, decode)
+		||  !gst_element_link (convert, sink)) {
+			g_set_error (error,
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_GENERAL,
+				     _("Impossible to link plugin pads"));
+			goto error;
+		}
 
 		priv->link = convert;
 		g_signal_connect (G_OBJECT (decode),
@@ -663,9 +807,9 @@ brasero_transcode_create_sibling_image (BraseroTranscode *transcode,
 
 	dest = brasero_track_stream_new ();
 	brasero_track_stream_set_source (dest, path_dest);
-	brasero_track_stream_set_format (dest,
-					 BRASERO_AUDIO_FORMAT_RAW|
-					 BRASERO_AUDIO_FORMAT_44100);
+
+	/* FIXME: what if input had metadata ?*/
+	brasero_track_stream_set_format (dest, BRASERO_AUDIO_FORMAT_RAW);
 
 	/* NOTE: there is no gap and start = 0 since these tracks are the result
 	 * of the transformation of previous ones */
@@ -939,9 +1083,9 @@ brasero_transcode_push_track (BraseroTranscode *transcode)
 
 	track = brasero_track_stream_new ();
 	brasero_track_stream_set_source (track, output);
-	brasero_track_stream_set_format (track,
-					 BRASERO_AUDIO_FORMAT_RAW|
-					 BRASERO_AUDIO_FORMAT_44100);
+
+	/* FIXME: what if input had metadata ?*/
+	brasero_track_stream_set_format (track, BRASERO_AUDIO_FORMAT_RAW);
 	brasero_track_stream_set_boundaries (track, 0, length, 0);
 	brasero_track_tag_copy_missing (BRASERO_TRACK (track), src);
 
@@ -1451,34 +1595,6 @@ brasero_transcode_bus_messages (GstBus *bus,
 }
 
 static void
-brasero_transcode_error_on_pad_linking (BraseroTranscode *self)
-{
-	BraseroTranscodePrivate *priv;
-	GstMessage *message;
-	GstBus *bus;
-
-	priv = BRASERO_TRANSCODE_PRIVATE (self);
-
-	BRASERO_JOB_LOG (self, "Error on pad linking");
-	message = gst_message_new_error (GST_OBJECT (priv->pipeline),
-					 g_error_new (BRASERO_BURN_ERROR,
-						      BRASERO_BURN_ERROR_GENERAL,
-						      /* Translators: This message is sent
-						       * when brasero could not link together
-						       * two gstreamer plugins so that one
-						       * sends its data to the second for further
-						       * processing. This data transmission is
-						       * done through a pad. Maybe this is a bit
-						       * too technical and should be removed? */
-						      _("Impossible to link plugin pads")),
-					 "Sent by brasero_metadata_error_on_pad_linking");
-
-	bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
-	gst_bus_post (bus, message);
-	g_object_unref (bus);
-}
-
-static void
 brasero_transcode_new_decoded_pad_cb (GstElement *decode,
 				      GstPad *pad,
 				      gboolean arg2,
@@ -1513,13 +1629,13 @@ brasero_transcode_new_decoded_pad_cb (GstElement *decode,
 			queue = gst_element_factory_make ("queue", NULL);
 			gst_bin_add (GST_BIN (priv->pipeline), queue);
 			if (!gst_element_link (queue, priv->link)) {
-				brasero_transcode_error_on_pad_linking (transcode);
+				brasero_transcode_error_on_pad_linking (transcode, "Sent by brasero_transcode_new_decoded_pad_cb");
 				goto end;
 			}
 
 			sink = gst_element_get_pad (queue, "sink");
 			if (GST_PAD_IS_LINKED (sink)) {
-				brasero_transcode_error_on_pad_linking (transcode);
+				brasero_transcode_error_on_pad_linking (transcode, "Sent by brasero_transcode_new_decoded_pad_cb");
 				goto end;
 			}
 
@@ -1527,7 +1643,7 @@ brasero_transcode_new_decoded_pad_cb (GstElement *decode,
 			if (res == GST_PAD_LINK_OK)
 				gst_element_set_state (queue, GST_STATE_PLAYING);
 			else
-				brasero_transcode_error_on_pad_linking (transcode);
+				brasero_transcode_error_on_pad_linking (transcode, "Sent by brasero_transcode_new_decoded_pad_cb");
 
 			gst_object_unref (sink);
 		}
@@ -1541,13 +1657,13 @@ brasero_transcode_new_decoded_pad_cb (GstElement *decode,
 
 			fakesink = gst_element_factory_make ("fakesink", NULL);
 			if (!fakesink) {
-				brasero_transcode_error_on_pad_linking (transcode);
+				brasero_transcode_error_on_pad_linking (transcode, "Sent by brasero_transcode_new_decoded_pad_cb");
 				goto end;
 			}
 
 			sink = gst_element_get_static_pad (fakesink, "sink");
 			if (!sink) {
-				brasero_transcode_error_on_pad_linking (transcode);
+				brasero_transcode_error_on_pad_linking (transcode, "Sent by brasero_transcode_new_decoded_pad_cb");
 				gst_object_unref (fakesink);
 				goto end;
 			}
@@ -1558,7 +1674,7 @@ brasero_transcode_new_decoded_pad_cb (GstElement *decode,
 			if (res == GST_PAD_LINK_OK)
 				gst_element_set_state (fakesink, GST_STATE_PLAYING);
 			else
-				brasero_transcode_error_on_pad_linking (transcode);
+				brasero_transcode_error_on_pad_linking (transcode, "Sent by brasero_transcode_new_decoded_pad_cb");
 
 			gst_object_unref (sink);
 		}
@@ -1634,7 +1750,6 @@ brasero_transcode_export_caps (BraseroPlugin *plugin, gchar **error)
 	output = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE|
 					 BRASERO_PLUGIN_IO_ACCEPT_PIPE,
 					 BRASERO_AUDIO_FORMAT_RAW|
-					 BRASERO_AUDIO_FORMAT_44100|
 					 BRASERO_METADATA_INFO);
 
 	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
@@ -1642,18 +1757,29 @@ brasero_transcode_export_caps (BraseroPlugin *plugin, gchar **error)
 					BRASERO_METADATA_INFO);
 
 	brasero_plugin_link_caps (plugin, output, input);
+	g_slist_free (input);
+
+	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
+					BRASERO_AUDIO_FORMAT_DTS|
+					BRASERO_METADATA_INFO);
+	brasero_plugin_link_caps (plugin, output, input);
 	g_slist_free (output);
 	g_slist_free (input);
 
 	output = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE|
 					 BRASERO_PLUGIN_IO_ACCEPT_PIPE,
-					 BRASERO_AUDIO_FORMAT_RAW|
-					 BRASERO_AUDIO_FORMAT_44100);
+					 BRASERO_AUDIO_FORMAT_RAW);
 
 	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
 					BRASERO_AUDIO_FORMAT_UNDEFINED);
 
 	brasero_plugin_link_caps (plugin, output, input);
+	g_slist_free (input);
+
+	input = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
+					BRASERO_AUDIO_FORMAT_DTS);
+
+	brasero_plugin_link_caps (plugin, output, input);
 	g_slist_free (output);
 	g_slist_free (input);
 
diff --git a/plugins/transcode/burn-vob.c b/plugins/transcode/burn-vob.c
index 87b9d75..e1ebd74 100644
--- a/plugins/transcode/burn-vob.c
+++ b/plugins/transcode/burn-vob.c
@@ -1242,7 +1242,6 @@ brasero_vob_export_caps (BraseroPlugin *plugin, gchar **error)
 					BRASERO_METADATA_INFO);
 	output = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
 					 BRASERO_AUDIO_FORMAT_MP2|
-					 BRASERO_AUDIO_FORMAT_44100|
 					 BRASERO_METADATA_INFO|
 					 BRASERO_VIDEO_FORMAT_VCD);
 	brasero_plugin_link_caps (plugin, output, input);
@@ -1252,8 +1251,6 @@ brasero_vob_export_caps (BraseroPlugin *plugin, gchar **error)
 					 BRASERO_AUDIO_FORMAT_AC3|
 					 BRASERO_AUDIO_FORMAT_MP2|
 					 BRASERO_AUDIO_FORMAT_RAW|
-					 BRASERO_AUDIO_FORMAT_44100|
-					 BRASERO_AUDIO_FORMAT_48000|
 					 BRASERO_METADATA_INFO|
 					 BRASERO_VIDEO_FORMAT_VIDEO_DVD);
 	brasero_plugin_link_caps (plugin, output, input);
@@ -1265,7 +1262,6 @@ brasero_vob_export_caps (BraseroPlugin *plugin, gchar **error)
 					BRASERO_VIDEO_FORMAT_UNDEFINED);
 	output = brasero_caps_audio_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
 					 BRASERO_AUDIO_FORMAT_MP2|
-					 BRASERO_AUDIO_FORMAT_44100|
 					 BRASERO_VIDEO_FORMAT_VCD);
 	brasero_plugin_link_caps (plugin, output, input);
 	g_slist_free (output);
@@ -1274,8 +1270,6 @@ brasero_vob_export_caps (BraseroPlugin *plugin, gchar **error)
 					 BRASERO_AUDIO_FORMAT_AC3|
 					 BRASERO_AUDIO_FORMAT_MP2|
 					 BRASERO_AUDIO_FORMAT_RAW|
-					 BRASERO_AUDIO_FORMAT_44100|
-					 BRASERO_AUDIO_FORMAT_48000|
 					 BRASERO_VIDEO_FORMAT_VIDEO_DVD);
 	brasero_plugin_link_caps (plugin, output, input);
 	g_slist_free (output);
diff --git a/src/brasero-audio-disc.c b/src/brasero-audio-disc.c
index 88da785..f9887ad 100644
--- a/src/brasero-audio-disc.c
+++ b/src/brasero-audio-disc.c
@@ -41,6 +41,7 @@
 
 #include "brasero-misc.h"
 #include "brasero-io.h"
+#include "brasero-notify.h"
 
 #include "brasero-tags.h"
 #include "brasero-track-stream-cfg.h"
@@ -130,6 +131,7 @@ struct _BraseroAudioDiscPrivate {
 
 	GtkWidget *tree;
 
+	GtkWidget *message;
 	GtkUIManager *manager;
 	GtkActionGroup *disc_group;
 
@@ -219,6 +221,8 @@ enum {
 #define BRASERO_SECTORS_TO_TIME(sectors)	(gint64) (sectors * GST_SECOND / 75)
 #define COL_KEY "column_key"
 
+#define BRASERO_AUDIO_DISC_CONTEXT		1000
+
 static void brasero_audio_disc_iface_disc_init (BraseroDiscIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (BraseroAudioDisc,
@@ -301,6 +305,13 @@ brasero_audio_disc_add_ui (BraseroDisc *disc,
 
 	audio_disc = BRASERO_AUDIO_DISC (disc);
 
+	if (audio_disc->priv->message) {
+		g_object_unref (audio_disc->priv->message);
+		audio_disc->priv->message = NULL;
+	}
+
+	audio_disc->priv->message = g_object_ref (message);
+
 	if (!audio_disc->priv->disc_group) {
 		audio_disc->priv->disc_group = gtk_action_group_new (BRASERO_DISC_ACTION);
 		gtk_action_group_set_translation_domain (audio_disc->priv->disc_group, GETTEXT_PACKAGE);
@@ -517,6 +528,8 @@ brasero_audio_disc_reset_real (BraseroAudioDisc *disc)
 		gtk_tree_path_free (disc->priv->selected_path);
 		disc->priv->selected_path = NULL;
 	}
+
+	brasero_notify_message_remove (BRASERO_NOTIFY (disc->priv->message), BRASERO_AUDIO_DISC_CONTEXT);
 }
 
 static void
@@ -532,6 +545,11 @@ brasero_audio_disc_finalize (GObject *object)
 	cobj->priv->add_dir = NULL;
 	cobj->priv->add_playlist = NULL;
 
+	if (cobj->priv->message) {
+		g_object_unref (cobj->priv->message);
+		cobj->priv->message = NULL;
+	}
+
 	if (cobj->priv->manager) {
 		g_object_unref (cobj->priv->manager);
 		cobj->priv->manager = NULL;
@@ -795,6 +813,70 @@ brasero_audio_disc_unreadable_dialog (BraseroAudioDisc *disc,
 }
 
 static void
+brasero_audio_disc_wav_dts_response_cb (GtkButton *button,
+                                        GtkResponseType response,
+                                        BraseroAudioDisc *disc)
+{
+	BraseroSessionCfg *session;
+	GtkTreeModel *model;
+
+	model = gtk_tree_view_get_model (GTK_TREE_VIEW (disc->priv->tree));
+	session = brasero_video_tree_model_get_session (BRASERO_VIDEO_TREE_MODEL (model));
+
+	if (response == GTK_RESPONSE_OK)
+		brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (session),
+		                                  BRASERO_SESSION_STREAM_AUDIO_FORMAT,
+		                                  BRASERO_AUDIO_FORMAT_DTS);
+}
+
+static void
+brasero_audio_disc_wav_dts_file_dialog (BraseroAudioDisc *disc)
+{
+	GtkWidget *message;
+	BraseroSessionCfg *session;
+	GtkTreeModel *model;
+
+	if (brasero_notify_get_message_by_context_id (BRASERO_NOTIFY (disc->priv->message),
+	                                              BRASERO_AUDIO_DISC_CONTEXT))
+		return;
+
+	/* Add a tag (RAW by default) so that we won't try to display this message again */
+	model = gtk_tree_view_get_model (GTK_TREE_VIEW (disc->priv->tree));
+	session = brasero_video_tree_model_get_session (BRASERO_VIDEO_TREE_MODEL (model));
+	brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (session),
+	                                  BRASERO_SESSION_STREAM_AUDIO_FORMAT,
+	                                  BRASERO_AUDIO_FORMAT_RAW);
+
+	message = brasero_notify_message_add (BRASERO_NOTIFY (disc->priv->message),
+					      _("Do you want to create an audio CD with DTS tracks?"),
+					      _("Some of the selected songs are suitable to create DTS tracks."
+					        "\nThis type of audio CD track provides a higher quality for sound but can only be played by specific digital players."
+					        "\nNOTE: if you agree normalization will not be applied to these tracks."),
+					      0,
+					      BRASERO_AUDIO_DISC_CONTEXT);
+
+	brasero_disc_message_set_image (BRASERO_DISC_MESSAGE (message),
+					GTK_MESSAGE_INFO);
+
+	brasero_notify_button_add (BRASERO_NOTIFY (disc->priv->message),
+				   BRASERO_DISC_MESSAGE (message),
+				   _("Create _Regular Tracks"),
+				   _("Click here to burn all songs as regular tracks"),
+				   GTK_RESPONSE_NO);
+
+	brasero_notify_button_add (BRASERO_NOTIFY (disc->priv->message),
+				   BRASERO_DISC_MESSAGE (message),
+				   _("Create _DTS Tracks"),
+				   _("Click here to burn all suitable songs as DTS tracks"),
+				   GTK_RESPONSE_OK);
+
+	g_signal_connect (BRASERO_DISC_MESSAGE (message),
+			  "response",
+			  G_CALLBACK (brasero_audio_disc_wav_dts_response_cb),
+			  disc);
+}
+
+static void
 brasero_audio_disc_session_changed (BraseroSessionCfg *session,
 				    BraseroAudioDisc *self)
 {
@@ -802,12 +884,14 @@ brasero_audio_disc_session_changed (BraseroSessionCfg *session,
 	GSList *tracks;
 	gboolean notready;
 	BraseroStatus *status;
+	gboolean should_use_dts;
 
 	if (!GTK_WIDGET (self)->window)
 		return;
 
 	/* make sure all tracks have video */
 	notready = FALSE;
+	should_use_dts = FALSE;
 	status = brasero_status_new ();
 	tracks = brasero_burn_session_get_tracks (BRASERO_BURN_SESSION (session));
 	for (; tracks; tracks = next) {
@@ -884,9 +968,11 @@ brasero_audio_disc_session_changed (BraseroSessionCfg *session,
 			continue;
 		}
 
+		if ((format & BRASERO_AUDIO_FORMAT_DTS) != 0)
+			should_use_dts = TRUE;
+
 		if (BRASERO_STREAM_FORMAT_HAS_VIDEO (format)) {
 			gboolean res;
-
 			gchar *uri;
 
 			uri = brasero_track_stream_get_source (track, TRUE);
@@ -898,6 +984,10 @@ brasero_audio_disc_session_changed (BraseroSessionCfg *session,
 		}
 	}
 	brasero_status_free (status);
+
+	if (should_use_dts
+	&&  brasero_burn_session_tag_lookup (BRASERO_BURN_SESSION (session), BRASERO_SESSION_STREAM_AUDIO_FORMAT, NULL) != BRASERO_BURN_OK)
+		brasero_audio_disc_wav_dts_file_dialog (self);
 }
 
 static BraseroDiscResult



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]