brasero r798 - in trunk: . src



Author: philippr
Date: Wed May  7 12:48:57 2008
New Revision: 798
URL: http://svn.gnome.org/viewvc/brasero?rev=798&view=rev

Log:
	Fix DVD-RW sequential capacity retrieval

	* src/burn-medium.c (brasero_medium_get_capacity_DVD_RW),
	(brasero_medium_get_capacity_by_type):
	* src/burn-medium.h:
	* src/scsi-read-capacity.h:

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

Modified: trunk/src/burn-medium.c
==============================================================================
--- trunk/src/burn-medium.c	(original)
+++ trunk/src/burn-medium.c	Wed May  7 12:48:57 2008
@@ -585,9 +585,11 @@
 				    BraseroScsiErrCode *code)
 {
 	BraseroScsiFormatCapacitiesHdr *hdr = NULL;
+	BraseroScsiFormattableCapacityDesc *desc;
 	BraseroScsiMaxCapacityDesc *current;
 	BraseroMediumPrivate *priv;
 	BraseroScsiResult result;
+	gint i, max;
 	gint size;
 
 	BRASERO_BURN_LOG ("Retrieving format capacity");
@@ -607,38 +609,28 @@
 	current = hdr->max_caps;
 
 	/* see if the media is already formatted */
-	if (current->type != BRASERO_SCSI_DESC_FORMATTED) {
-		int i, max;
-		BraseroScsiFormattableCapacityDesc *desc;
-
-		max = (hdr->len - 
-		      sizeof (BraseroScsiMaxCapacityDesc)) /
-		      sizeof (BraseroScsiFormattableCapacityDesc);
-
-		desc = hdr->desc;
-		for (i = 0; i < max; i ++, desc ++) {
-			/* search for the correct descriptor */
-			if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_DVDRW_PLUS)) {
-				if (desc->format_type == BRASERO_SCSI_DVDRW_PLUS) {
-					priv->block_num = BRASERO_GET_32 (desc->blocks_num);
-					priv->block_size = BRASERO_GET_24 (desc->type_param);
-
-					/* that can happen */
-					if (!priv->block_size)
-						priv->block_size = 2048;
-					break;
-				}
-			}
-			else if (desc->format_type == BRASERO_SCSI_BLOCK_SIZE_DEFAULT_AND_DB) {
+	max = (hdr->len - 
+	      sizeof (BraseroScsiMaxCapacityDesc)) /
+	      sizeof (BraseroScsiFormattableCapacityDesc);
+
+	desc = hdr->desc;
+	for (i = 0; i < max; i ++, desc ++) {
+		/* search for the correct descriptor */
+		if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_DVDRW_PLUS)) {
+			if (desc->format_type == BRASERO_SCSI_DVDRW_PLUS) {
 				priv->block_num = BRASERO_GET_32 (desc->blocks_num);
 				priv->block_size = BRASERO_GET_24 (desc->type_param);
+
+				/* that can happen */
+				if (!priv->block_size)
+					priv->block_size = 2048;
 				break;
 			}
 		}
-	}
-	else {
-		priv->block_num = BRASERO_GET_32 (current->blocks_num);
-		priv->block_size = BRASERO_GET_24 (current->block_size);
+		else if (desc->format_type == BRASERO_SCSI_MAX_PACKET_SIZE_FORMAT) {
+			priv->block_num = BRASERO_GET_32 (desc->blocks_num);
+			break;
+		}
 	}
 
 	BRASERO_BURN_LOG ("Format capacity %lli %lli",
@@ -658,6 +650,7 @@
 
 	priv = BRASERO_MEDIUM_PRIVATE (self);
 
+	/* For DVDs that's always that block size */
 	priv->block_size = 2048;
 
 	if (!(priv->info & BRASERO_MEDIUM_REWRITABLE))

Modified: trunk/src/burn-medium.h
==============================================================================
--- trunk/src/burn-medium.h	(original)
+++ trunk/src/burn-medium.h	Wed May  7 12:48:57 2008
@@ -30,6 +30,7 @@
 G_BEGIN_DECLS
 
 /* rates are in Kio/sec */
+/* FIXME: rate for audio CD are different 172 K/s */
 #define CD_RATE 153600
 #define DVD_RATE 1385000
 

Modified: trunk/src/scsi-read-capacity.h
==============================================================================
--- trunk/src/scsi-read-capacity.h	(original)
+++ trunk/src/scsi-read-capacity.h	Wed May  7 12:48:57 2008
@@ -22,15 +22,14 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
  */
 
+#include <glib.h>
+
 #include "scsi-base.h"
 
 #ifndef _SCSI_READ_CAPACITY_H
 #define _SCSI_READ_CAPACITY_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
+G_BEGIN_DECLS
 
 /* NOTE: lba is dependent on the media type and block size is always 2048 */
 struct _BraseroScsiReadCapacityData {
@@ -39,9 +38,7 @@
 };
 typedef struct _BraseroScsiReadCapacityData BraseroScsiReadCapacityData;
 
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
 
 #endif /* _SCSI_READ_CAPACITY_H */
 



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