[brasero/gnome-2-26] Fix 582513 – Bogus VIDEO_TS directory error if AUDIO_TS directory present



commit ca0098866b6e0243e9cee5d8d30e0b0b23c355df
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Sun Jun 28 14:00:25 2009 +0200

    Fix 582513 â?? Bogus VIDEO_TS directory error if AUDIO_TS directory present
    Now video DVD should work from burn:// URI

 src/burn-mkisofs-base.c |   80 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 71 insertions(+), 9 deletions(-)
---
diff --git a/src/burn-mkisofs-base.c b/src/burn-mkisofs-base.c
index 0fcc5b6..8281d22 100644
--- a/src/burn-mkisofs-base.c
+++ b/src/burn-mkisofs-base.c
@@ -491,6 +491,30 @@ brasero_mkisofs_base_write_grafts (BraseroMkisofsBase *base,
 }
 
 static BraseroBurnResult
+brasero_mkisofs_base_create_video_empty (BraseroMkisofsBase *base,
+					 const gchar *disc_path)
+{
+	gchar *path;
+
+	BRASERO_BURN_LOG ("Creating an empty Video or Audio directory");
+
+	if (base->found_video_ts)
+		return BRASERO_BURN_OK;
+
+	base->found_video_ts = TRUE;
+
+	path = g_build_path (G_DIR_SEPARATOR_S,
+			     base->videodir,
+			     disc_path,
+			     NULL);
+
+	g_mkdir_with_parents (path, S_IRWXU);
+	g_free (path);
+
+	return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
 brasero_mkisofs_base_empty_directory (BraseroMkisofsBase *base,
 				      const gchar *disc_path,
 				      GError **error)
@@ -500,6 +524,23 @@ brasero_mkisofs_base_empty_directory (BraseroMkisofsBase *base,
 	gchar *graft_point;
 	const gchar *path;
 
+	/* This is a special case when the URI is NULL which can happen mainly
+	 * when we have to deal with burn:// uri. */
+	if (base->videodir) {
+		/* try with "VIDEO_TS", "VIDEO_TS/", "VIDEO_TS/" and "/VIDEO_TS/"
+		 * to make sure we don't miss one */
+		if (!strcmp (disc_path, "VIDEO_TS")
+		||  !strcmp (disc_path, "/VIDEO_TS")
+		||  !strcmp (disc_path, "VIDEO_TS/")
+		||  !strcmp (disc_path, "/VIDEO_TS/")) {
+			brasero_mkisofs_base_create_video_empty (base, disc_path);
+
+			/* NOTE: joliet cannot be used in this case so that's
+			 * perfectly fine to forget about it. */
+			return BRASERO_BURN_OK;
+		}
+	}
+
 	/* Mangle the name in case joliet is required */
 	if (base->use_joliet) {
 		base->joliet = brasero_mkisofs_base_mangle_joliet_name (base->joliet,
@@ -527,7 +568,12 @@ brasero_mkisofs_base_process_video_graft (BraseroMkisofsBase *base,
 	gchar *path;
 	int res;
 
-	path = g_filename_from_uri (graft->uri, NULL, NULL);
+	/* Make sure it's a path and not a URI */
+	if (!strncmp (graft->uri, "file:", 5))
+		path = g_filename_from_uri (graft->uri, NULL, NULL);
+	else
+		path = g_strdup (graft->uri);
+
 	if (g_str_has_suffix (path, G_DIR_SEPARATOR_S)) {
 		gchar *tmp;
 
@@ -597,13 +643,14 @@ brasero_mkisofs_base_add_graft (BraseroMkisofsBase *base,
 	 * passed by the calling plugins. */
 	if (base->videodir) {
 		BraseroBurnResult res;
+		gchar *parent;
 
 		/* try with "VIDEO_TS", "VIDEO_TS/", "VIDEO_TS/" and "/VIDEO_TS/"
 		 * to make sure we don't miss one */
-		if (!strcmp (graft->path , "VIDEO_TS")
-		||  !strcmp (graft->path , "/VIDEO_TS")
-		||  !strcmp (graft->path , "VIDEO_TS/")
-		||  !strcmp (graft->path , "/VIDEO_TS/")) {
+		if (!strcmp (graft->path, "VIDEO_TS")
+		||  !strcmp (graft->path, "/VIDEO_TS")
+		||  !strcmp (graft->path, "VIDEO_TS/")
+		||  !strcmp (graft->path, "/VIDEO_TS/")) {
 			res = brasero_mkisofs_base_process_video_graft (base, graft, error);
 			if (res != BRASERO_BURN_OK)
 				return res;
@@ -611,11 +658,26 @@ brasero_mkisofs_base_add_graft (BraseroMkisofsBase *base,
 			base->found_video_ts = TRUE;
 			return BRASERO_BURN_OK;
 		}
-		else if (!strcmp (graft->path , "AUDIO_TS")
-		     ||  !strcmp (graft->path , "/AUDIO_TS")
-		     ||  !strcmp (graft->path , "AUDIO_TS/")
-		     ||  !strcmp (graft->path , "/AUDIO_TS/"))
+
+		if (!strcmp (graft->path, "AUDIO_TS")
+		||  !strcmp (graft->path, "/AUDIO_TS")
+		||  !strcmp (graft->path, "AUDIO_TS/")
+		||  !strcmp (graft->path, "/AUDIO_TS/"))
+			return brasero_mkisofs_base_process_video_graft (base, graft, error);
+
+		/* it could also be a direct child of the VIDEO_TS directory */
+		parent = g_path_get_dirname (graft->path);
+		if (!strcmp (parent, "VIDEO_TS")
+		||  !strcmp (parent, "/VIDEO_TS")
+		||  !strcmp (parent, "VIDEO_TS/")
+		||  !strcmp (parent, "/VIDEO_TS/")) {
+			if (!base->found_video_ts)
+				brasero_mkisofs_base_create_video_empty (base, parent);
+
+			g_free (parent);
 			return brasero_mkisofs_base_process_video_graft (base, graft, error);
+		}
+		g_free (parent);
 	}
 
 	/* add the graft point */



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