[brasero] Merge the cdrdao and the toc2cue plugins to make sure that when the directory for temporary images i
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Merge the cdrdao and the toc2cue plugins to make sure that when the directory for temporary images i
- Date: Wed, 25 Nov 2009 14:45:41 +0000 (UTC)
commit 8cdcbfc789db7cdb579ab036aedfeea234ec5eca
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Wed Nov 25 14:29:22 2009 +0100
Merge the cdrdao and the toc2cue plugins to make sure that when the directory for temporary images is on a different file system than the directory for the final image we don't error out
libbrasero-burn/burn-process.c | 35 +++-
plugins/cdrdao/Makefile.am | 11 +-
plugins/cdrdao/burn-cdrdao-common.h | 44 -----
plugins/cdrdao/burn-cdrdao.c | 91 ++++++++-
plugins/cdrdao/burn-toc2cue.c | 362 -----------------------------------
5 files changed, 114 insertions(+), 429 deletions(-)
---
diff --git a/libbrasero-burn/burn-process.c b/libbrasero-burn/burn-process.c
index 35c65d6..e867fc5 100644
--- a/libbrasero-burn/burn-process.c
+++ b/libbrasero-burn/burn-process.c
@@ -97,8 +97,6 @@ struct _BraseroProcessPrivate {
#define BRASERO_PROCESS_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_PROCESS, BraseroProcessPrivate))
-static GObjectClass *parent_class = NULL;
-
void
brasero_process_deferred_error (BraseroProcess *self,
GError *error)
@@ -279,14 +277,14 @@ brasero_process_finished (BraseroProcess *self)
}
/* Tell the world we're done */
- klass->post (BRASERO_JOB (self));
- return BRASERO_BURN_OK;
+ return klass->post (BRASERO_JOB (self));
}
static gboolean
brasero_process_watch_child (gpointer data)
{
int status;
+ BraseroBurnResult result;
BraseroProcessPrivate *priv = BRASERO_PROCESS_PRIVATE (data);
if (waitpid (priv->pid, &status, WNOHANG) <= 0)
@@ -298,9 +296,33 @@ brasero_process_watch_child (gpointer data)
* error message or simply decide all went well, in one word override */
priv->return_status = WEXITSTATUS (status);
priv->watch = 0;
+ priv->pid = 0;
BRASERO_JOB_LOG (data, "process finished with status %i", WEXITSTATUS (status));
- brasero_process_finished (BRASERO_PROCESS (data));
+
+ result = brasero_process_finished (data);
+ if (result == BRASERO_BURN_RETRY) {
+ GError *error = NULL;
+ BraseroJobClass *job_class;
+
+ priv->process_finished = FALSE;
+
+ job_class = BRASERO_JOB_GET_CLASS (data);
+ if (job_class->stop) {
+ result = job_class->stop (data, &error);
+ if (result != BRASERO_BURN_OK) {
+ brasero_job_error (data, error);
+ return FALSE;
+ }
+ }
+
+ if (job_class->start) {
+ /* we were asked by the plugin to restart it */
+ result = job_class->start (data, &error);
+ if (result != BRASERO_BURN_OK)
+ brasero_job_error (data, error);
+ }
+ }
return FALSE;
}
@@ -859,7 +881,7 @@ brasero_process_finalize (GObject *object)
priv->working_directory = NULL;
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (brasero_process_parent_class)->finalize (object);
}
static void
@@ -870,7 +892,6 @@ brasero_process_class_init (BraseroProcessClass *klass)
g_type_class_add_private (klass, sizeof (BraseroProcessPrivate));
- parent_class = g_type_class_peek_parent(klass);
object_class->finalize = brasero_process_finalize;
job_class->start = brasero_process_start;
diff --git a/plugins/cdrdao/Makefile.am b/plugins/cdrdao/Makefile.am
index ac8582d..2c517fd 100644
--- a/plugins/cdrdao/Makefile.am
+++ b/plugins/cdrdao/Makefile.am
@@ -18,17 +18,8 @@ INCLUDES = \
#cdrdao
cdrdaodir = $(libdir)/brasero/plugins
cdrdao_LTLIBRARIES = libbrasero-cdrdao.la
-libbrasero_cdrdao_la_SOURCES = burn-cdrdao.c \
- burn-cdrdao-common.h
+libbrasero_cdrdao_la_SOURCES = burn-cdrdao.c
libbrasero_cdrdao_la_LIBADD = $(BRASERO_GLIB_LIBS) $(BRASERO_GCONF_LIBS) ../../libbrasero-media/libbrasero-media.la ../../libbrasero-burn/libbrasero-burn.la
libbrasero_cdrdao_la_LDFLAGS = -module -avoid-version
-#toc2cue
-toc2cuedir = $(libdir)/brasero/plugins
-toc2cue_LTLIBRARIES = libbrasero-toc2cue.la
-libbrasero_toc2cue_la_SOURCES = burn-toc2cue.c \
- burn-cdrdao-common.h
-libbrasero_toc2cue_la_LIBADD = $(BRASERO_GLIB_LIBS) ../../libbrasero-burn/libbrasero-burn.la
-libbrasero_toc2cue_la_LDFLAGS = -module -avoid-version
-
-include $(top_srcdir)/git.mk
diff --git a/plugins/cdrdao/burn-cdrdao.c b/plugins/cdrdao/burn-cdrdao.c
index 60d626a..ebc742e 100644
--- a/plugins/cdrdao/burn-cdrdao.c
+++ b/plugins/cdrdao/burn-cdrdao.c
@@ -45,7 +45,6 @@
#include <gconf/gconf-client.h>
-#include "burn-cdrdao-common.h"
#include "brasero-error.h"
#include "brasero-plugin-registration.h"
#include "burn-job.h"
@@ -55,6 +54,7 @@
#include "brasero-drive.h"
#include "brasero-medium.h"
+#define CDRDAO_DESCRIPTION N_("cdrdao burning suite")
#define BRASERO_TYPE_CDRDAO (brasero_cdrdao_get_type ())
#define BRASERO_CDRDAO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), BRASERO_TYPE_CDRDAO, BraseroCdrdao))
@@ -66,7 +66,8 @@
BRASERO_PLUGIN_BOILERPLATE (BraseroCdrdao, brasero_cdrdao, BRASERO_TYPE_PROCESS, BraseroProcess);
struct _BraseroCdrdaoPrivate {
- guint use_raw:1;
+ gchar *tmp_toc_path;
+ guint use_raw:1;
};
typedef struct _BraseroCdrdaoPrivate BraseroCdrdaoPrivate;
#define BRASERO_CDRDAO_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_CDRDAO, BraseroCdrdaoPrivate))
@@ -439,17 +440,72 @@ brasero_cdrdao_set_argv_blank (BraseroCdrdao *cdrdao,
}
static BraseroBurnResult
+brasero_cdrdao_post (BraseroJob *job)
+{
+ BraseroCdrdaoPrivate *priv;
+
+ priv = BRASERO_CDRDAO_PRIVATE (job);
+ if (!priv->tmp_toc_path) {
+ brasero_job_finished_session (job);
+ return BRASERO_BURN_OK;
+ }
+
+ /* we have to run toc2cue now to convert the toc file into a cue file */
+ return BRASERO_BURN_RETRY;
+}
+
+static BraseroBurnResult
+brasero_cdrdao_start_toc2cue (BraseroCdrdao *cdrdao,
+ GPtrArray *argv,
+ GError **error)
+{
+ gchar *cue_output;
+ BraseroBurnResult result;
+ BraseroCdrdaoPrivate *priv;
+
+ priv = BRASERO_CDRDAO_PRIVATE (cdrdao);
+
+ g_ptr_array_add (argv, g_strdup ("toc2cue"));
+
+ g_ptr_array_add (argv, priv->tmp_toc_path);
+ priv->tmp_toc_path = NULL;
+
+ result = brasero_job_get_image_output (BRASERO_JOB (cdrdao),
+ NULL,
+ &cue_output);
+ if (result != BRASERO_BURN_OK)
+ return result;
+
+ g_ptr_array_add (argv, cue_output);
+
+ /* if there is a file toc2cue will fail */
+ g_remove (cue_output);
+
+ brasero_job_set_current_action (BRASERO_JOB (cdrdao),
+ BRASERO_BURN_ACTION_CREATING_IMAGE,
+ _("Converting toc file"),
+ TRUE);
+
+ return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
brasero_cdrdao_set_argv_image (BraseroCdrdao *cdrdao,
GPtrArray *argv,
GError **error)
{
gchar *image = NULL, *toc = NULL;
BraseroTrackType *output = NULL;
+ BraseroCdrdaoPrivate *priv;
BraseroBurnResult result;
BraseroJobAction action;
BraseroDrive *drive;
BraseroTrack *track;
+ priv = BRASERO_CDRDAO_PRIVATE (cdrdao);
+ if (priv->tmp_toc_path)
+ return brasero_cdrdao_start_toc2cue (cdrdao, argv, error);
+
g_ptr_array_add (argv, g_strdup ("cdrdao"));
g_ptr_array_add (argv, g_strdup ("read-cd"));
g_ptr_array_add (argv, g_strdup ("--device"));
@@ -479,7 +535,9 @@ brasero_cdrdao_set_argv_image (BraseroCdrdao *cdrdao,
return result;
}
}
- else {
+ else if (brasero_track_type_get_image_format (output) == BRASERO_IMAGE_FORMAT_CUE) {
+ /* NOTE: we don't generate the .cue file right away; we'll call
+ * toc2cue right after we finish */
result = brasero_job_get_image_output (BRASERO_JOB (cdrdao),
&image,
NULL);
@@ -487,15 +545,19 @@ brasero_cdrdao_set_argv_image (BraseroCdrdao *cdrdao,
brasero_track_type_free (output);
return result;
}
-
+
result = brasero_job_get_tmp_file (BRASERO_JOB (cdrdao),
NULL,
&toc,
error);
if (result != BRASERO_BURN_OK) {
+ g_free (image);
brasero_track_type_free (output);
return result;
}
+
+ /* save the temporary toc path to resuse it later. */
+ priv->tmp_toc_path = g_strdup (toc);
}
brasero_track_type_free (output);
@@ -586,7 +648,7 @@ brasero_cdrdao_class_init (BraseroCdrdaoClass *klass)
process_class->stderr_func = brasero_cdrdao_read_stderr;
process_class->set_argv = brasero_cdrdao_set_argv;
- process_class->post = brasero_job_finished_session;
+ process_class->post = brasero_cdrdao_post;
}
static void
@@ -602,13 +664,20 @@ brasero_cdrdao_init (BraseroCdrdao *obj)
priv->use_raw = gconf_client_get_bool (client,
GCONF_KEY_RAW_FLAG,
NULL);
-
g_object_unref (client);
}
static void
brasero_cdrdao_finalize (GObject *object)
{
+ BraseroCdrdaoPrivate *priv;
+
+ priv = BRASERO_CDRDAO_PRIVATE (object);
+ if (priv->tmp_toc_path) {
+ g_free (priv->tmp_toc_path);
+ priv->tmp_toc_path = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -649,7 +718,11 @@ brasero_cdrdao_export_caps (BraseroPlugin *plugin)
/* an image can be created ... */
output = brasero_caps_image_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
BRASERO_IMAGE_FORMAT_CDRDAO);
+ brasero_plugin_link_caps (plugin, output, input);
+ g_slist_free (output);
+ output = brasero_caps_image_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
+ BRASERO_IMAGE_FORMAT_CUE);
brasero_plugin_link_caps (plugin, output, input);
g_slist_free (output);
@@ -710,4 +783,10 @@ brasero_plugin_check_config (BraseroPlugin *plugin)
"version",
"Cdrdao version %d.%d.%d - (C) Andreas Mueller <andreas daneb de>",
version);
+
+ brasero_plugin_test_app (plugin,
+ "toc2cue",
+ "-V",
+ "%d.%d.%d",
+ version);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]