brasero r952 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r952 - in trunk: . src
- Date: Sun, 6 Jul 2008 13:37:35 +0000 (UTC)
Author: philippr
Date: Sun Jul 6 13:37:34 2008
New Revision: 952
URL: http://svn.gnome.org/viewvc/brasero?rev=952&view=rev
Log:
Fix #506398 â toc image type not autodetected correctly
Also give a name for the volume when gvolume is still not available.
* src/brasero-image-option-dialog.c
(brasero_image_option_dialog_image_info_cb):
* src/burn-image-format.c (brasero_image_format_identify_cuesheet):
* src/burn-image-format.h:
* src/burn-track.c (brasero_track_get_image_size):
* src/burn-volume-obj.c (brasero_volume_get_gvolume),
(brasero_volume_is_mounted), (brasero_volume_get_mount_point),
(brasero_volume_umount), (brasero_volume_mount),
(brasero_volume_eject), (brasero_volume_get_name),
(brasero_volume_get_display_label):
Modified:
trunk/ChangeLog
trunk/src/brasero-image-option-dialog.c
trunk/src/burn-image-format.c
trunk/src/burn-image-format.h
trunk/src/burn-track.c
trunk/src/burn-volume-obj.c
Modified: trunk/src/brasero-image-option-dialog.c
==============================================================================
--- trunk/src/brasero-image-option-dialog.c (original)
+++ trunk/src/brasero-image-option-dialog.c Sun Jul 6 13:37:34 2008
@@ -152,15 +152,24 @@
uri,
NULL);
else if (!strcmp (g_file_info_get_content_type (info), "application/x-cdrdao-toc"))
+ /* This image type is installed by brasero */
brasero_image_option_dialog_set_track (dialog,
BRASERO_IMAGE_FORMAT_CDRDAO,
NULL,
uri);
- else if (!strcmp (g_file_info_get_content_type (info), "application/x-cue"))
+ else if (!strcmp (g_file_info_get_content_type (info), "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);
+
brasero_image_option_dialog_set_track (dialog,
BRASERO_IMAGE_FORMAT_CUE,
NULL,
uri);
+ }
else
brasero_image_option_dialog_set_track (dialog,
BRASERO_IMAGE_FORMAT_NONE,
Modified: trunk/src/burn-image-format.c
==============================================================================
--- trunk/src/burn-image-format.c (original)
+++ trunk/src/burn-image-format.c Sun Jul 6 13:37:34 2008
@@ -645,6 +645,79 @@
return TRUE;
}
+BraseroImageFormat
+brasero_image_format_identify_cuesheet (const gchar *path)
+{
+ FILE *file;
+ BraseroImageFormat format;
+ gchar buffer [MAXPATHLEN * 2];
+
+ if (!path)
+ return BRASERO_IMAGE_FORMAT_NONE;
+
+ /* 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;
+
+ format = BRASERO_IMAGE_FORMAT_NONE;
+ while (fgets (buffer, sizeof (buffer), file)) {
+ /* Keywords for cdrdao cuesheets */
+ if (strstr (buffer, "CD_ROM_XA")
+ || strstr (buffer, "CD_ROM")
+ || strstr (buffer, "CD_DA")
+ || strstr (buffer, "CD_TEXT")) {
+ format = BRASERO_IMAGE_FORMAT_CDRDAO;
+ break;
+ }
+ else if (strstr (buffer, "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")) {
+ format = BRASERO_IMAGE_FORMAT_CDRDAO;
+ 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")) {
+ format = BRASERO_IMAGE_FORMAT_CUE;
+ break;
+ }
+ }
+ else if (strstr (buffer, "FILE")) {
+ if (strstr (buffer, "MOTOROLA")
+ || strstr (buffer, "BINARY")
+ || strstr (buffer, "AIFF")
+ || strstr (buffer, "WAVE")
+ || strstr (buffer, "MP3")) {
+ format = BRASERO_IMAGE_FORMAT_CUE;
+ break;
+ }
+ }
+ }
+ fclose (file);
+
+ BRASERO_BURN_LOG_WITH_FULL_TYPE (BRASERO_TRACK_TYPE_IMAGE,
+ format,
+ BRASERO_BURN_FLAG_NONE,
+ "Detected");
+ return format;
+}
+
gboolean
brasero_image_format_get_iso_size (gchar *path,
gint64 *blocks,
Modified: trunk/src/burn-image-format.h
==============================================================================
--- trunk/src/burn-image-format.h (original)
+++ trunk/src/burn-image-format.h Sun Jul 6 13:37:34 2008
@@ -43,6 +43,9 @@
BRASERO_IMAGE_FORMAT_CLONE,
} BraseroImageFormat;
+BraseroImageFormat
+brasero_image_format_identify_cuesheet (const gchar *path);
+
gchar *
brasero_image_format_get_complement (BraseroImageFormat format,
const gchar *path);
Modified: trunk/src/burn-track.c
==============================================================================
--- trunk/src/burn-track.c (original)
+++ trunk/src/burn-track.c Sun Jul 6 13:37:34 2008
@@ -1021,7 +1021,7 @@
image = (BraseroTrackImage *) track;
- /* Convienience function */
+ /* Convenience function */
if (track->type.subtype.img_format == BRASERO_IMAGE_FORMAT_BIN) {
gchar *path;
Modified: trunk/src/burn-volume-obj.c
==============================================================================
--- trunk/src/burn-volume-obj.c (original)
+++ trunk/src/burn-volume-obj.c Sun Jul 6 13:37:34 2008
@@ -33,6 +33,7 @@
#include <gio/gio.h>
#include "burn-basics.h"
+#include "burn-debug.h"
#include "burn-volume-obj.h"
typedef struct _BraseroVolumePrivate BraseroVolumePrivate;
@@ -87,7 +88,6 @@
tmp = iter->data;
device_path = g_volume_get_identifier (tmp, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
-
if (!strcmp (device_path, volume_path)) {
volume = tmp;
g_free (device_path);
@@ -101,7 +101,7 @@
g_list_free (volumes);
if (!volume)
- g_warning ("No volume found for medium");
+ BRASERO_BURN_LOG ("No volume found for medium");
return volume;
}
@@ -119,6 +119,9 @@
priv = BRASERO_VOLUME_PRIVATE (self);
volume = brasero_volume_get_gvolume (self);
+ if (!volume)
+ return FALSE;
+
if (!g_volume_can_mount (volume)) {
/* if it can't be mounted then it's unmounted ... */
g_object_unref (volume);
@@ -147,6 +150,8 @@
priv = BRASERO_VOLUME_PRIVATE (self);
volume = brasero_volume_get_gvolume (self);
+ if (!volume)
+ return NULL;
/* get the uri for the mount point */
mount = g_volume_get_mount (volume);
@@ -296,6 +301,9 @@
priv = BRASERO_VOLUME_PRIVATE (self);
volume = brasero_volume_get_gvolume (self);
+ if (!volume)
+ return TRUE;
+
if (!g_volume_can_mount (volume)) {
/* if it can't be mounted then it's unmounted ... */
g_object_unref (volume);
@@ -395,6 +403,9 @@
priv = BRASERO_VOLUME_PRIVATE (self);
volume = brasero_volume_get_gvolume (self);
+ if (!volume)
+ return FALSE;
+
if (!g_volume_can_mount (volume)) {
g_object_unref (volume);
return FALSE;
@@ -481,6 +492,9 @@
priv = BRASERO_VOLUME_PRIVATE (self);
volume = brasero_volume_get_gvolume (self);
+ if (!volume)
+ return FALSE;
+
gdrive = g_volume_get_drive (volume);
g_object_unref (volume);
@@ -557,6 +571,9 @@
}
volume = brasero_volume_get_gvolume (self);
+ if (!volume)
+ return NULL;
+
name = g_volume_get_name (volume);
g_object_unref (volume);
@@ -595,26 +612,31 @@
type = brasero_medium_get_type_string (BRASERO_MEDIUM (self));
+ name = NULL;
volume = brasero_volume_get_gvolume (self);
- name = g_volume_get_name (volume);
- g_object_unref (volume);
+ if (volume) {
+ name = g_volume_get_name (volume);
+ g_object_unref (volume);
- if (name && name [0] != '\0') {
- if (with_markup)
- /* NOTE for translators: the first %s is the disc type and the
- * second %s the label of the already existing session on this disc. */
- label = g_strdup_printf (_("<b>Data %s</b>: \"%s\""),
- type,
- name);
- else
- label = g_strdup_printf (_("Data %s: \"%s\""),
- type,
- name);
+ if (name && name [0] != '\0') {
+ if (with_markup)
+ /* NOTE for translators: the first %s is the disc type and the
+ * second %s the label of the already existing session on this disc. */
+ label = g_strdup_printf (_("<b>Data %s</b>: \"%s\""),
+ type,
+ name);
+ else
+ label = g_strdup_printf (_("Data %s: \"%s\""),
+ type,
+ name);
- g_free (name);
- return label;
+ g_free (name);
+ return label;
+ }
+
+ if (name)
+ g_free (name);
}
- g_free (name);
drive = brasero_medium_get_drive (BRASERO_MEDIUM (self));
name = brasero_drive_get_display_name (drive);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]