nautilus-cd-burner r2124 - in trunk: . src



Author: mccann
Date: Mon Jan 21 02:59:48 2008
New Revision: 2124
URL: http://svn.gnome.org/viewvc/nautilus-cd-burner?rev=2124&view=rev

Log:
2008-01-20  William Jon McCann  <mccann jhu edu>

	* src/make-iso.c: (nautilus_burn_iso_graft_get_info),
	(nautilus_burn_iso_make_from_graft):
	* src/make-iso.h:
	* src/nautilus-burn-recorder.c:
	(nautilus_burn_recorder_write_growisofs):
	* src/nautilus-burn-recorder.h:
	* src/ncb-operation.c: (burn_folder_is_dvd_video),
	(create_track_from_burn_folder):
	Add support for creating DVD Video
	based on patch from Fabio Bonelli <fabiobonelli libero it>
	Fixes #341622



Modified:
   trunk/ChangeLog
   trunk/src/make-iso.c
   trunk/src/make-iso.h
   trunk/src/nautilus-burn-recorder.c
   trunk/src/nautilus-burn-recorder.h
   trunk/src/ncb-operation.c

Modified: trunk/src/make-iso.c
==============================================================================
--- trunk/src/make-iso.c	(original)
+++ trunk/src/make-iso.c	Mon Jan 21 02:59:48 2008
@@ -944,10 +944,11 @@
 }
 
 gboolean
