With full formatting prefer format 10h over 13h or 15h

This commit is contained in:
Thomas Schmitt 2007-01-11 13:29:39 +00:00
parent fcc9f8fe8e
commit ef6212f4ec
2 changed files with 12 additions and 9 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.01.10.204839" #define Cdrskin_timestamP "2007.01.11.131106"

View File

@ -1114,7 +1114,7 @@ void mmc_get_configuration(struct burn_drive *d)
int mmc_read_format_capacities(struct burn_drive *d, int top_wanted) int mmc_read_format_capacities(struct burn_drive *d, int top_wanted)
{ {
struct buffer buf; struct buffer buf;
int len, type, score, num_descr, max_score = -1, i; int len, type, score, num_descr, max_score = -2000000000, i, sign = 1;
off_t size; off_t size;
struct command c; struct command c;
unsigned char *dpt; unsigned char *dpt;
@ -1161,6 +1161,9 @@ int mmc_read_format_capacities(struct burn_drive *d, int top_wanted)
d->format_curr_max_size *= (off_t) 2048; d->format_curr_max_size *= (off_t) 2048;
if (top_wanted == 0x00 || top_wanted == 0x10)
sign = -1; /* the caller clearly desires full format */
/* 6.24.3.3 Formattable Capacity Descriptors */ /* 6.24.3.3 Formattable Capacity Descriptors */
num_descr = (len - 8) / 8; num_descr = (len - 8) / 8;
for (i = 0; i < num_descr; i++) { for (i = 0; i < num_descr; i++) {
@ -1177,20 +1180,20 @@ int mmc_read_format_capacities(struct burn_drive *d, int top_wanted)
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
msg, 0, 0); msg, 0, 0);
/* Scoring strives for quick intermediate state */ /* Criterion is proximity to quick intermediate state */
if (type == 0x00) { /* full format (with lead out) */ if (type == 0x00) { /* full format (with lead out) */
score = 1; score = 1 * sign;
} else if (type == 0x10) { /* DVD-RW full format */ } else if (type == 0x10) { /* DVD-RW full format */
score = 10; score = 10 * sign;
} else if(type == 0x13) { /* DVD-RW quick grow last session */ } else if(type == 0x13) { /* DVD-RW quick grow last session */
score = 100; score = 100 * sign;
} else if(type == 0x15) { /* DVD-RW Quick */ } else if(type == 0x15) { /* DVD-RW Quick */
score = 50; score = 50 * sign;
} else { } else {
continue; continue;
} }
if(type == top_wanted) if (type == top_wanted)
score+= 1000000000; score += 1000000000;
if (score > max_score) { if (score > max_score) {
d->best_format_type = type; d->best_format_type = type;
d->best_format_size = size; d->best_format_size = size;