brasero r1199 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1199 - in trunk: . src
- Date: Thu, 28 Aug 2008 12:37:46 +0000 (UTC)
Author: philippr
Date: Thu Aug 28 12:37:46 2008
New Revision: 1199
URL: http://svn.gnome.org/viewvc/brasero?rev=1199&view=rev
Log:
Try to get a valid unique ID for media (only working for CDs and DVD-)
* src/burn-medium.c (brasero_medium_get_DVD_id),
(brasero_medium_get_contents), (brasero_medium_reload_info),
(brasero_medium_finalize), (brasero_medium_get_id):
* src/burn-medium.h:
* src/scsi-read-disc-structure.c
(brasero_mmc2_read_generic_structure):
* src/scsi-read-disc-structure.h:
Modified:
trunk/ChangeLog
trunk/src/burn-medium.c
trunk/src/burn-medium.h
trunk/src/scsi-read-disc-structure.c
trunk/src/scsi-read-disc-structure.h
Modified: trunk/src/burn-medium.c
==============================================================================
--- trunk/src/burn-medium.c (original)
+++ trunk/src/burn-medium.c Thu Aug 28 12:37:46 2008
@@ -92,6 +92,8 @@
gchar *udi;
+ gchar *id;
+
gint max_rd;
gint max_wrt;
@@ -1399,6 +1401,34 @@
return BRASERO_BURN_OK;
}
+static void
+brasero_medium_get_DVD_id (BraseroMedium *self,
+ BraseroDeviceHandle *handle,
+ BraseroScsiErrCode *code)
+{
+ gint size = 0;
+ BraseroScsiResult result;
+ BraseroMediumPrivate *priv;
+ BraseroScsiReadDiscStructureHdr *hdr = NULL;
+
+ priv = BRASERO_MEDIUM_PRIVATE (self);
+
+ /* This should be only possible for DVD-R(W) and not with all drives */
+ result = brasero_mmc2_read_generic_structure (handle,
+ BRASERO_SCSI_FORMAT_LESS_MEDIA_ID_DVD,
+ &hdr,
+ &size,
+ code);
+ if (result != BRASERO_SCSI_OK) {
+ BRASERO_BURN_LOG ("Retrieval of DVD id failed");
+ return;
+ }
+
+ BRASERO_BURN_LOG ("DVD id %d", BRASERO_GET_16 (hdr->data + 2));
+ priv->id = g_strdup_printf ("%d", BRASERO_GET_16 (hdr->data + 2));
+ g_free (hdr);
+}
+
static BraseroBurnResult
brasero_medium_get_contents (BraseroMedium *self,
BraseroDeviceHandle *handle,
@@ -1424,6 +1454,14 @@
return BRASERO_BURN_ERR;
}
+ if (info->disc_id_valid) {
+ /* Try to get the disc identification if possible (CDs only) */
+ BRASERO_BURN_LOG ("Disc id %i", BRASERO_GET_32 (info->disc_id));
+ priv->id = g_strdup_printf ("%d", BRASERO_GET_32 (info->disc_id));
+ }
+ else
+ brasero_medium_get_DVD_id (self, handle, code);
+
if (info->erasable)
priv->info |= BRASERO_MEDIUM_REWRITABLE;
@@ -2359,6 +2397,11 @@
priv->retry_id = 0;
}
+ if (priv->id) {
+ g_free (priv->id);
+ priv->id = NULL;
+ }
+
g_free (priv->rd_speeds);
priv->rd_speeds = NULL;
@@ -2412,6 +2455,11 @@
priv->retry_id = 0;
}
+ if (priv->id) {
+ g_free (priv->id);
+ priv->id = NULL;
+ }
+
g_free (priv->rd_speeds);
priv->rd_speeds = NULL;
@@ -2609,6 +2657,15 @@
return priv->udi;
}
+const gchar *
+brasero_medium_get_id (BraseroMedium *self)
+{
+ BraseroMediumPrivate *priv;
+
+ priv = BRASERO_MEDIUM_PRIVATE (self);
+ return priv->id;
+}
+
GType
brasero_medium_get_type (void)
{
Modified: trunk/src/burn-medium.h
==============================================================================
--- trunk/src/burn-medium.h (original)
+++ trunk/src/burn-medium.h Thu Aug 28 12:37:46 2008
@@ -274,6 +274,9 @@
BraseroDrive *
brasero_medium_get_drive (BraseroMedium *self);
+const gchar *
+brasero_medium_get_id (BraseroMedium *self);
+
G_END_DECLS
#endif /* _BURN_MEDIUM_H_ */
Modified: trunk/src/scsi-read-disc-structure.c
==============================================================================
--- trunk/src/scsi-read-disc-structure.c (original)
+++ trunk/src/scsi-read-disc-structure.c Thu Aug 28 12:37:46 2008
@@ -42,7 +42,7 @@
uchar media_type :4;
uchar reserved0 :4;
- /* for formats 0x83, */
+ /* for formats 0x83 */
uchar address [4];
uchar layer_num;
@@ -152,7 +152,7 @@
cdb->format = type;
res = brasero_read_disc_structure (cdb, data, size, error);
- res = brasero_scsi_command_free (cdb);
+ brasero_scsi_command_free (cdb);
return res;
}
Modified: trunk/src/scsi-read-disc-structure.h
==============================================================================
--- trunk/src/scsi-read-disc-structure.h (original)
+++ trunk/src/scsi-read-disc-structure.h Thu Aug 28 12:37:46 2008
@@ -37,7 +37,9 @@
BRASERO_SCSI_FORMAT_DVD_BURST_CUTTING_AREA = 0x03,
BRASERO_SCSI_FORMAT_DVD_MANUFACTURING_INFO = 0x04,
BRASERO_SCSI_FORMAT_DVD_COPYRIGHT_MNGT = 0x05,
-BRASERO_SCSI_FORMAT_ROM_MEDIA_ID = 0x06,
+
+BRASERO_SCSI_FORMAT_ROM_MEDIA_ID = 0x06, /* Only for ROM medium? */
+
BRASERO_SCSI_FORMAT_ROM_MEDIA_KEY_BLOCK = 0x07,
BRASERO_SCSI_FORMAT_RAM_DDS_INFO = 0x08,
BRASERO_SCSI_FORMAT_RAM_MEDIUM_STATUS = 0x09,
@@ -45,8 +47,10 @@
BRASERO_SCSI_FORMAT_RAM_RECORDING_TYPE = 0x0B,
BRASERO_SCSI_FORMAT_LESS_BORDER_OUT_RMD = 0x0C,
BRASERO_SCSI_FORMAT_LESS_RAM = 0x0D,
-BRASERO_SCSI_FORMAT_LESS_PRE_PIT_INFO = 0x0E, /* See rmd.h only for DVD-R/-RW */
-BRASERO_SCSI_FORMAT_LESS_MEDIA_ID_DVD = 0x0F,
+BRASERO_SCSI_FORMAT_LESS_PRE_PIT_INFO = 0x0E, /* Only for DVD-R/-RW */
+
+BRASERO_SCSI_FORMAT_LESS_MEDIA_ID_DVD = 0x0F, /* Only for DVD-R/-RW */
+
BRASERO_SCSI_FORMAT_LESS_PHYSICAL_FORMAT = 0x10,
BRASERO_SCSI_FORMAT_PLUS_ADIP = 0x11,
BRASERO_SCSI_FORMAT_HD_COPYRIGHT_PROTECTION = 0x12,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]