-nautilus_burn_iso_graft_get_info (NautilusBurnIsoGraft *graft,
-				  guint64              *size,
-				  gboolean             *use_joliet_out,
-				  GError              **error)
+nautilus_burn_iso_graft_get_info (NautilusBurnIsoGraft	 *graft,
+				  guint64		 *size,
+				  gboolean		 *use_joliet_out,
+				  gboolean		 *use_udf,
+				  GError		**error)
 {
 	GPtrArray            *argv;
 	gboolean              use_joliet;
@@ -975,6 +976,9 @@
 	if (use_joliet) {
 		g_ptr_array_add (argv, "-J");
 	}
+	if (use_udf) {
+		g_ptr_array_add (argv, "-udf");
+	}
 	if (ncb_mkisofs_supports_utf8 ()) {
 		g_ptr_array_add (argv, "-input-charset");
 		g_ptr_array_add (argv, "utf8");
@@ -1186,6 +1190,7 @@
 	guint64               iso_size;
 	goffset               size;
 	gboolean              use_joliet;
+	gboolean              use_udf	= FALSE;
 	int                   result    = NAUTILUS_BURN_ISO_RESULT_ERROR;
 	char                 *dirname;
 	GError               *sub_error;
@@ -1196,6 +1201,8 @@
 
 	use_joliet = (flags & NAUTILUS_BURN_IMAGE_CREATE_JOLIET);
 
+	use_udf = (flags & NAUTILUS_BURN_IMAGE_CREATE_UDF);
+
 	if (type) {
 		*type = NAUTILUS_BURN_IMAGE_TYPE_ISO9660;
 	}
@@ -1212,7 +1219,7 @@
 	iso->priv->filename = g_strdup (filename);
 
 	sub_error = NULL;
-	if (! nautilus_burn_iso_graft_get_info (graft, &iso_size, &use_joliet, &sub_error)) {
+	if (! nautilus_burn_iso_graft_get_info (graft, &iso_size, &use_joliet, &use_udf, &sub_error)) {
 		g_propagate_error (error, sub_error);
 		return NAUTILUS_BURN_ISO_RESULT_ERROR;
 	}
@@ -1250,6 +1257,9 @@
 	if (use_joliet) {
 		g_ptr_array_add (argv, "-J");
 	}
+	if (use_udf) {
+		g_ptr_array_add (argv, "-udf");
+	}
 	if (ncb_mkisofs_supports_utf8 ()) {
 		g_ptr_array_add (argv, "-input-charset");
 		g_ptr_array_add (argv, "utf8");

Modified: trunk/src/make-iso.h
==============================================================================
--- trunk/src/make-iso.h	(original)
+++ trunk/src/make-iso.h	Mon Jan 21 02:59:48 2008
@@ -51,7 +51,17 @@
 typedef enum {
 	NAUTILUS_BURN_IMAGE_CREATE_NONE		= 0,
 	NAUTILUS_BURN_IMAGE_CREATE_DEBUG	= 1 << 0,
-	NAUTILUS_BURN_IMAGE_CREATE_JOLIET	= 1 << 2
+	NAUTILUS_BURN_IMAGE_CREATE_JOLIET	= 1 << 2,
+
+	/* From mkisofs' man page:
+	 * UDF support is currently in alpha status and for
+	 * this reason, it is not possible to create UDF only images.
+	 *
+	 * UDF data structures are  currently  coupled  to
+ 	 * the Joliet structures, so there are many pitfalls with the current
+ 	 * implementation. There is no UID/GID support, there is no POSIX
+ 	 * permission support, there is no support for symlinks. */
+	NAUTILUS_BURN_IMAGE_CREATE_UDF		= 1 << 3
 } NautilusBurnImageCreateFlags;
 
 typedef enum {
@@ -100,6 +110,7 @@
 gboolean               nautilus_burn_iso_graft_get_info (NautilusBurnIsoGraft *graft,
 							 guint64              *size,
 							 gboolean             *use_joliet,
+							 gboolean             *use_udf,
 							 GError              **error);
 
 NautilusBurnIso * nautilus_burn_iso_new             (void);

Modified: trunk/src/nautilus-burn-recorder.c
==============================================================================
--- trunk/src/nautilus-burn-recorder.c	(original)
+++ trunk/src/nautilus-burn-recorder.c	Mon Jan 21 02:59:48 2008
@@ -1171,6 +1171,9 @@
 		if (flags & NAUTILUS_BURN_RECORDER_WRITE_JOLIET) {
 			g_ptr_array_add (argv, "-J");
 		}
+		if (flags & NAUTILUS_BURN_RECORDER_WRITE_UDF) {
+			g_ptr_array_add (argv, "-udf");
+		}
 
 		g_ptr_array_add (argv, "-V");
 		g_ptr_array_add (argv, (char *) t->contents.graft_list.label);

Modified: trunk/src/nautilus-burn-recorder.h
==============================================================================
--- trunk/src/nautilus-burn-recorder.h	(original)
+++ trunk/src/nautilus-burn-recorder.h	Mon Jan 21 02:59:48 2008
@@ -95,7 +95,8 @@
 	NAUTILUS_BURN_RECORDER_WRITE_DEBUG		= 1 << 4,
 	NAUTILUS_BURN_RECORDER_WRITE_OVERBURN		= 1 << 5,
 	NAUTILUS_BURN_RECORDER_WRITE_BURNPROOF		= 1 << 6,
-	NAUTILUS_BURN_RECORDER_WRITE_JOLIET		= 1 << 7
+	NAUTILUS_BURN_RECORDER_WRITE_JOLIET		= 1 << 7,
+	NAUTILUS_BURN_RECORDER_WRITE_UDF		= 1 << 8
 } NautilusBurnRecorderWriteFlags;
 
 typedef enum {

Modified: trunk/src/ncb-operation.c
==============================================================================
--- trunk/src/ncb-operation.c	(original)
+++ trunk/src/ncb-operation.c	Mon Jan 21 02:59:48 2008
@@ -1272,6 +1272,74 @@
 
 }
 
+/* Checks if the burn folder seems to be a wannabe
+ * DVD Video */
+static gboolean
+burn_folder_is_dvd_video (void)
+{
+	GFile           *file;
+	GFileEnumerator *enumerator;
+	gboolean	 done;
+	gboolean	 is_dvd_video;
+	GError          *error;
+
+	is_dvd_video = FALSE;
+
+	file = g_file_new_for_uri (BURN_URI);
+
+	error = NULL;
+	enumerator = g_file_enumerate_children (file,
+						G_FILE_ATTRIBUTE_STANDARD_NAME,
+						0,
+						NULL,
+						&error);
+	if (enumerator == NULL) {
+		g_warning ("Could not open burn uri %s: %s\n",
+			   BURN_URI,
+			   error->message);
+		g_error_free (error);
+		return FALSE;
+	}
+
+	done = FALSE;
+	while (! done) {
+		GFileInfo  *info;
+		const char *name;
+		char       *filename;
+
+		info = g_file_enumerator_next_file (enumerator, NULL, NULL);
+		if (info == NULL) {
+			break;
+		}
+
+		name = g_file_info_get_name (info);
+
+		/* Skip "." and "..".  */
+		if (name != NULL
+		    && name [0] == '.'
+		    && (name [1] == 0
+			|| (name [1] == '.' && name [2] == 0))) {
+			g_object_unref (info);
+			continue;
+		}
+
+		g_object_unref (info);
+
+		filename = g_utf8_strup (name, -1);
+		if (strcmp (filename, "VIDEO_TS") == 0) {
+			done = TRUE;
+			is_dvd_video = TRUE;
+		}
+
+		g_free (filename);
+	}
+
+	g_object_unref (file);
+	g_object_unref (enumerator);
+
+	return is_dvd_video;
+}
+
 static NautilusBurnRecorderTrack *
 create_track_from_burn_folder (NcbOperation *operation,
 			       const char   *source_name,
@@ -1285,6 +1353,7 @@
 	NautilusBurnDrive           *drive;
 	char                        *label;
 	char                        *iso_filename;
+	gboolean		     use_udf;
 	NautilusBurnIsoGraft        *graft;
 	NautilusBurnMediaType        media_type;
 	guint64                      source_size;
@@ -1304,6 +1373,13 @@
 		image_flags |= NAUTILUS_BURN_IMAGE_CREATE_JOLIET;
 	}
 
+	/* Create a UDF image if we are trying to burn a DVD Video,
+	 * otherwise we can't play it. */
+	use_udf = burn_folder_is_dvd_video ();
+	if (use_udf) {
+		image_flags |= NAUTILUS_BURN_IMAGE_CREATE_UDF;
+	}
+
 	ncb_selection_get_label (operation->priv->selection, &label);
 
 	iso_filename = NULL;
@@ -1344,7 +1420,7 @@
 			ncb_operation_temp_files_add (operation, (char *)l->data);
 		}
 
-		if (! nautilus_burn_iso_graft_get_info (graft, &size, &use_joliet, error)) {
+		if (! nautilus_burn_iso_graft_get_info (graft, &size, &use_joliet, &use_udf, error)) {
 			nautilus_burn_iso_graft_free (graft, TRUE);
 			goto done;
 		}
@@ -1352,6 +1428,9 @@
 		if (use_joliet) {
 			operation->priv->record_flags |= NAUTILUS_BURN_RECORDER_WRITE_JOLIET;
 		}
+		if (use_udf) {
+			operation->priv->record_flags |= NAUTILUS_BURN_RECORDER_WRITE_UDF;
+		}
 
 		track = create_graft_track (graft, label);
 



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