[brasero] Detect wav files which have DTS inside



commit e14ed1581aa006dbffda9f6c4507300b22a633c6
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Fri Sep 18 18:11:12 2009 +0200

    Detect wav files which have DTS inside

 libbrasero-utils/brasero-io.c       |    3 +++
 libbrasero-utils/brasero-io.h       |    2 ++
 libbrasero-utils/brasero-metadata.c |   31 +++++++++++++++++++++++++++++++
 libbrasero-utils/brasero-metadata.h |    1 +
 4 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/libbrasero-utils/brasero-io.c b/libbrasero-utils/brasero-io.c
index c51d72f..fea7881 100644
--- a/libbrasero-utils/brasero-io.c
+++ b/libbrasero-utils/brasero-io.c
@@ -845,6 +845,9 @@ brasero_io_set_metadata_attributes (GFileInfo *info,
 
 		if (metadata->rate)
 			g_file_info_set_attribute_int32 (info, BRASERO_IO_RATE, metadata->rate);
+
+		if (metadata->has_dts)
+			g_file_info_set_attribute_boolean (info, BRASERO_IO_HAS_DTS, TRUE);
 	}
 
 	g_file_info_set_attribute_boolean (info, BRASERO_IO_HAS_VIDEO, metadata->has_video);
diff --git a/libbrasero-utils/brasero-io.h b/libbrasero-utils/brasero-io.h
index 0da4d02..7797605 100644
--- a/libbrasero-utils/brasero-io.h
+++ b/libbrasero-utils/brasero-io.h
@@ -84,6 +84,8 @@ typedef enum {
 #define BRASERO_IO_HAS_VIDEO		"metadata::has_video"
 #define BRASERO_IO_IS_SEEKABLE		"metadata::is_seekable"
 
+#define BRASERO_IO_HAS_DTS			"metadata::audio::wav::has_dts"
+
 #define BRASERO_IO_CHANNELS		"metadata::audio::channels"
 #define BRASERO_IO_RATE				"metadata::audio::rate"
 
diff --git a/libbrasero-utils/brasero-metadata.c b/libbrasero-utils/brasero-metadata.c
index 5593c7d..b5ad6a1 100644
--- a/libbrasero-utils/brasero-metadata.c
+++ b/libbrasero-utils/brasero-metadata.c
@@ -187,6 +187,7 @@ brasero_metadata_info_copy (BraseroMetadataInfo *dest,
 	if (!dest || !src)
 		return;
 
+	dest->has_dts = src->has_dts;
 	dest->rate = src->rate;
 	dest->channels = src->channels;
 	dest->isrc = src->isrc;
@@ -531,6 +532,36 @@ 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;
+
+		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");
+		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);
+
+			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") != NULL);
+
+			BRASERO_UTILS_LOG ("Wav file has dts: %s", priv->info->has_dts? "yes":"no");
+
+			gst_object_unref (wavparse);
+		}
+	}
 	else
 		priv->info->type = g_strdup (mime);
 
diff --git a/libbrasero-utils/brasero-metadata.h b/libbrasero-utils/brasero-metadata.h
index 6da4bb8..87f71ce 100644
--- a/libbrasero-utils/brasero-metadata.h
+++ b/libbrasero-utils/brasero-metadata.h
@@ -82,6 +82,7 @@ typedef struct {
 	guint is_seekable:1;
 	guint has_audio:1;
 	guint has_video:1;
+	guint has_dts:1;
 } BraseroMetadataInfo;
 
 void



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