brasero r2185 - in trunk: . libbrasero-burn libbrasero-burn/plugins/local-track po src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r2185 - in trunk: . libbrasero-burn libbrasero-burn/plugins/local-track po src
- Date: Sun, 29 Mar 2009 15:50:32 +0000 (UTC)
Author: philippr
Date: Sun Mar 29 15:50:32 2009
New Revision: 2185
URL: http://svn.gnome.org/viewvc/brasero?rev=2185&view=rev
Log:
2009-03-29 Philippe Rouquier <bonfire-app wanadoo fr>
Add forgotten files from previous commit
Add a new type of track based on BraseroTrackImage that autoconfigures
things
* libbrasero-burn/Makefile.am:
* libbrasero-burn/brasero-src-image.c (brasero_src_image_save),
(brasero_src_image_error), (brasero_src_image_update),
(brasero_image_src_track_changed_cb), (brasero_src_image_changed),
(brasero_src_image_set_formats),
(brasero_src_image_get_current_uri), (brasero_src_image_clicked),
(brasero_src_image_init), (_get_session_image_track),
(brasero_src_image_set_property):
* libbrasero-burn/brasero-track-data.c (brasero_graft_point_free),
(brasero_graft_point_copy), (brasero_track_data_set_source),
(brasero_track_data_add_fs), (brasero_track_data_rm_fs),
(brasero_track_data_set_data_blocks),
(brasero_track_data_set_file_num), (brasero_track_data_get_grafts),
(brasero_track_data_get_excluded), (brasero_track_data_get_paths),
(brasero_track_data_get_file_num), (brasero_track_data_get_size),
(brasero_track_data_get_track_type), (brasero_track_data_init),
(brasero_track_data_finalize), (brasero_track_data_class_init),
(brasero_track_data_new):
* libbrasero-burn/brasero-track-data.h:
* libbrasero-burn/brasero-track-disc.c
(brasero_track_disc_set_track_num),
(brasero_track_disc_get_track_num),
(brasero_track_disc_remove_drive),
(brasero_track_disc_medium_changed),
(brasero_track_disc_set_drive), (brasero_track_disc_get_drive),
(brasero_track_disc_get_size), (brasero_track_disc_get_track_type),
(brasero_track_disc_init), (brasero_track_disc_finalize),
(brasero_track_disc_class_init), (brasero_track_disc_new):
* libbrasero-burn/brasero-track-disc.h:
* libbrasero-burn/brasero-track-image-cfg.c
(brasero_track_image_cfg_set_uri),
(brasero_track_image_cfg_get_info_cb),
(brasero_track_image_cfg_get_info_thread),
(brasero_track_image_info_free),
(brasero_track_image_cfg_get_info),
(brasero_track_image_cfg_set_source),
(brasero_track_image_cfg_get_forced_format),
(brasero_track_image_cfg_force_format),
(brasero_track_image_cfg_get_status),
(brasero_track_image_cfg_init), (brasero_track_image_cfg_finalize),
(brasero_track_image_cfg_class_init),
(brasero_track_image_cfg_new):
* libbrasero-burn/brasero-track-image-cfg.h:
* libbrasero-burn/brasero-track-image.c
(brasero_track_image_set_source),
(brasero_track_image_set_block_num),
(brasero_track_image_get_source),
(brasero_track_image_get_toc_source),
(brasero_track_image_get_track_type),
(brasero_track_image_get_size), (brasero_track_image_init),
(brasero_track_image_finalize), (brasero_track_image_class_init),
(brasero_track_image_new):
* libbrasero-burn/brasero-track-image.h:
* libbrasero-burn/brasero-track-stream.c
(brasero_stream_info_free), (brasero_stream_info_copy),
(brasero_track_stream_set_source),
(brasero_track_stream_set_format), (brasero_track_stream_set_info),
(brasero_track_stream_set_boundaries),
(brasero_track_stream_get_source), (brasero_track_stream_get_gap),
(brasero_track_stream_get_start), (brasero_track_stream_get_end),
(brasero_track_stream_get_info), (brasero_track_stream_get_length),
(brasero_track_stream_get_size),
(brasero_track_stream_get_track_type), (brasero_track_stream_init),
(brasero_track_stream_finalize), (brasero_track_stream_class_init),
(brasero_track_stream_new):
* libbrasero-burn/brasero-track-stream.h:
* libbrasero-burn/burn-image-format.c
(brasero_image_format_get_cdrdao_size),
(brasero_image_format_get_cue_size),
(brasero_image_format_identify_cuesheet),
(brasero_image_format_get_iso_size),
(brasero_image_format_get_clone_size):
* libbrasero-burn/burn-image-format.h:
* libbrasero-burn/plugins/local-track/burn-local-image.c
(brasero_local_track_update_track):
* libbrasero-burn/plugins/local-track/burn-uri.c
(brasero_burn_uri_thread):
* src/brasero-app.c (brasero_app_burn_image):
* src/brasero-utils.c (brasero_error_quark), (brasero_utils_init),
(brasero_utils_launch_app):
* src/brasero-utils.h:
Added:
trunk/libbrasero-burn/brasero-track-data.c
trunk/libbrasero-burn/brasero-track-data.h
trunk/libbrasero-burn/brasero-track-disc.c
trunk/libbrasero-burn/brasero-track-disc.h
trunk/libbrasero-burn/brasero-track-image-cfg.c
trunk/libbrasero-burn/brasero-track-image-cfg.h
trunk/libbrasero-burn/brasero-track-image.c
trunk/libbrasero-burn/brasero-track-image.h
trunk/libbrasero-burn/brasero-track-stream.c
trunk/libbrasero-burn/brasero-track-stream.h
Modified:
trunk/ChangeLog
trunk/libbrasero-burn/Makefile.am
trunk/libbrasero-burn/brasero-src-image.c
trunk/libbrasero-burn/burn-image-format.c
trunk/libbrasero-burn/burn-image-format.h
trunk/libbrasero-burn/plugins/local-track/burn-local-image.c
trunk/libbrasero-burn/plugins/local-track/burn-uri.c
trunk/po/ChangeLog
trunk/po/POTFILES.in
trunk/src/brasero-app.c
Modified: trunk/libbrasero-burn/Makefile.am
==============================================================================
--- trunk/libbrasero-burn/Makefile.am (original)
+++ trunk/libbrasero-burn/Makefile.am Sun Mar 29 15:50:32 2009
@@ -133,7 +133,9 @@
brasero-track-image.c \
brasero-track-image.h \
brasero-track-data.c \
- brasero-track-data.h
+ brasero-track-data.h \
+ brasero-track-image-cfg.c \
+ brasero-track-image-cfg.h
EXTRA_DIST = \
libbrasero-marshal.list
Modified: trunk/libbrasero-burn/brasero-src-image.c
==============================================================================
--- trunk/libbrasero-burn/brasero-src-image.c (original)
+++ trunk/libbrasero-burn/brasero-src-image.c Sun Mar 29 15:50:32 2009
@@ -52,6 +52,7 @@
#include "brasero-image-type-chooser.h"
#include "brasero-session-cfg.h"
#include "brasero-track-image.h"
+#include "brasero-track-image-cfg.h"
#include "brasero-src-image.h"
#include "burn-image-format.h"
@@ -59,7 +60,7 @@
struct _BraseroSrcImagePrivate
{
BraseroBurnSession *session;
- BraseroTrackImage *track;
+ BraseroTrackImageCfg *track;
BraseroBurnCaps *caps;
@@ -115,22 +116,22 @@
switch (type.subtype.img_format) {
case BRASERO_IMAGE_FORMAT_BIN:
recent_data.mime_type = (gchar *) mimes [0];
- uri = brasero_track_image_get_source (priv->track, TRUE);
+ uri = brasero_track_image_get_source (BRASERO_TRACK_IMAGE (priv->track), TRUE);
break;
case BRASERO_IMAGE_FORMAT_CUE:
recent_data.mime_type = (gchar *) mimes [1];
- uri = brasero_track_image_get_toc_source (priv->track, TRUE);
+ uri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (priv->track), TRUE);
break;
case BRASERO_IMAGE_FORMAT_CLONE:
recent_data.mime_type = (gchar *) mimes [2];
- uri = brasero_track_image_get_toc_source (priv->track, TRUE);
+ uri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (priv->track), TRUE);
break;
case BRASERO_IMAGE_FORMAT_CDRDAO:
recent_data.mime_type = (gchar *) mimes [3];
- uri = brasero_track_image_get_toc_source (priv->track, TRUE);
+ uri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (priv->track), TRUE);
break;
default:
@@ -149,46 +150,69 @@
}
static void
-brasero_src_image_update (BraseroSrcImage *dialog)
+brasero_src_image_error (BraseroSrcImage *self,
+ GError *error)
+{
+ BraseroSrcImagePrivate *priv;
+ GtkWidget *toplevel;
+
+ priv = BRASERO_SRC_IMAGE_PRIVATE (self);
+ if (priv->file)
+ toplevel = priv->file;
+ else
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
+
+ if (!GTK_IS_WINDOW (toplevel))
+ return;
+
+ brasero_utils_message_dialog (toplevel,
+ _("Please select another image."),
+ error->message,
+ GTK_MESSAGE_ERROR);
+}
+
+static void
+brasero_src_image_update (BraseroSrcImage *self)
{
gchar *uri;
gchar *path;
GFile *file;
gchar *string;
guint64 size = 0;
- gchar *size_string;
+ GError *error = NULL;
+ BraseroBurnResult result;
+ gchar *size_string = NULL;
BraseroSrcImagePrivate *priv;
BraseroTrackType type = { 0, };
- priv = BRASERO_SRC_IMAGE_PRIVATE (dialog);
+ priv = BRASERO_SRC_IMAGE_PRIVATE (self);
if (!priv->track)
return;
- /* Deal with size */
- brasero_track_get_size (BRASERO_TRACK (priv->track), NULL, &size);
- size_string = g_format_size_for_display (size);
-
/* Retrieve a path or an uri */
path = NULL;
brasero_track_get_track_type (BRASERO_TRACK (priv->track), &type);
switch (type.subtype.img_format) {
case BRASERO_IMAGE_FORMAT_NONE:
case BRASERO_IMAGE_FORMAT_BIN:
- uri = brasero_track_image_get_source (priv->track, TRUE);
+ uri = brasero_track_image_get_source (BRASERO_TRACK_IMAGE (priv->track), TRUE);
break;
+ case BRASERO_IMAGE_FORMAT_CLONE:
case BRASERO_IMAGE_FORMAT_CUE:
case BRASERO_IMAGE_FORMAT_CDRDAO:
- case BRASERO_IMAGE_FORMAT_CLONE:
- uri = brasero_track_image_get_source (priv->track, TRUE);
+ uri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (priv->track), TRUE);
break;
default:
- path = NULL;
+ uri = NULL;
break;
}
+ if (!uri)
+ return;
+
file = g_file_new_for_uri (uri);
g_free (uri);
@@ -201,18 +225,40 @@
path = g_file_get_uri (file);
g_object_unref (file);
-
- if (!path) {
- g_free (size_string);
+ if (!path)
return;
+
+ /* See if information retrieval went fine and/or is ready */
+ result = brasero_track_image_cfg_get_status (priv->track, &error);
+ if (result == BRASERO_BURN_NOT_READY) {
+ /* Translators: %s is a path */
+ string = g_strdup_printf (_("\"%s\": loading"), path);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (self), NULL);
+ goto end;
+ }
+ else if (result != BRASERO_BURN_OK) {
+ /* Translators: %s is a path and image refers to a disc image */
+ string = g_strdup_printf (_("\"%s\": unknown image type"), path);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (self), error->message);
+ brasero_src_image_error (self, error);
+ g_error_free (error);
+ goto end;
}
+ gtk_widget_set_tooltip_text (GTK_WIDGET (self), NULL);
+
+ /* Deal with size */
+ brasero_track_get_size (BRASERO_TRACK (priv->track), NULL, &size);
+ size_string = g_format_size_for_display (size);
+
/* NOTE to translators, the first %s is the path of the image
* file and the second its size. */
string = g_strdup_printf (_("\"%s\": %s"), path, size_string);
g_free (size_string);
g_free (path);
+end:
+
if (string) {
/* This is hackish and meant to avoid ellipsization to make the
* label to small. */
@@ -227,38 +273,13 @@
}
static void
-brasero_src_image_set_track (BraseroSrcImage *dialog,
- BraseroImageFormat format,
- const gchar *image,
- const gchar *toc)
+brasero_image_src_track_changed_cb (BraseroTrack *track,
+ BraseroSrcImage *dialog)
{
- BraseroSrcImagePrivate *priv;
-
- priv = BRASERO_SRC_IMAGE_PRIVATE (dialog);
-
- /* set image type before adding so that signal has the right type */
- brasero_track_image_set_source (priv->track,
- image,
- toc,
- format);
-
- if (!toc && !image && format == BRASERO_IMAGE_FORMAT_NONE)
- return;
-
brasero_src_image_update (dialog);
}
static void
-brasero_src_image_error (BraseroSrcImage *self,
- GError *error)
-{
- brasero_utils_message_dialog (gtk_widget_get_toplevel (GTK_WIDGET (self)),
- _("Please select another image."),
- error->message,
- GTK_MESSAGE_ERROR);
-}
-
-static void
brasero_src_image_check_parent_directory_cb (GObject *object,
GAsyncResult *result,
gpointer data)
@@ -289,179 +310,20 @@
}
static void
-brasero_src_image_get_info_cb (GObject *object,
- GAsyncResult *result,
- gpointer data)
-{
- BraseroSrcImage *dialog = BRASERO_SRC_IMAGE (data);
- BraseroSrcImagePrivate *priv;
- GError *error = NULL;
- const gchar *mime;
- GFileInfo *info;
- gchar *uri;
-
- info = g_file_query_info_finish (G_FILE (object), result, &error);
- uri = g_file_get_uri (G_FILE (object));
-
- priv = BRASERO_SRC_IMAGE_PRIVATE (dialog);
- if (error) {
- brasero_src_image_set_track (dialog,
- BRASERO_IMAGE_FORMAT_NONE,
- NULL,
- NULL);
-
- /* we need to say that image can't be loaded */
- brasero_src_image_error (dialog, error);
- g_error_free (error);
- return;
- }
-
- mime = g_file_info_get_content_type (info);
- if (mime
- && (!strcmp (mime, "application/x-toc")
- || !strcmp (mime, "application/x-cdrdao-toc")
- || !strcmp (mime, "application/x-cue"))) {
- BraseroImageFormat format;
- gchar *path;
-
- path = g_filename_from_uri (uri, NULL, NULL);
- format = brasero_image_format_identify_cuesheet (path);
- g_free (path);
-
- if (format != BRASERO_IMAGE_FORMAT_NONE)
- brasero_src_image_set_track (dialog,
- format,
- NULL,
- uri);
- else if (g_str_has_suffix (path, ".toc"))
- brasero_src_image_set_track (dialog,
- BRASERO_IMAGE_FORMAT_CLONE,
- NULL,
- uri);
- else
- brasero_src_image_set_track (dialog,
- BRASERO_IMAGE_FORMAT_NONE,
- NULL,
- uri);
- }
- else if (mime && !strcmp (mime, "application/octet-stream")) {
- /* that could be an image, so here is the deal:
- * if we can find the type through the extension, fine.
- * if not default to CLONE */
- if (g_str_has_suffix (uri, ".bin"))
- brasero_src_image_set_track (dialog,
- BRASERO_IMAGE_FORMAT_CDRDAO,
- uri,
- NULL);
- else if (g_str_has_suffix (uri, ".raw"))
- brasero_src_image_set_track (dialog,
- BRASERO_IMAGE_FORMAT_CLONE,
- uri,
- NULL);
- else
- brasero_src_image_set_track (dialog,
- BRASERO_IMAGE_FORMAT_BIN,
- uri,
- NULL);
- }
- else if (mime && !strcmp (mime, "application/x-cd-image"))
- brasero_src_image_set_track (dialog,
- BRASERO_IMAGE_FORMAT_BIN,
- uri,
- NULL);
- else
- brasero_src_image_set_track (dialog,
- BRASERO_IMAGE_FORMAT_NONE,
- uri,
- NULL);
-
- g_object_unref (info);
-}
-
-static void
-brasero_src_image_get_format (BraseroSrcImage *dialog,
- const gchar *uri)
-{
- BraseroSrcImagePrivate *priv;
- GFile *file;
-
- priv = BRASERO_SRC_IMAGE_PRIVATE (dialog);
-
- if (!uri) {
- brasero_src_image_set_track (dialog,
- BRASERO_IMAGE_FORMAT_NONE,
- NULL,
- NULL);
- return;
- }
-
- if (priv->format) {
- BraseroImageFormat format;
-
- /* NOTE: this is only used when a GtkFileChooser has been
- * spawned */
- brasero_image_type_chooser_get_format (BRASERO_IMAGE_TYPE_CHOOSER (priv->format), &format);
- switch (format) {
- /* Respect the user's choice regarding format */
- case BRASERO_IMAGE_FORMAT_BIN:
- brasero_src_image_set_track (dialog,
- format,
- uri,
- NULL);
- return;
- case BRASERO_IMAGE_FORMAT_CUE:
- brasero_src_image_set_track (dialog,
- format,
- NULL,
- uri);
- return;
- case BRASERO_IMAGE_FORMAT_CDRDAO:
- brasero_src_image_set_track (dialog,
- format,
- NULL,
- uri);
- return;
- case BRASERO_IMAGE_FORMAT_CLONE:
- brasero_src_image_set_track (dialog,
- format,
- NULL,
- uri);
- return;
-
- /* handle those cases afterwards */
- default:
- break;
- }
- }
-
- file = g_file_new_for_uri (uri);
- g_file_query_info_async (file,
- G_FILE_ATTRIBUTE_STANDARD_TYPE ","
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- G_FILE_QUERY_INFO_NONE,
- 0,
- priv->cancel,
- brasero_src_image_get_info_cb,
- dialog);
- g_object_unref (file);
-}
-
-static void
brasero_src_image_changed (BraseroSrcImage *dialog)
{
gchar *uri;
GFile *file;
GFile *parent;
+ BraseroImageFormat format;
BraseroSrcImagePrivate *priv;
priv = BRASERO_SRC_IMAGE_PRIVATE (dialog);
- /* Cancel any pending operation */
- g_cancellable_cancel (priv->cancel);
- g_cancellable_reset (priv->cancel);
-
+ brasero_image_type_chooser_get_format (BRASERO_IMAGE_TYPE_CHOOSER (priv->format), &format);
uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (priv->file));
- brasero_src_image_get_format (dialog, uri);
+ brasero_track_image_cfg_force_format (priv->track, format);
+ brasero_track_image_cfg_set_source (priv->track, uri);
/* Make sure it's still a valid folder */
file = g_file_new_for_uri (uri);
@@ -476,6 +338,7 @@
brasero_src_image_check_parent_directory_cb,
dialog);
g_object_unref (parent);
+ g_free (uri);
}
static void
@@ -516,8 +379,38 @@
formats |= format;
}
- brasero_image_type_chooser_set_formats (BRASERO_IMAGE_TYPE_CHOOSER (priv->format),
- formats);
+ brasero_image_type_chooser_set_formats (BRASERO_IMAGE_TYPE_CHOOSER (priv->format), formats);
+
+ format = brasero_track_image_cfg_get_forced_format (priv->track);
+ brasero_image_type_chooser_set_format (BRASERO_IMAGE_TYPE_CHOOSER (priv->format), format);
+}
+
+static gchar *
+brasero_src_image_get_current_uri (BraseroSrcImage *self)
+{
+ BraseroSrcImagePrivate *priv;
+ BraseroTrackType type = { 0, };
+ gchar *uri = NULL;
+
+ priv = BRASERO_SRC_IMAGE_PRIVATE (self);
+
+ brasero_track_get_track_type (BRASERO_TRACK (priv->track), &type);
+ switch (type.subtype.img_format) {
+ case BRASERO_IMAGE_FORMAT_NONE:
+ case BRASERO_IMAGE_FORMAT_BIN:
+ uri = brasero_track_image_get_source (BRASERO_TRACK_IMAGE (priv->track), TRUE);
+ break;
+ case BRASERO_IMAGE_FORMAT_CLONE:
+ case BRASERO_IMAGE_FORMAT_CUE:
+ case BRASERO_IMAGE_FORMAT_CDRDAO:
+ uri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (priv->track), TRUE);
+ break;
+
+ default:
+ break;
+ }
+
+ return uri;
}
static void
@@ -529,6 +422,7 @@
GtkWidget *toplevel;
GtkWidget *label;
GtkWidget *box;
+ gchar *uri;
priv = BRASERO_SRC_IMAGE_PRIVATE (button);
@@ -542,7 +436,16 @@
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (priv->file), FALSE);
- if (priv->folder) {
+ /* See if we have a URI already chosen, if so use it */
+ uri = brasero_src_image_get_current_uri (BRASERO_SRC_IMAGE (button));
+ if (uri) {
+ if (!gtk_file_chooser_select_uri (GTK_FILE_CHOOSER (priv->file), uri))
+ if (!gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (priv->file), priv->folder))
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (priv->file), g_get_home_dir ());
+
+ g_free (uri);
+ }
+ else if (priv->folder) {
if (!gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (priv->file), priv->folder))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (priv->file), g_get_home_dir ());
}
@@ -658,7 +561,7 @@
if (uri && uri [0] != '\0') {
GFile *file;
- /* Make sure it's still a valid folder */
+ /* Make sure it's still a valid parent folder */
file = g_file_new_for_commandline_arg (uri);
g_file_query_info_async (file,
G_FILE_ATTRIBUTE_STANDARD_TYPE,
@@ -749,6 +652,9 @@
if (BRASERO_IS_TRACK_IMAGE (track))
return track;
+ if (BRASERO_IS_TRACK_IMAGE_CFG (track))
+ return track;
+
return NULL;
}
@@ -766,8 +672,6 @@
switch (property_id) {
case PROP_SESSION: {
BraseroTrack *track;
- gchar *image;
- gchar *toc;
if (priv->session)
g_object_unref (priv->session);
@@ -781,30 +685,72 @@
track = _get_session_image_track (session);
if (track) {
- g_object_ref (track);
- priv->track = BRASERO_TRACK_IMAGE (track);
+ if (!BRASERO_IS_TRACK_IMAGE_CFG (track)) {
+ BraseroTrackType type = { 0, };
+ guint64 blocks = 0;
+ gchar *image = NULL;
+ gchar *toc = NULL;
+
+ toc = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (track), TRUE);
+ image = brasero_track_image_get_source (BRASERO_TRACK_IMAGE (track), TRUE);
+ brasero_track_get_track_type (BRASERO_TRACK (track), &type);
+ brasero_track_get_size (BRASERO_TRACK (track),
+ &blocks,
+ NULL);
+
+ priv->track = brasero_track_image_cfg_new ();
+ if (blocks && type.subtype.img_format != BRASERO_IMAGE_FORMAT_NONE) {
+ /* copy all the information */
+ brasero_track_image_set_source (BRASERO_TRACK_IMAGE (priv->track),
+ image,
+ toc,
+ type.subtype.img_format);
+
+ brasero_track_image_set_block_num (BRASERO_TRACK_IMAGE (priv->track), blocks);
+ }
+ else {
+ brasero_track_image_cfg_force_format (priv->track, type.subtype.img_format);
+
+ switch (type.subtype.img_format) {
+ case BRASERO_IMAGE_FORMAT_NONE:
+ case BRASERO_IMAGE_FORMAT_BIN:
+ brasero_track_image_cfg_set_source (priv->track, image);
+ break;
+ case BRASERO_IMAGE_FORMAT_CLONE:
+ case BRASERO_IMAGE_FORMAT_CUE:
+ case BRASERO_IMAGE_FORMAT_CDRDAO:
+ brasero_track_image_cfg_set_source (priv->track, toc);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ brasero_burn_session_add_track (priv->session, BRASERO_TRACK (priv->track));
+ g_free (image);
+ g_free (toc);
+ }
+ else {
+ g_object_ref (track);
+ priv->track = BRASERO_TRACK_IMAGE_CFG (track);
+ }
}
else {
/* Add our own track */
- priv->track = brasero_track_image_new ();
+ priv->track = brasero_track_image_cfg_new ();
brasero_burn_session_add_track (priv->session, BRASERO_TRACK (priv->track));
}
- /* Make sure everything fits (NOTE: no need to set format yet,
- * since at that point no GtkFileChooser was opened.) */
- toc = brasero_track_image_get_toc_source (priv->track, TRUE);
- image = brasero_track_image_get_source (priv->track, TRUE);
- if (toc || image) {
- BraseroTrackType type = { 0, };
-
- brasero_track_get_track_type (BRASERO_TRACK (priv->track), &type);
- if (type.subtype.img_format != BRASERO_IMAGE_FORMAT_NONE)
- brasero_src_image_update (BRASERO_SRC_IMAGE (object));
- else
- brasero_src_image_get_format (BRASERO_SRC_IMAGE (object), toc? toc:image);
-
- g_free (image);
- g_free (toc);
+ g_signal_connect (priv->track,
+ "changed",
+ G_CALLBACK (brasero_image_src_track_changed_cb),
+ object);
+
+ if (brasero_track_image_cfg_get_status (priv->track, NULL) != BRASERO_BURN_NOT_READY) {
+ /* Make sure everything fits (NOTE: no need to set format yet,
+ * since at that point no GtkFileChooser was opened.) */
+ brasero_src_image_update (BRASERO_SRC_IMAGE (object));
}
break;
Added: trunk/libbrasero-burn/brasero-track-data.c
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-data.c Sun Mar 29 15:50:32 2009
@@ -0,0 +1,323 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <glib/gi18n-lib.h>
+
+#include "brasero-track-data.h"
+#include "burn-mkisofs-base.h"
+
+typedef struct _BraseroTrackDataPrivate BraseroTrackDataPrivate;
+struct _BraseroTrackDataPrivate
+{
+ BraseroImageFS fs_type;
+ GSList *grafts;
+ GSList *excluded;
+
+ guint file_num;
+ guint64 data_blocks;
+};
+
+#define BRASERO_TRACK_DATA_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_TRACK_DATA, BraseroTrackDataPrivate))
+
+G_DEFINE_TYPE (BraseroTrackData, brasero_track_data, BRASERO_TYPE_TRACK);
+
+
+void
+brasero_graft_point_free (BraseroGraftPt *graft)
+{
+ if (graft->uri)
+ g_free (graft->uri);
+
+ g_free (graft->path);
+ g_free (graft);
+}
+
+BraseroGraftPt *
+brasero_graft_point_copy (BraseroGraftPt *graft)
+{
+ BraseroGraftPt *newgraft;
+
+ g_return_val_if_fail (graft != NULL, NULL);
+
+ newgraft = g_new0 (BraseroGraftPt, 1);
+ newgraft->path = g_strdup (graft->path);
+ if (graft->uri)
+ newgraft->uri = g_strdup (graft->uri);
+
+ return newgraft;
+}
+
+BraseroBurnResult
+brasero_track_data_set_source (BraseroTrackData *track,
+ GSList *grafts,
+ GSList *unreadable)
+{
+ BraseroTrackDataPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), BRASERO_BURN_NOT_SUPPORTED);
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+
+ if (priv->grafts) {
+ g_slist_foreach (priv->grafts, (GFunc) brasero_graft_point_free, NULL);
+ g_slist_free (priv->grafts);
+ }
+
+ if (priv->excluded) {
+ g_slist_foreach (priv->excluded, (GFunc) g_free, NULL);
+ g_slist_free (priv->excluded);
+ }
+
+ priv->grafts = grafts;
+ priv->excluded = unreadable;
+ brasero_track_changed (BRASERO_TRACK (track));
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
+brasero_track_data_add_fs (BraseroTrackData *track,
+ BraseroImageFS fstype)
+{
+ BraseroTrackDataPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), BRASERO_BURN_NOT_SUPPORTED);
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+
+ fstype |= priv->fs_type;
+ if (fstype == priv->fs_type)
+ return BRASERO_BURN_OK;
+
+ priv->fs_type = fstype;
+ brasero_track_changed (BRASERO_TRACK (track));
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
+brasero_track_data_rm_fs (BraseroTrackData *track,
+ BraseroImageFS fstype)
+{
+ BraseroTrackDataPrivate *priv;
+ BraseroImageFS new_fstype;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), BRASERO_BURN_NOT_SUPPORTED);
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+
+ new_fstype = priv->fs_type;
+ new_fstype &= ~fstype;
+ if (new_fstype == priv->fs_type)
+ return BRASERO_BURN_OK;
+
+ priv->fs_type = new_fstype;
+ brasero_track_changed (BRASERO_TRACK (track));
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
+brasero_track_data_set_data_blocks (BraseroTrackData *track,
+ guint64 blocks)
+{
+ BraseroTrackDataPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), BRASERO_BURN_NOT_SUPPORTED);
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+ priv->data_blocks = blocks;
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
+brasero_track_data_set_file_num (BraseroTrackData *track,
+ guint64 number)
+{
+ BraseroTrackDataPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), BRASERO_BURN_NOT_SUPPORTED);
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+
+ priv->file_num = number;
+ return BRASERO_BURN_OK;
+}
+
+GSList *
+brasero_track_data_get_grafts (BraseroTrackData *track)
+{
+ BraseroTrackDataPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), NULL);
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+
+ return priv->grafts;
+}
+
+GSList *
+brasero_track_data_get_excluded (BraseroTrackData *track,
+ gboolean copy)
+{
+ BraseroTrackDataPrivate *priv;
+ GSList *retval = NULL;
+ GSList *iter;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), NULL);
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+
+ if (!copy)
+ return priv->excluded;
+
+ for (iter = priv->excluded; iter; iter = iter->next) {
+ gchar *uri;
+
+ uri = iter->data;
+ retval = g_slist_prepend (retval, g_strdup (uri));
+ }
+
+ return retval;
+}
+
+BraseroBurnResult
+brasero_track_data_get_paths (BraseroTrackData *track,
+ gboolean use_joliet,
+ const gchar *grafts_path,
+ const gchar *excluded_path,
+ const gchar *emptydir,
+ const gchar *videodir,
+ GError **error)
+{
+ BraseroBurnResult result;
+ BraseroTrackDataPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), BRASERO_BURN_NOT_SUPPORTED);
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+ result = brasero_mkisofs_base_write_to_files (priv->grafts,
+ priv->excluded,
+ use_joliet,
+ emptydir,
+ videodir,
+ grafts_path,
+ excluded_path,
+ error);
+ return result;
+}
+
+BraseroBurnResult
+brasero_track_data_get_file_num (BraseroTrackData *track,
+ guint64 *num_files)
+{
+ BraseroTrackDataPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), BRASERO_BURN_NOT_SUPPORTED);
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+
+ *num_files = priv->file_num;
+
+ return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
+brasero_track_data_get_size (BraseroTrack *track,
+ guint64 *blocks,
+ guint *block_size)
+{
+ BraseroTrackDataPrivate *priv;
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+
+ if (*block_size)
+ *block_size = 2048;
+
+ if (*blocks)
+ *blocks = priv->data_blocks;
+
+ return BRASERO_BURN_OK;
+}
+
+static BraseroTrackDataType
+brasero_track_data_get_track_type (BraseroTrack *track,
+ BraseroTrackType *type)
+{
+ BraseroTrackDataPrivate *priv;
+
+ priv = BRASERO_TRACK_DATA_PRIVATE (track);
+
+ if (!type)
+ return BRASERO_TRACK_TYPE_DATA;
+
+ type->type = BRASERO_TRACK_TYPE_DATA;
+ type->subtype.fs_type = priv->fs_type;
+
+ return BRASERO_TRACK_TYPE_DATA;
+}
+
+static void
+brasero_track_data_init (BraseroTrackData *object)
+{ }
+
+static void
+brasero_track_data_finalize (GObject *object)
+{
+
+ G_OBJECT_CLASS (brasero_track_data_parent_class)->finalize (object);
+}
+
+static void
+brasero_track_data_class_init (BraseroTrackDataClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ BraseroTrackClass* track_class = BRASERO_TRACK_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroTrackDataPrivate));
+
+ object_class->finalize = brasero_track_data_finalize;
+
+ track_class->get_type = brasero_track_data_get_track_type;
+ track_class->get_size = brasero_track_data_get_size;
+}
+
+BraseroTrackData *
+brasero_track_data_new (void)
+{
+ return g_object_new (BRASERO_TYPE_TRACK_DATA, NULL);
+}
Added: trunk/libbrasero-burn/brasero-track-data.h
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-data.h Sun Mar 29 15:50:32 2009
@@ -0,0 +1,121 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _BRASERO_TRACK_DATA_H_
+#define _BRASERO_TRACK_DATA_H_
+
+#include <glib-object.h>
+
+#include <brasero-track.h>
+
+G_BEGIN_DECLS
+
+struct _BraseroGraftPt {
+ gchar *uri;
+ gchar *path;
+};
+typedef struct _BraseroGraftPt BraseroGraftPt;
+
+void
+brasero_graft_point_free (BraseroGraftPt *graft);
+
+BraseroGraftPt *
+brasero_graft_point_copy (BraseroGraftPt *graft);
+
+
+#define BRASERO_TYPE_TRACK_DATA (brasero_track_data_get_type ())
+#define BRASERO_TRACK_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_TRACK_DATA, BraseroTrackData))
+#define BRASERO_TRACK_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_TRACK_DATA, BraseroTrackDataClass))
+#define BRASERO_IS_TRACK_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_TRACK_DATA))
+#define BRASERO_IS_TRACK_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_TRACK_DATA))
+#define BRASERO_TRACK_DATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_TRACK_DATA, BraseroTrackDataClass))
+
+typedef struct _BraseroTrackDataClass BraseroTrackDataClass;
+typedef struct _BraseroTrackData BraseroTrackData;
+
+struct _BraseroTrackDataClass
+{
+ BraseroTrackClass parent_class;
+};
+
+struct _BraseroTrackData
+{
+ BraseroTrack parent_instance;
+};
+
+GType brasero_track_data_get_type (void) G_GNUC_CONST;
+
+BraseroTrackData *
+brasero_track_data_new (void);
+
+BraseroBurnResult
+brasero_track_data_set_source (BraseroTrackData *track,
+ GSList *grafts,
+ GSList *unreadable);
+
+BraseroBurnResult
+brasero_track_data_add_fs (BraseroTrackData *track,
+ BraseroImageFS fstype);
+
+BraseroBurnResult
+brasero_track_data_rm_fs (BraseroTrackData *track,
+ BraseroImageFS fstype);
+
+BraseroBurnResult
+brasero_track_data_set_data_blocks (BraseroTrackData *track,
+ guint64 blocks);
+
+BraseroBurnResult
+brasero_track_data_set_file_num (BraseroTrackData *track,
+ guint64 number);
+
+GSList *
+brasero_track_data_get_grafts (BraseroTrackData *track);
+
+GSList *
+brasero_track_data_get_excluded (BraseroTrackData *track,
+ gboolean copy);
+
+BraseroBurnResult
+brasero_track_data_get_paths (BraseroTrackData *track,
+ gboolean use_joliet,
+ const gchar *grafts_path,
+ const gchar *excluded_path,
+ const gchar *emptydir,
+ const gchar *videodir,
+ GError **error);
+
+BraseroBurnResult
+brasero_track_data_get_file_num (BraseroTrackData *track,
+ guint64 *num_files);
+
+G_END_DECLS
+
+#endif /* _BRASERO_TRACK_DATA_H_ */
Added: trunk/libbrasero-burn/brasero-track-disc.c
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-disc.c Sun Mar 29 15:50:32 2009
@@ -0,0 +1,228 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "brasero-track-disc.h"
+
+typedef struct _BraseroTrackDiscPrivate BraseroTrackDiscPrivate;
+struct _BraseroTrackDiscPrivate
+{
+ BraseroDrive *drive;
+
+ guint track_num;
+
+ glong src_removed_sig;
+ glong src_added_sig;
+};
+
+#define BRASERO_TRACK_DISC_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_TRACK_DISC, BraseroTrackDiscPrivate))
+
+G_DEFINE_TYPE (BraseroTrackDisc, brasero_track_disc, BRASERO_TYPE_TRACK);
+
+
+BraseroBurnResult
+brasero_track_disc_set_track_num (BraseroTrackDisc *track,
+ guint num)
+{
+ BraseroTrackDiscPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DISC (track), BRASERO_BURN_ERR);
+
+ priv = BRASERO_TRACK_DISC_PRIVATE (track);
+ priv->track_num = num;
+
+ return BRASERO_BURN_OK;
+}
+
+guint
+brasero_track_disc_get_track_num (BraseroTrackDisc *track)
+{
+ BraseroTrackDiscPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DISC (track), BRASERO_BURN_ERR);
+
+ priv = BRASERO_TRACK_DISC_PRIVATE (track);
+ return priv->track_num;
+}
+
+static void
+brasero_track_disc_remove_drive (BraseroTrackDisc *track)
+{
+ BraseroTrackDiscPrivate *priv;
+
+ priv = BRASERO_TRACK_DISC_PRIVATE (track);
+
+ if (priv->src_added_sig) {
+ g_signal_handler_disconnect (priv->drive, priv->src_added_sig);
+ priv->src_added_sig = 0;
+ }
+
+ if (priv->src_removed_sig) {
+ g_signal_handler_disconnect (priv->drive, priv->src_removed_sig);
+ priv->src_removed_sig = 0;
+ }
+
+ if (priv->drive) {
+ g_object_unref (priv->drive);
+ priv->drive = NULL;
+ }
+}
+
+static void
+brasero_track_disc_medium_changed (BraseroDrive *drive,
+ BraseroMedium *medium,
+ BraseroTrack *track)
+{
+ brasero_track_changed (track);
+}
+
+BraseroBurnResult
+brasero_track_disc_set_drive (BraseroTrackDisc *track,
+ BraseroDrive *drive)
+{
+ BraseroTrackDiscPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DISC (track), BRASERO_BURN_ERR);
+
+ priv = BRASERO_TRACK_DISC_PRIVATE (track);
+
+ brasero_track_disc_remove_drive (track);
+ if (!drive) {
+ brasero_track_changed (BRASERO_TRACK (track));
+ return BRASERO_BURN_OK;
+ }
+
+ priv->drive = drive;
+ g_object_ref (drive);
+
+ priv->src_added_sig = g_signal_connect (drive,
+ "medium-added",
+ G_CALLBACK (brasero_track_disc_medium_changed),
+ track);
+ priv->src_removed_sig = g_signal_connect (drive,
+ "medium-removed",
+ G_CALLBACK (brasero_track_disc_medium_changed),
+ track);
+
+ brasero_track_changed (BRASERO_TRACK (track));
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroDrive *
+brasero_track_disc_get_drive (BraseroTrackDisc *track)
+{
+ BraseroTrackDiscPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_DISC (track), NULL);
+
+ priv = BRASERO_TRACK_DISC_PRIVATE (track);
+ return priv->drive;
+}
+
+static BraseroBurnResult
+brasero_track_disc_get_size (BraseroTrack *track,
+ guint64 *blocks,
+ guint *block_size)
+{
+ BraseroMedium *medium;
+ gint64 medium_size = 0;
+ gint64 medium_blocks = 0;
+ BraseroTrackDiscPrivate *priv;
+
+ priv = BRASERO_TRACK_DISC_PRIVATE (track);
+ medium = brasero_drive_get_medium (priv->drive);
+ brasero_medium_get_data_size (medium, &medium_size, &medium_blocks);
+
+ if (blocks)
+ *blocks = medium_blocks;
+
+ if (block_size)
+ *block_size = medium_size / medium_blocks;
+
+ return BRASERO_BURN_OK;
+}
+
+static BraseroTrackDataType
+brasero_track_disc_get_track_type (BraseroTrack *track,
+ BraseroTrackType *type)
+{
+ BraseroTrackDiscPrivate *priv;
+ BraseroMedium *medium;
+
+ priv = BRASERO_TRACK_DISC_PRIVATE (track);
+
+ if (!type)
+ return BRASERO_TRACK_TYPE_DISC;
+
+ medium = brasero_drive_get_medium (priv->drive);
+
+ type->type = BRASERO_TRACK_TYPE_DISC;
+ type->subtype.media = brasero_medium_get_status (medium);
+ return BRASERO_TRACK_TYPE_DISC;
+}
+
+static void
+brasero_track_disc_init (BraseroTrackDisc *object)
+{ }
+
+static void
+brasero_track_disc_finalize (GObject *object)
+{
+ brasero_track_disc_remove_drive (BRASERO_TRACK_DISC (object));
+
+ G_OBJECT_CLASS (brasero_track_disc_parent_class)->finalize (object);
+}
+
+static void
+brasero_track_disc_class_init (BraseroTrackDiscClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ BraseroTrackClass* track_class = BRASERO_TRACK_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroTrackDiscPrivate));
+
+ object_class->finalize = brasero_track_disc_finalize;
+
+ track_class->get_size = brasero_track_disc_get_size;
+ track_class->get_type = brasero_track_disc_get_track_type;
+}
+
+BraseroTrackDisc *
+brasero_track_disc_new (void)
+{
+ return g_object_new (BRASERO_TYPE_TRACK_DISC, NULL);
+}
Added: trunk/libbrasero-burn/brasero-track-disc.h
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-disc.h Sun Mar 29 15:50:32 2009
@@ -0,0 +1,83 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _BRASERO_TRACK_DISC_H_
+#define _BRASERO_TRACK_DISC_H_
+
+#include <glib-object.h>
+
+#include <brasero-drive.h>
+
+#include <brasero-track.h>
+
+G_BEGIN_DECLS
+
+#define BRASERO_TYPE_TRACK_DISC (brasero_track_disc_get_type ())
+#define BRASERO_TRACK_DISC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_TRACK_DISC, BraseroTrackDisc))
+#define BRASERO_TRACK_DISC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_TRACK_DISC, BraseroTrackDiscClass))
+#define BRASERO_IS_TRACK_DISC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_TRACK_DISC))
+#define BRASERO_IS_TRACK_DISC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_TRACK_DISC))
+#define BRASERO_TRACK_DISC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_TRACK_DISC, BraseroTrackDiscClass))
+
+typedef struct _BraseroTrackDiscClass BraseroTrackDiscClass;
+typedef struct _BraseroTrackDisc BraseroTrackDisc;
+
+struct _BraseroTrackDiscClass
+{
+ BraseroTrackClass parent_class;
+};
+
+struct _BraseroTrackDisc
+{
+ BraseroTrack parent_instance;
+};
+
+GType brasero_track_disc_get_type (void) G_GNUC_CONST;
+
+BraseroTrackDisc *
+brasero_track_disc_new (void);
+
+BraseroBurnResult
+brasero_track_disc_set_drive (BraseroTrackDisc *track,
+ BraseroDrive *drive);
+
+BraseroDrive *
+brasero_track_disc_get_drive (BraseroTrackDisc *track);
+
+BraseroBurnResult
+brasero_track_disc_set_track_num (BraseroTrackDisc *track,
+ guint num);
+
+guint
+brasero_track_disc_get_track_num (BraseroTrackDisc *track);
+
+G_END_DECLS
+
+#endif /* _BRASERO_TRACK_DISC_H_ */
Added: trunk/libbrasero-burn/brasero-track-image-cfg.c
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-image-cfg.c Sun Mar 29 15:50:32 2009
@@ -0,0 +1,431 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <glib-object.h>
+
+#include "brasero-track-image-cfg.h"
+#include "brasero-track-image.h"
+#include "brasero-track.h"
+
+#include "burn-image-format.h"
+
+
+typedef struct _BraseroTrackImageInfo BraseroTrackImageInfo;
+struct _BraseroTrackImageInfo {
+ gchar *uri;
+ guint64 blocks;
+ BraseroImageFormat format;
+};
+
+typedef struct _BraseroTrackImageCfgPrivate BraseroTrackImageCfgPrivate;
+struct _BraseroTrackImageCfgPrivate
+{
+ GCancellable *cancel;
+ GError *error;
+
+ BraseroImageFormat format;
+};
+
+#define BRASERO_TRACK_IMAGE_CFG_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_TRACK_IMAGE_CFG, BraseroTrackImageCfgPrivate))
+
+G_DEFINE_TYPE (BraseroTrackImageCfg, brasero_track_image_cfg, BRASERO_TYPE_TRACK_IMAGE);
+
+
+static void
+brasero_track_image_cfg_set_uri (BraseroTrackImageCfg *track,
+ const gchar *uri,
+ BraseroImageFormat format)
+{
+ switch (format) {
+ case BRASERO_IMAGE_FORMAT_NONE:
+ case BRASERO_IMAGE_FORMAT_BIN:
+ brasero_track_image_set_source (BRASERO_TRACK_IMAGE (track),
+ uri,
+ NULL,
+ format);
+ break;
+ case BRASERO_IMAGE_FORMAT_CLONE:
+ case BRASERO_IMAGE_FORMAT_CUE:
+ case BRASERO_IMAGE_FORMAT_CDRDAO:
+ brasero_track_image_set_source (BRASERO_TRACK_IMAGE (track),
+ NULL,
+ uri,
+ format);
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void
+brasero_track_image_cfg_get_info_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ BraseroTrackImageInfo *info;
+ BraseroTrackImageCfgPrivate *priv;
+
+ info = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+ priv = BRASERO_TRACK_IMAGE_CFG_PRIVATE (object);
+
+ if (priv->cancel) {
+ g_object_unref (priv->cancel);
+ priv->cancel = NULL;
+ }
+
+ if (info->format == BRASERO_IMAGE_FORMAT_NONE || info->blocks == 0) {
+ GError *error = NULL;
+
+ g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), &error);
+ priv->error = error;
+
+ brasero_track_changed (BRASERO_TRACK (object));
+ return;
+ }
+
+ if (priv->format == BRASERO_IMAGE_FORMAT_NONE)
+ brasero_track_image_cfg_set_uri (BRASERO_TRACK_IMAGE_CFG (object),
+ info->uri,
+ info->format);
+
+ brasero_track_image_set_block_num (BRASERO_TRACK_IMAGE (object), info->blocks);
+}
+
+static void
+brasero_track_image_cfg_get_info_thread (GSimpleAsyncResult *result,
+ GObject *object,
+ GCancellable *cancel)
+{
+ BraseroTrackImageInfo *info;
+ GError *error = NULL;
+
+ info = g_simple_async_result_get_op_res_gpointer (result);
+
+ if (info->format == BRASERO_IMAGE_FORMAT_NONE) {
+ GFile *file;
+ const gchar *mime;
+ GFileInfo *file_info;
+
+ file = g_file_new_for_uri (info->uri);
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_QUERY_INFO_NONE,
+ cancel,
+ &error);
+ g_object_unref (file);
+
+ if (!file_info) {
+ g_simple_async_result_set_from_error (result, error);
+ g_error_free (error);
+ return;
+ }
+
+ mime = g_file_info_get_content_type (file_info);
+ if (mime
+ && (!strcmp (mime, "application/x-toc")
+ || !strcmp (mime, "application/x-cdrdao-toc")
+ || !strcmp (mime, "application/x-cue"))) {
+ info->format = brasero_image_format_identify_cuesheet (info->uri, cancel, &error);
+
+ if (error) {
+ g_simple_async_result_set_from_error (result, error);
+ g_error_free (error);
+
+ g_object_unref (file_info);
+ return;
+ }
+
+ if (info->format == BRASERO_IMAGE_FORMAT_NONE
+ && g_str_has_suffix (info->uri, ".toc"))
+ info->format = BRASERO_IMAGE_FORMAT_CLONE;
+ }
+ else if (mime && !strcmp (mime, "application/octet-stream")) {
+ /* that could be an image, so here is the deal:
+ * if we can find the type through the extension, fine.
+ * if not default to BIN */
+ if (g_str_has_suffix (info->uri, ".bin"))
+ info->format = BRASERO_IMAGE_FORMAT_CDRDAO;
+ else if (g_str_has_suffix (info->uri, ".raw"))
+ info->format = BRASERO_IMAGE_FORMAT_CLONE;
+ else
+ info->format = BRASERO_IMAGE_FORMAT_BIN;
+ }
+ else if (mime && !strcmp (mime, "application/x-cd-image"))
+ info->format = BRASERO_IMAGE_FORMAT_BIN;
+
+ g_object_unref (file_info);
+ }
+
+ if (info->format == BRASERO_IMAGE_FORMAT_NONE)
+ return;
+
+ if (info->format == BRASERO_IMAGE_FORMAT_BIN)
+ brasero_image_format_get_iso_size (info->uri, &info->blocks, NULL, cancel, &error);
+ else if (info->format == BRASERO_IMAGE_FORMAT_CLONE) {
+ gchar *complement;
+
+ complement = brasero_image_format_get_complement (BRASERO_IMAGE_FORMAT_CLONE, info->uri);
+ brasero_image_format_get_clone_size (complement, &info->blocks, NULL, cancel, &error);
+ }
+ else if (info->format == BRASERO_IMAGE_FORMAT_CDRDAO)
+ brasero_image_format_get_cdrdao_size (info->uri, &info->blocks, NULL, cancel, &error);
+ else if (info->format == BRASERO_IMAGE_FORMAT_CUE)
+ brasero_image_format_get_cue_size (info->uri, &info->blocks, NULL, cancel, &error);
+
+ if (error) {
+ g_simple_async_result_set_from_error (result, error);
+ g_error_free (error);
+ }
+}
+
+static void
+brasero_track_image_info_free (gpointer data)
+{
+ BraseroTrackImageInfo *info = data;
+
+ g_free (info->uri);
+ g_free (info);
+}
+
+static void
+brasero_track_image_cfg_get_info (BraseroTrackImageCfg *track,
+ const gchar *uri)
+{
+ BraseroTrackImageCfgPrivate *priv;
+ BraseroTrackImageInfo *info;
+ GSimpleAsyncResult *res;
+
+ priv = BRASERO_TRACK_IMAGE_CFG_PRIVATE (track);
+
+ /* Cancel a possible ongoing thread */
+ if (priv->cancel) {
+ g_cancellable_cancel (priv->cancel);
+ g_object_unref (priv->cancel);
+ priv->cancel = NULL;
+ }
+
+ if (priv->error) {
+ g_error_free (priv->error);
+ priv->error = NULL;
+ }
+
+ res = g_simple_async_result_new (G_OBJECT (track),
+ brasero_track_image_cfg_get_info_cb,
+ NULL,
+ brasero_track_image_cfg_get_info);
+
+ info = g_new0 (BraseroTrackImageInfo, 1);
+ info->uri = g_strdup (uri);
+ info->format = priv->format;
+ g_simple_async_result_set_op_res_gpointer (res, info, brasero_track_image_info_free);
+
+ priv->cancel = g_cancellable_new ();
+ g_simple_async_result_run_in_thread (res,
+ brasero_track_image_cfg_get_info_thread,
+ G_PRIORITY_LOW,
+ priv->cancel);
+ g_object_unref (res);
+}
+
+BraseroBurnResult
+brasero_track_image_cfg_set_source (BraseroTrackImageCfg *track,
+ const gchar *uri)
+{
+ gchar *current_uri;
+ BraseroTrackImageCfgPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_IMAGE_CFG (track), BRASERO_BURN_NOT_SUPPORTED);
+ g_return_val_if_fail (uri != NULL, BRASERO_BURN_NOT_SUPPORTED);
+
+ priv = BRASERO_TRACK_IMAGE_CFG_PRIVATE (track);
+
+ /* See if it has changed */
+ current_uri = brasero_track_image_get_source (BRASERO_TRACK_IMAGE (track), TRUE);
+ if (current_uri && !strcmp (current_uri, uri)) {
+ g_free (current_uri);
+ return BRASERO_BURN_OK;
+ }
+ g_free (current_uri);
+
+ /* Do it before to update our status first then update track info */
+ brasero_track_image_cfg_get_info (track, uri);
+
+ /* Update the image info container values. If it was invalid then */
+ /* NOTE: this resets the size as well */
+ brasero_track_image_set_block_num (BRASERO_TRACK_IMAGE (track), 0);
+ brasero_track_image_cfg_set_uri (track, uri, priv->format);
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroImageFormat
+brasero_track_image_cfg_get_forced_format (BraseroTrackImageCfg *track)
+{
+ BraseroTrackImageCfgPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_IMAGE_CFG (track), BRASERO_IMAGE_FORMAT_NONE);
+
+ priv = BRASERO_TRACK_IMAGE_CFG_PRIVATE (track);
+ return priv->format;
+}
+
+BraseroBurnResult
+brasero_track_image_cfg_force_format (BraseroTrackImageCfg *track,
+ BraseroImageFormat format)
+{
+ BraseroTrackImageCfgPrivate *priv;
+ BraseroTrackType type = { 0, };
+ gchar *uri = NULL;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_IMAGE_CFG (track), BRASERO_BURN_NOT_SUPPORTED);
+
+ priv = BRASERO_TRACK_IMAGE_CFG_PRIVATE (track);
+
+ brasero_track_get_track_type (BRASERO_TRACK (track), &type);
+ if (format != BRASERO_TRACK_TYPE_NONE) {
+ if (type.subtype.img_format == format)
+ return BRASERO_BURN_OK;
+ }
+
+ priv->format = format;
+
+ switch (type.subtype.img_format) {
+ case BRASERO_IMAGE_FORMAT_NONE:
+ case BRASERO_IMAGE_FORMAT_BIN:
+ uri = brasero_track_image_get_source (BRASERO_TRACK_IMAGE (track), TRUE);
+ break;
+ case BRASERO_IMAGE_FORMAT_CLONE:
+ case BRASERO_IMAGE_FORMAT_CUE:
+ case BRASERO_IMAGE_FORMAT_CDRDAO:
+ uri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (track), TRUE);
+ break;
+
+ default:
+ break;
+ }
+
+ if (!uri)
+ return BRASERO_BURN_NOT_READY;
+
+ /* Do it before to update our status first then update track info */
+ brasero_track_image_cfg_get_info (track, uri);
+
+ uri = brasero_track_image_get_source (BRASERO_TRACK_IMAGE (track), TRUE);
+ brasero_track_image_cfg_set_uri (track, uri, priv->format);
+ g_free (uri);
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
+brasero_track_image_cfg_get_status (BraseroTrackImageCfg *track,
+ GError **error)
+{
+ BraseroTrackImageCfgPrivate *priv;
+ BraseroTrackType type = { 0, };
+
+ priv = BRASERO_TRACK_IMAGE_CFG_PRIVATE (track);
+
+ if (priv->cancel)
+ return BRASERO_BURN_NOT_READY;
+
+ if (priv->error) {
+ if (error)
+ *error = g_error_copy (priv->error);
+
+ return BRASERO_BURN_ERR;
+ }
+
+ /* See if we managed to set a format (all went well then) */
+ brasero_track_get_track_type (BRASERO_TRACK (track), &type);
+ if (type.subtype.img_format == BRASERO_TRACK_TYPE_NONE) {
+ if (error)
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ "%s.\n%s",
+ /* Translators: This is a disc image */
+ _("The format of the disc image could not be identified"),
+ _("Please set it manually in the previous dialog"));
+ return BRASERO_BURN_ERR;
+ }
+
+ return BRASERO_BURN_OK;
+}
+
+static void
+brasero_track_image_cfg_init (BraseroTrackImageCfg *object)
+{ }
+
+static void
+brasero_track_image_cfg_finalize (GObject *object)
+{
+ BraseroTrackImageCfgPrivate *priv;
+
+ priv = BRASERO_TRACK_IMAGE_CFG_PRIVATE (object);
+
+ if (priv->cancel) {
+ g_cancellable_cancel (priv->cancel);
+ g_object_unref (priv->cancel);
+ priv->cancel = NULL;
+ }
+
+ if (priv->error) {
+ g_error_free (priv->error);
+ priv->error = NULL;
+ }
+
+ G_OBJECT_CLASS (brasero_track_image_cfg_parent_class)->finalize (object);
+}
+
+static void
+brasero_track_image_cfg_class_init (BraseroTrackImageCfgClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroTrackImageCfgPrivate));
+
+ object_class->finalize = brasero_track_image_cfg_finalize;
+}
+
+BraseroTrackImageCfg *
+brasero_track_image_cfg_new (void)
+{
+ return g_object_new (BRASERO_TYPE_TRACK_IMAGE_CFG, NULL);
+}
Added: trunk/libbrasero-burn/brasero-track-image-cfg.h
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-image-cfg.h Sun Mar 29 15:50:32 2009
@@ -0,0 +1,83 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _BURN_TRACK_IMAGE_CFG_H_
+#define _BURN_TRACK_IMAGE_CFG_H_
+
+#include <glib-object.h>
+
+#include <brasero-track.h>
+#include <brasero-track-image.h>
+
+G_BEGIN_DECLS
+
+#define BRASERO_TYPE_TRACK_IMAGE_CFG (brasero_track_image_cfg_get_type ())
+#define BRASERO_TRACK_IMAGE_CFG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_TRACK_IMAGE_CFG, BraseroTrackImageCfg))
+#define BRASERO_TRACK_IMAGE_CFG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_TRACK_IMAGE_CFG, BraseroTrackImageCfgClass))
+#define BRASERO_IS_TRACK_IMAGE_CFG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_TRACK_IMAGE_CFG))
+#define BRASERO_IS_TRACK_IMAGE_CFG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_TRACK_IMAGE_CFG))
+#define BRASERO_TRACK_IMAGE_CFG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_TRACK_IMAGE_CFG, BraseroTrackImageCfgClass))
+
+typedef struct _BraseroTrackImageCfgClass BraseroTrackImageCfgClass;
+typedef struct _BraseroTrackImageCfg BraseroTrackImageCfg;
+
+struct _BraseroTrackImageCfgClass
+{
+ BraseroTrackImageClass parent_class;
+};
+
+struct _BraseroTrackImageCfg
+{
+ BraseroTrackImage parent_instance;
+};
+
+GType brasero_track_image_cfg_get_type (void) G_GNUC_CONST;
+
+BraseroTrackImageCfg *
+brasero_track_image_cfg_new (void);
+
+BraseroBurnResult
+brasero_track_image_cfg_set_source (BraseroTrackImageCfg *track,
+ const gchar *uri);
+
+BraseroBurnResult
+brasero_track_image_cfg_get_status (BraseroTrackImageCfg *track,
+ GError **error);
+
+BraseroBurnResult
+brasero_track_image_cfg_force_format (BraseroTrackImageCfg *track,
+ BraseroImageFormat format);
+
+BraseroImageFormat
+brasero_track_image_cfg_get_forced_format (BraseroTrackImageCfg *track);
+
+G_END_DECLS
+
+#endif /* _BURN_TRACK_IMAGE_CFG_H_ */
Added: trunk/libbrasero-burn/brasero-track-image.c
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-image.c Sun Mar 29 15:50:32 2009
@@ -0,0 +1,259 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+
+#include "brasero-track-image.h"
+#include "brasero-enums.h"
+#include "brasero-track.h"
+
+#include "burn-debug.h"
+#include "burn-image-format.h"
+
+typedef struct _BraseroTrackImagePrivate BraseroTrackImagePrivate;
+struct _BraseroTrackImagePrivate
+{
+ gchar *image;
+ gchar *toc;
+
+ guint64 blocks;
+
+ BraseroImageFormat format;
+};
+
+#define BRASERO_TRACK_IMAGE_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_TRACK_IMAGE, BraseroTrackImagePrivate))
+
+
+G_DEFINE_TYPE (BraseroTrackImage, brasero_track_image, BRASERO_TYPE_TRACK);
+
+BraseroBurnResult
+brasero_track_image_set_source (BraseroTrackImage *track,
+ const gchar *image,
+ const gchar *toc,
+ BraseroImageFormat format)
+{
+ BraseroTrackImagePrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_IMAGE (track), BRASERO_BURN_ERR);
+
+ priv = BRASERO_TRACK_IMAGE_PRIVATE (track);
+
+ priv->format = format;
+
+ if (priv->image)
+ g_free (priv->image);
+
+ if (priv->toc)
+ g_free (priv->toc);
+
+ priv->image = g_strdup (image);
+ priv->toc = g_strdup (toc);
+
+ brasero_track_changed (BRASERO_TRACK (track));
+
+ return BRASERO_BURN_OK;
+}
+
+void
+brasero_track_image_set_block_num (BraseroTrackImage *track,
+ guint64 blocks)
+{
+ BraseroTrackImagePrivate *priv;
+
+ g_return_if_fail (BRASERO_IS_TRACK_IMAGE (track));
+
+ priv = BRASERO_TRACK_IMAGE_PRIVATE (track);
+
+ if (priv->blocks == blocks)
+ return;
+
+ priv->blocks = blocks;
+ brasero_track_changed (BRASERO_TRACK (track));
+}
+
+gchar *
+brasero_track_image_get_source (BraseroTrackImage *track,
+ gboolean uri)
+{
+ BraseroTrackImagePrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_IMAGE (track), NULL);
+
+ priv = BRASERO_TRACK_IMAGE_PRIVATE (track);
+
+ if (!priv->image) {
+ gchar *complement;
+ gchar *retval;
+ gchar *toc;
+
+ if (!priv->toc) {
+ BRASERO_BURN_LOG ("Image nor toc were set");
+ return NULL;
+ }
+
+ toc = brasero_string_get_localpath (priv->toc);
+ complement = brasero_image_format_get_complement (priv->format, toc);
+ g_free (toc);
+
+ if (!complement) {
+ BRASERO_BURN_LOG ("No complement could be retrieved");
+ return NULL;
+ }
+
+ BRASERO_BURN_LOG ("Complement file retrieved %s", complement);
+ if (uri)
+ retval = brasero_string_get_uri (complement);
+ else
+ retval = brasero_string_get_localpath (complement);
+
+ g_free (complement);
+ return retval;
+ }
+
+ if (uri)
+ return brasero_string_get_uri (priv->image);
+ else
+ return brasero_string_get_localpath (priv->image);
+}
+
+gchar *
+brasero_track_image_get_toc_source (BraseroTrackImage *track,
+ gboolean uri)
+{
+ BraseroTrackImagePrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_IMAGE (track), NULL);
+
+ priv = BRASERO_TRACK_IMAGE_PRIVATE (track);
+
+ /* Don't use file complement retrieval here as it's not possible */
+ if (uri)
+ return brasero_string_get_uri (priv->toc);
+ else
+ return brasero_string_get_localpath (priv->toc);
+}
+
+static BraseroTrackDataType
+brasero_track_image_get_track_type (BraseroTrack *track,
+ BraseroTrackType *type)
+{
+ BraseroTrackImagePrivate *priv;
+
+ priv = BRASERO_TRACK_IMAGE_PRIVATE (track);
+
+ if (!type)
+ return BRASERO_TRACK_TYPE_IMAGE;
+
+ type->type = BRASERO_TRACK_TYPE_IMAGE;
+ type->subtype.img_format = priv->format;
+
+ return BRASERO_TRACK_TYPE_IMAGE;
+}
+
+static BraseroBurnResult
+brasero_track_image_get_size (BraseroTrack *track,
+ guint64 *blocks,
+ guint *block_size)
+{
+ BraseroTrackImagePrivate *priv;
+
+ priv = BRASERO_TRACK_IMAGE_PRIVATE (track);
+
+ if (priv->format == BRASERO_IMAGE_FORMAT_BIN) {
+ if (block_size)
+ *block_size = 2048;
+ }
+ else if (priv->format == BRASERO_IMAGE_FORMAT_CLONE) {
+ if (block_size)
+ *block_size = 2448;
+ }
+ else if (priv->format == BRASERO_IMAGE_FORMAT_CDRDAO) {
+ if (block_size)
+ *block_size = 2352;
+ }
+ else if (priv->format == BRASERO_IMAGE_FORMAT_CUE) {
+ if (block_size)
+ *block_size = 2352;
+ }
+ else if (block_size)
+ *block_size = 0;
+
+ if (blocks)
+ *blocks = priv->blocks;
+
+ return BRASERO_BURN_OK;
+}
+
+static void
+brasero_track_image_init (BraseroTrackImage *object)
+{ }
+
+static void
+brasero_track_image_finalize (GObject *object)
+{
+ BraseroTrackImagePrivate *priv;
+
+ priv = BRASERO_TRACK_IMAGE_PRIVATE (object);
+ if (priv->image) {
+ g_free (priv->image);
+ priv->image = NULL;
+ }
+
+ if (priv->toc) {
+ g_free (priv->toc);
+ priv->toc = NULL;
+ }
+
+ G_OBJECT_CLASS (brasero_track_image_parent_class)->finalize (object);
+}
+
+static void
+brasero_track_image_class_init (BraseroTrackImageClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ BraseroTrackClass *track_class = BRASERO_TRACK_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroTrackImagePrivate));
+
+ object_class->finalize = brasero_track_image_finalize;
+
+ track_class->get_size = brasero_track_image_get_size;
+ track_class->get_type = brasero_track_image_get_track_type;
+}
+
+BraseroTrackImage *
+brasero_track_image_new (void)
+{
+ return g_object_new (BRASERO_TYPE_TRACK_IMAGE, NULL);
+}
Added: trunk/libbrasero-burn/brasero-track-image.h
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-image.h Sun Mar 29 15:50:32 2009
@@ -0,0 +1,86 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _BURN_TRACK_IMAGE_H_
+#define _BURN_TRACK_IMAGE_H_
+
+#include <glib-object.h>
+
+#include <brasero-enums.h>
+#include <brasero-track.h>
+
+G_BEGIN_DECLS
+
+#define BRASERO_TYPE_TRACK_IMAGE (brasero_track_image_get_type ())
+#define BRASERO_TRACK_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_TRACK_IMAGE, BraseroTrackImage))
+#define BRASERO_TRACK_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_TRACK_IMAGE, BraseroTrackImageClass))
+#define BRASERO_IS_TRACK_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_TRACK_IMAGE))
+#define BRASERO_IS_TRACK_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_TRACK_IMAGE))
+#define BRASERO_TRACK_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_TRACK_IMAGE, BraseroTrackImageClass))
+
+typedef struct _BraseroTrackImageClass BraseroTrackImageClass;
+typedef struct _BraseroTrackImage BraseroTrackImage;
+
+struct _BraseroTrackImageClass
+{
+ BraseroTrackClass parent_class;
+};
+
+struct _BraseroTrackImage
+{
+ BraseroTrack parent_instance;
+};
+
+GType brasero_track_image_get_type (void) G_GNUC_CONST;
+
+BraseroTrackImage *
+brasero_track_image_new (void);
+
+BraseroBurnResult
+brasero_track_image_set_source (BraseroTrackImage *track,
+ const gchar *image,
+ const gchar *toc,
+ BraseroImageFormat format);
+
+void
+brasero_track_image_set_block_num (BraseroTrackImage *track,
+ guint64 blocks);
+
+gchar *
+brasero_track_image_get_source (BraseroTrackImage *track,
+ gboolean uri);
+
+gchar *
+brasero_track_image_get_toc_source (BraseroTrackImage *track,
+ gboolean uri);
+
+G_END_DECLS
+
+#endif /* _BURN_TRACK_IMAGE_H_ */
Added: trunk/libbrasero-burn/brasero-track-stream.c
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-stream.c Sun Mar 29 15:50:32 2009
@@ -0,0 +1,331 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "burn-debug.h"
+#include "burn-basics.h"
+#include "brasero-track-stream.h"
+
+typedef struct _BraseroTrackStreamPrivate BraseroTrackStreamPrivate;
+struct _BraseroTrackStreamPrivate
+{
+ gchar *uri;
+
+ BraseroStreamFormat format;
+
+ guint64 gap;
+ guint64 start;
+ guint64 end;
+
+ BraseroStreamInfo *info;
+};
+
+#define BRASERO_TRACK_STREAM_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_TRACK_STREAM, BraseroTrackStreamPrivate))
+
+G_DEFINE_TYPE (BraseroTrackStream, brasero_track_stream, G_TYPE_OBJECT);
+
+void
+brasero_stream_info_free (BraseroStreamInfo *info)
+{
+ if (!info)
+ return;
+
+ g_free (info->title);
+ g_free (info->artist);
+ g_free (info->composer);
+ g_free (info);
+}
+
+BraseroStreamInfo *
+brasero_stream_info_copy (BraseroStreamInfo *info)
+{
+ BraseroStreamInfo *copy;
+
+ if (!info)
+ return NULL;
+
+ copy = g_new0 (BraseroStreamInfo, 1);
+
+ copy->title = g_strdup (info->title);
+ copy->artist = g_strdup (info->artist);
+ copy->composer = g_strdup (info->composer);
+ copy->isrc = info->isrc;
+
+ return copy;
+}
+
+BraseroBurnResult
+brasero_track_stream_set_source (BraseroTrackStream *track,
+ const gchar *uri)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), BRASERO_BURN_ERR);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+
+ if (priv->uri)
+ g_free (priv->uri);
+
+ priv->uri = g_strdup (uri);
+ brasero_track_changed (BRASERO_TRACK (track));
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
+brasero_track_stream_set_format (BraseroTrackStream *track,
+ BraseroStreamFormat format)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), BRASERO_BURN_ERR);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+
+ if (format == BRASERO_AUDIO_FORMAT_NONE)
+ BRASERO_BURN_LOG ("Setting a NONE audio format with a valid uri");
+
+ priv->format = format;
+ brasero_track_changed (BRASERO_TRACK (track));
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
+brasero_track_stream_set_info (BraseroTrackStream *track,
+ BraseroStreamInfo *info)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), BRASERO_BURN_ERR);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+
+ if (priv->info)
+ brasero_stream_info_free (priv->info);
+
+ priv->info = info;
+ brasero_track_changed (BRASERO_TRACK (track));
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
+brasero_track_stream_set_boundaries (BraseroTrackStream *track,
+ gint64 start,
+ gint64 end,
+ gint64 gap)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), BRASERO_BURN_ERR);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+
+ if (gap >= 0)
+ priv->gap = gap;
+
+ if (end > 0)
+ priv->end = end;
+
+ if (start >= 0)
+ priv->start = start;
+
+ brasero_track_changed (BRASERO_TRACK (track));
+
+ return BRASERO_BURN_OK;
+}
+
+gchar *
+brasero_track_stream_get_source (BraseroTrackStream *track,
+ gboolean uri)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), NULL);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+ if (uri)
+ return brasero_string_get_uri (priv->uri);
+ else
+ return brasero_string_get_localpath (priv->uri);
+}
+
+guint64
+brasero_track_stream_get_gap (BraseroTrackStream *track)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), 0);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+ return priv->gap;
+}
+
+guint64
+brasero_track_stream_get_start (BraseroTrackStream *track)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), 0);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+ return priv->start;
+}
+
+guint64
+brasero_track_stream_get_end (BraseroTrackStream *track)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), 0);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+ return priv->end;
+}
+
+/* FIXME: This is bad */
+BraseroStreamInfo *
+brasero_track_stream_get_info (BraseroTrackStream *track)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), 0);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+ return priv->info;
+}
+
+BraseroBurnResult
+brasero_track_stream_get_length (BraseroTrackStream *track,
+ guint64 *length)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), BRASERO_BURN_ERR);
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+
+ if (priv->start < 0 || priv->end <= 0)
+ return BRASERO_BURN_ERR;
+
+ *length = BRASERO_STREAM_LENGTH (priv->start, priv->end + priv->gap);
+
+ return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
+brasero_track_stream_get_size (BraseroTrack *track,
+ guint64 *blocks,
+ guint *block_size)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+
+ if (blocks) {
+ guint64 length = 0;
+
+ brasero_track_stream_get_length (BRASERO_TRACK_STREAM (track), &length);
+ *blocks = length * 75LL / 1000000000LL;
+ }
+
+ if (block_size)
+ *block_size = 2352;
+
+ return BRASERO_BURN_OK;
+}
+
+static BraseroTrackDataType
+brasero_track_stream_get_track_type (BraseroTrack *track,
+ BraseroTrackType *type)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (track);
+
+ if (!type)
+ return BRASERO_TRACK_TYPE_STREAM;
+
+ type->type = BRASERO_TRACK_TYPE_STREAM;
+ type->subtype.audio_format = priv->format;
+
+ return BRASERO_TRACK_TYPE_STREAM;
+}
+
+static void
+brasero_track_stream_init (BraseroTrackStream *object)
+{ }
+
+static void
+brasero_track_stream_finalize (GObject *object)
+{
+ BraseroTrackStreamPrivate *priv;
+
+ priv = BRASERO_TRACK_STREAM_PRIVATE (object);
+ if (priv->uri) {
+ g_free (priv->uri);
+ priv->uri = NULL;
+ }
+
+ if (priv->info) {
+ brasero_stream_info_free (priv->info);
+ priv->info = NULL;
+ }
+
+ G_OBJECT_CLASS (brasero_track_stream_parent_class)->finalize (object);
+}
+
+static void
+brasero_track_stream_class_init (BraseroTrackStreamClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ BraseroTrackClass *track_class = BRASERO_TRACK_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroTrackStreamPrivate));
+
+ object_class->finalize = brasero_track_stream_finalize;
+
+ track_class->get_size = brasero_track_stream_get_size;
+ track_class->get_type = brasero_track_stream_get_track_type;
+}
+
+BraseroTrackStream *
+brasero_track_stream_new (void)
+{
+ return g_object_new (BRASERO_TYPE_TRACK_STREAM, NULL);
+}
Added: trunk/libbrasero-burn/brasero-track-stream.h
==============================================================================
--- (empty file)
+++ trunk/libbrasero-burn/brasero-track-stream.h Sun Mar 29 15:50:32 2009
@@ -0,0 +1,136 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-media
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-media is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-media authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-media. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-media is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-media is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _BRASERO_TRACK_STREAM_H_
+#define _BRASERO_TRACK_STREAM_H_
+
+#include <glib-object.h>
+
+#include "brasero-enums.h"
+#include "brasero-track.h"
+
+G_BEGIN_DECLS
+
+#define BRASERO_STREAM_FORMAT_AUDIO(stream_FORMAT) ((stream_FORMAT) & 0x007F)
+#define BRASERO_STREAM_FORMAT_VIDEO(stream_FORMAT) ((stream_FORMAT) & 0x0380)
+
+#define BRASERO_MIN_STREAM_LENGTH ((gint64) 6 * 1000000000LL)
+#define BRASERO_STREAM_LENGTH(start_MACRO, end_MACRO) \
+ ((end_MACRO) - (start_MACRO) > BRASERO_MIN_STREAM_LENGTH) ? \
+ ((end_MACRO) - (start_MACRO)) : BRASERO_MIN_STREAM_LENGTH
+
+#define BRASERO_STREAM_TRACK_HAS_VIDEO(type_MACRO) \
+ (((type_MACRO)->type == BRASERO_TRACK_TYPE_STREAM) && \
+ ((type_MACRO)->subtype.audio_format & (BRASERO_VIDEO_FORMAT_UNDEFINED| \
+ BRASERO_VIDEO_FORMAT_VCD| \
+ BRASERO_VIDEO_FORMAT_VIDEO_DVD)))
+
+struct _BraseroStreamInfo {
+ gchar *title;
+ gchar *artist;
+ gchar *composer;
+ gint isrc;
+};
+
+typedef struct _BraseroStreamInfo BraseroStreamInfo;
+
+void
+brasero_stream_info_free (BraseroStreamInfo *info);
+
+BraseroStreamInfo *
+brasero_stream_info_copy (BraseroStreamInfo *info);
+
+
+#define BRASERO_TYPE_TRACK_STREAM (brasero_track_stream_get_type ())
+#define BRASERO_TRACK_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_TRACK_STREAM, BraseroTrackStream))
+#define BRASERO_TRACK_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_TRACK_STREAM, BraseroTrackStreamClass))
+#define BRASERO_IS_TRACK_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_TRACK_STREAM))
+#define BRASERO_IS_TRACK_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_TRACK_STREAM))
+#define BRASERO_TRACK_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_TRACK_STREAM, BraseroTrackStreamClass))
+
+typedef struct _BraseroTrackStreamClass BraseroTrackStreamClass;
+typedef struct _BraseroTrackStream BraseroTrackStream;
+
+struct _BraseroTrackStreamClass
+{
+ GObjectClass parent_class;
+};
+
+struct _BraseroTrackStream
+{
+ GObject parent_instance;
+};
+
+GType brasero_track_stream_get_type (void) G_GNUC_CONST;
+
+BraseroTrackStream *
+brasero_track_stream_new (void);
+
+BraseroBurnResult
+brasero_track_stream_set_source (BraseroTrackStream *track,
+ const gchar *uri);
+
+BraseroBurnResult
+brasero_track_stream_set_format (BraseroTrackStream *track,
+ BraseroStreamFormat format);
+
+BraseroBurnResult
+brasero_track_stream_set_info (BraseroTrackStream *track,
+ BraseroStreamInfo *info);
+
+BraseroBurnResult
+brasero_track_stream_set_boundaries (BraseroTrackStream *track,
+ gint64 start,
+ gint64 end,
+ gint64 gap);
+
+gchar *
+brasero_track_stream_get_source (BraseroTrackStream *track,
+ gboolean uri);
+
+BraseroBurnResult
+brasero_track_stream_get_length (BraseroTrackStream *track,
+ guint64 *length);
+
+BraseroStreamInfo *
+brasero_track_stream_get_info (BraseroTrackStream *track);
+
+guint64
+brasero_track_stream_get_start (BraseroTrackStream *track);
+
+guint64
+brasero_track_stream_get_end (BraseroTrackStream *track);
+
+guint64
+brasero_track_stream_get_gap (BraseroTrackStream *track);
+
+G_END_DECLS
+
+#endif /* _BRASERO_TRACK_STREAM_H_ */
Modified: trunk/libbrasero-burn/burn-image-format.c
==============================================================================
--- trunk/libbrasero-burn/burn-image-format.c (original)
+++ trunk/libbrasero-burn/burn-image-format.c Sun Mar 29 15:50:32 2009
@@ -421,6 +421,7 @@
brasero_image_format_get_cdrdao_size (gchar *uri,
guint64 *sectors,
guint64 *size_img,
+ GCancellable *cancel,
GError **error)
{
GFile *file;
@@ -431,7 +432,7 @@
GDataInputStream *stream;
file = g_file_new_for_uri (uri);
- input = g_file_read (file, NULL, error);
+ input = g_file_read (file, cancel, error);
if (!input) {
g_object_unref (file);
@@ -442,7 +443,7 @@
g_object_unref (input);
parent = g_file_get_parent (file);
- while ((line = g_data_input_stream_read_line (stream, NULL, NULL, error))) {
+ while ((line = g_data_input_stream_read_line (stream, NULL, cancel, error))) {
gchar *ptr;
if ((ptr = strstr (line, "DATAFILE"))) {
@@ -521,6 +522,7 @@
brasero_image_format_get_cue_size (gchar *uri,
guint64 *blocks,
guint64 *size_img,
+ GCancellable *cancel,
GError **error)
{
GFile *file;
@@ -530,7 +532,7 @@
GDataInputStream *stream;
file = g_file_new_for_uri (uri);
- input = g_file_read (file, NULL, error);
+ input = g_file_read (file, cancel, error);
if (!input) {
g_object_unref (file);
@@ -540,7 +542,7 @@
stream = g_data_input_stream_new (G_INPUT_STREAM (input));
g_object_unref (input);
- while ((line = g_data_input_stream_read_line (stream, NULL, NULL, error))) {
+ while ((line = g_data_input_stream_read_line (stream, NULL, cancel, error))) {
const gchar *ptr;
if ((ptr = strstr (line, "FILE"))) {
@@ -637,70 +639,83 @@
}
BraseroImageFormat
-brasero_image_format_identify_cuesheet (const gchar *path)
+brasero_image_format_identify_cuesheet (const gchar *uri,
+ GCancellable *cancel,
+ GError **error)
{
- FILE *file;
+ GFile *file;
+ gchar *line;
+ GFileInputStream *input;
+ GDataInputStream *stream;
BraseroImageFormat format;
- gchar buffer [MAXPATHLEN * 2];
- if (!path)
- return BRASERO_IMAGE_FORMAT_NONE;
+ file = g_file_new_for_uri (uri);
+ input = g_file_read (file, cancel, error);
+ if (!input) {
+ g_object_unref (file);
+ return FALSE;
+ }
- /* NOTE: the problem here is that cdrdao files can have references to
- * multiple files. Which is great but not for us ... */
- file = fopen (path, "r");
- if (!file)
- return BRASERO_IMAGE_FORMAT_NONE;
+ stream = g_data_input_stream_new (G_INPUT_STREAM (input));
+ g_object_unref (input);
format = BRASERO_IMAGE_FORMAT_NONE;
- while (fgets (buffer, sizeof (buffer), file)) {
+ while ((line = g_data_input_stream_read_line (stream, NULL, cancel, error))) {
/* Keywords for cdrdao cuesheets */
- if (strstr (buffer, "CD_ROM_XA")
- || strstr (buffer, "CD_ROM")
- || strstr (buffer, "CD_DA")
- || strstr (buffer, "CD_TEXT")) {
+ if (strstr (line, "CD_ROM_XA")
+ || strstr (line, "CD_ROM")
+ || strstr (line, "CD_DA")
+ || strstr (line, "CD_TEXT")) {
format = BRASERO_IMAGE_FORMAT_CDRDAO;
+ g_free (line);
break;
}
- else if (strstr (buffer, "TRACK")) {
+ else if (strstr (line, "TRACK")) {
/* NOTE: there is also "AUDIO" but it's common to both */
/* CDRDAO */
- if (strstr (buffer, "MODE1")
- || strstr (buffer, "MODE1_RAW")
- || strstr (buffer, "MODE2_FORM1")
- || strstr (buffer, "MODE2_FORM2")
- || strstr (buffer, "MODE_2_RAW")
- || strstr (buffer, "MODE2_FORM_MIX")
- || strstr (buffer, "MODE2")) {
+ if (strstr (line, "MODE1")
+ || strstr (line, "MODE1_RAW")
+ || strstr (line, "MODE2_FORM1")
+ || strstr (line, "MODE2_FORM2")
+ || strstr (line, "MODE_2_RAW")
+ || strstr (line, "MODE2_FORM_MIX")
+ || strstr (line, "MODE2")) {
format = BRASERO_IMAGE_FORMAT_CDRDAO;
+ g_free (line);
break;
}
/* .CUE file */
- else if (strstr (buffer, "CDG")
- || strstr (buffer, "MODE1/2048")
- || strstr (buffer, "MODE1/2352")
- || strstr (buffer, "MODE2/2336")
- || strstr (buffer, "MODE2/2352")
- || strstr (buffer, "CDI/2336")
- || strstr (buffer, "CDI/2352")) {
+ else if (strstr (line, "CDG")
+ || strstr (line, "MODE1/2048")
+ || strstr (line, "MODE1/2352")
+ || strstr (line, "MODE2/2336")
+ || strstr (line, "MODE2/2352")
+ || strstr (line, "CDI/2336")
+ || strstr (line, "CDI/2352")) {
format = BRASERO_IMAGE_FORMAT_CUE;
+ g_free (line);
break;
}
}
- else if (strstr (buffer, "FILE")) {
- if (strstr (buffer, "MOTOROLA")
- || strstr (buffer, "BINARY")
- || strstr (buffer, "AIFF")
- || strstr (buffer, "WAVE")
- || strstr (buffer, "MP3")) {
+ else if (strstr (line, "FILE")) {
+ if (strstr (line, "MOTOROLA")
+ || strstr (line, "BINARY")
+ || strstr (line, "AIFF")
+ || strstr (line, "WAVE")
+ || strstr (line, "MP3")) {
format = BRASERO_IMAGE_FORMAT_CUE;
+ g_free (line);
break;
}
}
+ g_free (line);
+ line = NULL;
}
- fclose (file);
+
+ g_object_unref (stream);
+ g_object_unref (file);
BRASERO_BURN_LOG_WITH_FULL_TYPE (BRASERO_TRACK_TYPE_IMAGE,
format,
@@ -713,6 +728,7 @@
brasero_image_format_get_iso_size (gchar *uri,
guint64 *blocks,
guint64 *size_img,
+ GCancellable *cancel,
GError **error)
{
GFileInfo *info;
@@ -726,7 +742,7 @@
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_SIZE,
G_FILE_QUERY_INFO_NONE,
- NULL,
+ cancel,
error);
g_object_unref (file);
if (!info)
@@ -746,6 +762,7 @@
brasero_image_format_get_clone_size (gchar *uri,
guint64 *blocks,
guint64 *size_img,
+ GCancellable *cancel,
GError **error)
{
GFileInfo *info;
@@ -759,7 +776,7 @@
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_SIZE,
G_FILE_QUERY_INFO_NONE,
- NULL,
+ cancel,
error);
g_object_unref (file);
Modified: trunk/libbrasero-burn/burn-image-format.h
==============================================================================
--- trunk/libbrasero-burn/burn-image-format.h (original)
+++ trunk/libbrasero-burn/burn-image-format.h Sun Mar 29 15:50:32 2009
@@ -38,7 +38,9 @@
G_BEGIN_DECLS
BraseroImageFormat
-brasero_image_format_identify_cuesheet (const gchar *path);
+brasero_image_format_identify_cuesheet (const gchar *path,
+ GCancellable *cancel,
+ GError **error);
gchar *
brasero_image_format_get_default_path (BraseroImageFormat format);
@@ -55,21 +57,25 @@
brasero_image_format_get_cdrdao_size (gchar *uri,
guint64 *sectors,
guint64 *size_img,
+ GCancellable *cancel,
GError **error);
gboolean
brasero_image_format_get_cue_size (gchar *uri,
guint64 *blocks,
guint64 *size_img,
+ GCancellable *cancel,
GError **error);
gboolean
brasero_image_format_get_iso_size (gchar *uri,
guint64 *blocks,
guint64 *size_img,
+ GCancellable *cancel,
GError **error);
gboolean
brasero_image_format_get_clone_size (gchar *uri,
guint64 *blocks,
guint64 *size_img,
+ GCancellable *cancel,
GError **error);
G_END_DECLS
Modified: trunk/libbrasero-burn/plugins/local-track/burn-local-image.c
==============================================================================
--- trunk/libbrasero-burn/plugins/local-track/burn-local-image.c (original)
+++ trunk/libbrasero-burn/plugins/local-track/burn-local-image.c Sun Mar 29 15:50:32 2009
@@ -667,8 +667,8 @@
gchar *uri;
gchar *newtoc;
gchar *newimage;
+ guint64 blocks = 0;
- /* FIXME: save the size */
uri = brasero_track_image_get_source (BRASERO_TRACK_IMAGE (current), TRUE);
newimage = brasero_local_track_translate_uri (self, uri);
g_free (uri);
@@ -677,11 +677,14 @@
newtoc = brasero_local_track_translate_uri (self, uri);
g_free (uri);
+ brasero_track_get_size (current, &blocks, NULL);
+
track = BRASERO_TRACK (brasero_track_image_new ());
brasero_track_image_set_source (BRASERO_TRACK_IMAGE (track),
newimage,
newtoc,
input.subtype.img_format);
+ brasero_track_image_set_block_num (BRASERO_TRACK_IMAGE (track), blocks);
}
break;
Modified: trunk/libbrasero-burn/plugins/local-track/burn-uri.c
==============================================================================
--- trunk/libbrasero-burn/plugins/local-track/burn-uri.c (original)
+++ trunk/libbrasero-burn/plugins/local-track/burn-uri.c Sun Mar 29 15:50:32 2009
@@ -321,6 +321,7 @@
gchar *uri;
gchar *path_toc;
gchar *path_image;
+ guint64 blocks = 0;
BraseroTrackImage *image;
path_image = NULL;
@@ -332,7 +333,7 @@
g_free (uri);
path_toc = NULL;
- uri = brasero_track_image_get_source (BRASERO_TRACK_IMAGE (current), TRUE);
+ uri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (current), TRUE);
if (!brasero_burn_uri_retrieve_path (self, uri, &path_toc)) {
g_free (path_image);
g_free (uri);
@@ -340,11 +341,15 @@
}
g_free (uri);
+ brasero_track_get_size (BRASERO_TRACK (current), &blocks, NULL);
+
image = brasero_track_image_new ();
brasero_track_image_set_source (image,
path_image,
path_toc,
type.subtype.img_format);
+ brasero_track_image_set_block_num (image, blocks);
+
priv->track = BRASERO_TRACK (image);
g_free (path_toc);
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Sun Mar 29 15:50:32 2009
@@ -1,6 +1,7 @@
# List of source files containing translatable strings.
[encoding: UTF-8]
+libbrasero-burn/brasero-track-image-cfg.c
libbrasero-burn/brasero-burn-dialog.c
libbrasero-burn/brasero-burn-options.c
libbrasero-burn/brasero-burn.c
Modified: trunk/src/brasero-app.c
==============================================================================
--- trunk/src/brasero-app.c (original)
+++ trunk/src/brasero-app.c Sun Mar 29 15:50:32 2009
@@ -51,6 +51,7 @@
#include "brasero-burn.h"
#include "brasero-track-disc.h"
#include "brasero-track-image.h"
+#include "brasero-track-image-cfg.h"
#include "brasero-session.h"
#include "brasero-burn-lib.h"
@@ -717,15 +718,15 @@
const gchar *uri)
{
BraseroSessionCfg *session;
- BraseroTrackImage *track;
+ BraseroTrackImageCfg *track;
/* setup, show, and run options dialog */
session = brasero_session_cfg_new ();
- /* FIXME: that's where we'd need a special kind of track that would
- * identify the image type */
- track = brasero_track_image_new ();
- brasero_track_image_set_source (track, uri, NULL, BRASERO_IMAGE_FORMAT_BIN);
+ track = brasero_track_image_cfg_new ();
+ if (uri)
+ brasero_track_image_cfg_set_source (track, uri);
+
brasero_burn_session_add_track (BRASERO_BURN_SESSION (session), BRASERO_TRACK (track));
if (brasero_app_burn_options (app, session))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]