brasero r1361 - in trunk: . src



Author: philippr
Date: Thu Oct  9 20:42:17 2008
New Revision: 1361
URL: http://svn.gnome.org/viewvc/brasero?rev=1361&view=rev

Log:
	Initial support BD-R(E) and DVD-RAM

	* src/burn-medium.c (brasero_medium_get_capacity_DVD_RW),
	(brasero_medium_get_capacity_by_type),
	(brasero_medium_get_sessions_info),
	(brasero_medium_get_medium_type):
	* src/burn-medium.h:
	* src/scsi-read-format-capacities.h:


Modified:
   trunk/ChangeLog
   trunk/src/burn-medium.c
   trunk/src/burn-medium.h
   trunk/src/scsi-read-format-capacities.h

Modified: trunk/src/burn-medium.c
==============================================================================
--- trunk/src/burn-medium.c	(original)
+++ trunk/src/burn-medium.c	Thu Oct  9 20:42:17 2008
@@ -969,11 +969,31 @@
 		return BRASERO_BURN_ERR;
 	}
 
+	/* NOTE: for BD-RE there is a slight problem to determine the exact
+	 * capacity of the medium when it is unformatted. Indeed the final size
+	 * of the User Data Area will depend on the size of the Spare areas.
+	 * On the other hand if it's formatted then that's OK, just take the 
+	 * current one.
+	 * NOTE: that could work also for BD-R SRM+POW and BD-R RRM */
+
 	/* see if the media is already formatted */
 	current = hdr->max_caps;
 	if (!(current->type & BRASERO_SCSI_DESC_FORMATTED)) {
 		BRASERO_BURN_LOG ("Unformatted media");
 		priv->info |= BRASERO_MEDIUM_UNFORMATTED;
+
+		/* if unformatted, a DVD-RAM will return its maximum formattable
+		 * size in this descriptor and that's what we're looking for. */
+		if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_DVD_RAM)) {
+			priv->block_num = BRASERO_GET_32 (desc->blocks_num);
+			priv->block_size = 2048;
+			goto end;
+		}
+	}
+	else if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_BDRE)) {
+		priv->block_num = BRASERO_GET_32 (desc->blocks_num);
+		priv->block_size = 2048;
+		goto end;
 	}
 
 	max = (hdr->len - 
@@ -995,12 +1015,24 @@
 				break;
 			}
 		}
+		else if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_BDRE)) {
+			/* This is for unformatted BDRE: since we can't know the
+			 * size of the Spare Area in advance, we take the vendor
+			 * preferred one. Always following are the smallest one
+			 * and the biggest one. */
+			if (desc->format_type == BRASERO_SCSI_BDRE_FORMAT) {
+				priv->block_num = BRASERO_GET_32 (desc->blocks_num);
+				break;
+			}
+		}
 		else if (desc->format_type == BRASERO_SCSI_MAX_PACKET_SIZE_FORMAT) {
 			priv->block_num = BRASERO_GET_32 (desc->blocks_num);
 			break;
 		}
 	}
 
+end:
+
 	BRASERO_BURN_LOG ("Format capacity %lli %lli",
 			  priv->block_num,
 			  priv->block_size);
@@ -1018,7 +1050,7 @@
 
 	priv = BRASERO_MEDIUM_PRIVATE (self);
 
-	/* For DVDs that's always that block size */
+	/* For DVDs/BDs that's always that block size */
 	priv->block_size = 2048;
 
 	if (!(priv->info & BRASERO_MEDIUM_REWRITABLE))
@@ -1685,11 +1717,10 @@
 				track->type |= BRASERO_MEDIUM_TRACK_INCREMENTAL;
 		}
 
-		if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_DVDRW_PLUS)
-		||  BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_DVDRW_RESTRICTED)) {
+		if (BRASERO_MEDIUM_RANDOM_WRITABLE (priv->info)) {
 			BraseroBurnResult result;
 
-			/* A special case for these two kinds of media (DVD+RW)
+			/* A special case for these kinds of media (DVD+RW, ...)
 			 * which have only one track: the first. Since it's not
 			 * possible to know the amount of data that were really
 			 * written in this session, read the filesystem. */
@@ -1733,8 +1764,7 @@
 	/* put the tracks in the right order */
 	priv->tracks = g_slist_reverse (priv->tracks);
 
-	if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_DVDRW_PLUS)
-	||  BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_DVDRW_RESTRICTED))
+	if (BRASERO_MEDIUM_RANDOM_WRITABLE (priv->info))
 		brasero_medium_add_DVD_plus_RW_leadout (self);
 	else if (!(priv->info & BRASERO_MEDIUM_CLOSED)) {
 		BraseroMediumTrack *leadout;
@@ -2490,7 +2520,6 @@
 		priv->icon = icons [5];
 		break;
 
-	/* WARNING: these types are recognized, no more */
 	case BRASERO_SCSI_PROF_BD_ROM:
 		priv->info = BRASERO_MEDIUM_BD_ROM;
 		priv->type = types [13];
@@ -2498,6 +2527,7 @@
 		break;
 
 	case BRASERO_SCSI_PROF_BR_R_SEQUENTIAL:
+		/* need to check if that's a POW as well */
 		priv->info = BRASERO_MEDIUM_BDR_SRM;
 		priv->type = types [14];
 		priv->icon = icons [5];
@@ -2510,7 +2540,7 @@
 		break;
 
 	case BRASERO_SCSI_PROF_BD_RW:
-		priv->info = BRASERO_MEDIUM_BDRW;
+		priv->info = BRASERO_MEDIUM_BDRE;
 		priv->type = types [15];
 		priv->icon = icons [6];
 		break;
@@ -2520,7 +2550,8 @@
 		priv->type = types [12];
 		priv->icon = icons [8];
 		break;
-	
+
+	/* WARNING: these types are recognized, no more */
 	case BRASERO_SCSI_PROF_NON_REMOVABLE:
 	case BRASERO_SCSI_PROF_REMOVABLE:
 	case BRASERO_SCSI_PROF_MO_ERASABLE:

Modified: trunk/src/burn-medium.h
==============================================================================
--- trunk/src/burn-medium.h	(original)
+++ trunk/src/burn-medium.h	Thu Oct  9 20:42:17 2008
@@ -37,8 +37,9 @@
  * Source Wikipedia.com =)
  * Apparently most drives return rates that should be used with Audio factor
  */
-#define CD_RATE 176400
-#define DVD_RATE 1385000
+#define CD_RATE 176400 /* bytes by second */
+#define DVD_RATE 1387500
+#define BD_RATE 4500000
 
 typedef struct _BraseroDrive BraseroDrive;
 

Modified: trunk/src/scsi-read-format-capacities.h
==============================================================================
--- trunk/src/scsi-read-format-capacities.h	(original)
+++ trunk/src/scsi-read-format-capacities.h	Thu Oct  9 20:42:17 2008
@@ -56,7 +56,9 @@
 BRASERO_SCSI_SPARING				= 0x20,
 	/* reserved */
 BRASERO_SCSI_MAX_DMA_NUM			= 0x24,
-BRASERO_SCSI_DVDRW_PLUS				= 0x26
+BRASERO_SCSI_DVDRW_PLUS				= 0x26,
+	/* reserved */
+BRASERO_SCSI_BDRE_FORMAT			= 0x30 /* Remember there are 3 in a row */
 } BraseroScsiFormatCapacitiesParamType;
 
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN



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