diff --git a/libburn/trunk/cdrskin/cdrskin.c b/libburn/trunk/cdrskin/cdrskin.c index 91699401..3237f5c7 100644 --- a/libburn/trunk/cdrskin/cdrskin.c +++ b/libburn/trunk/cdrskin/cdrskin.c @@ -4021,7 +4021,7 @@ unsupported_with_dvd_minus_rw:; #ifdef Cdrskin_libburn_has_burn_disc_formaT } else if(do_format==1) { - burn_disc_format(drive,0); + burn_disc_format(drive,(off_t) 0,0); #endif } else { diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index ae0d926a..e3b33b24 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.01.05.125715" +#define Cdrskin_timestamP "2007.01.06.120551" diff --git a/libburn/trunk/libburn/async.c b/libburn/trunk/libburn/async.c index 73dd2045..68344083 100644 --- a/libburn/trunk/libburn/async.c +++ b/libburn/trunk/libburn/async.c @@ -41,6 +41,7 @@ struct erase_opts struct format_opts { struct burn_drive *drive; + off_t size; int flag; }; @@ -254,14 +255,15 @@ void burn_disc_erase(struct burn_drive *drive, int fast) /* ts A61230 */ static void *format_worker_func(struct w_list *w) { - burn_disc_format_sync(w->u.format.drive, w->u.format.flag); + burn_disc_format_sync(w->u.format.drive, w->u.format.size, + w->u.format.flag); remove_worker(pthread_self()); return NULL; } /* ts A61230 */ -void burn_disc_format(struct burn_drive *drive, int flag) +void burn_disc_format(struct burn_drive *drive, off_t size, int flag) { struct format_opts o; char msg[160]; @@ -286,6 +288,7 @@ void burn_disc_format(struct burn_drive *drive, int flag) return; } o.drive = drive; + o.size = size; o.flag = flag; add_worker(drive, (WorkerFunc) format_worker_func, &o); } diff --git a/libburn/trunk/libburn/drive.c b/libburn/trunk/libburn/drive.c index 5ab94369..c84245f2 100644 --- a/libburn/trunk/libburn/drive.c +++ b/libburn/trunk/libburn/drive.c @@ -470,13 +470,13 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast) } -void burn_disc_format_sync(struct burn_drive *d, int flag) +void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag) { int ret; d->cancel = 0; d->busy = BURN_DRIVE_FORMATTING; - ret = d->format_unit(d, 0); + ret = d->format_unit(d, (off_t) 0, 0); if (ret <= 0) d->cancel = 1; /* reset the progress */ diff --git a/libburn/trunk/libburn/drive.h b/libburn/trunk/libburn/drive.h index b8356330..dca49d46 100644 --- a/libburn/trunk/libburn/drive.h +++ b/libburn/trunk/libburn/drive.h @@ -93,6 +93,6 @@ int burn_mdata_free_subs(struct scsi_mode_data *m); /* ts A61230 */ -void burn_disc_format_sync(struct burn_drive *d, int flag); +void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag); #endif /* __DRIVE */ diff --git a/libburn/trunk/libburn/libburn.h b/libburn/trunk/libburn/libburn.h index b20a899d..73391367 100644 --- a/libburn/trunk/libburn/libburn.h +++ b/libburn/trunk/libburn/libburn.h @@ -842,14 +842,15 @@ void burn_read_opts_free(struct burn_read_opts *opts); void burn_disc_erase(struct burn_drive *drive, int fast); -/* ts A70101 */ +/* ts A70101 - A70106 */ /** Format media for use with libburn. This currently applies only to DVD-RW in state "Sequential Recording" (profile 0014h) which get formatted to state "Restricted Overwrite" (profile 0013h). @param drive The drive with the disc to format. - @param flag Unused yet. Submit 0. + @param size Unused yet. Submit: (off_t) 0. + @param flag Unused yet. Submit: 0. */ -void burn_disc_format(struct burn_drive *drive, int flag); +void burn_disc_format(struct burn_drive *drive, off_t size, int flag); /* ts A61109 : this was and is defunct */ diff --git a/libburn/trunk/libburn/mmc.c b/libburn/trunk/libburn/mmc.c index 23569210..d58b7916 100644 --- a/libburn/trunk/libburn/mmc.c +++ b/libburn/trunk/libburn/mmc.c @@ -1169,11 +1169,12 @@ int mmc_read_buffer_capacity(struct burn_drive *d) @param flag unused yet, submit 0 */ -int mmc_format_unit(struct burn_drive *d, int flag) +int mmc_format_unit(struct burn_drive *d, off_t size, int flag) { struct buffer buf; struct command c; - int ret, tolerate_failure = 0, return_immediately = 0; + int ret, tolerate_failure = 0, return_immediately = 0, i; + off_t num_of_blocks = 0; char msg[160],descr[80]; mmc_function_spy("mmc_format_unit"); @@ -1189,11 +1190,15 @@ int mmc_format_unit(struct burn_drive *d, int flag) descr[0] = 0; c.page->data[1] = 0x02; /* Immed */ c.page->data[3] = 8; /* Format descriptor length */ + num_of_blocks = size / 2048; + for (i = 0; i < 4; i++) + c.page->data[4 + i] = (num_of_blocks >> (24 - 8 * i)) & 0xff; if (d->current_profile == 0x1a) { /* DVD+RW */ /* >>> use case: background formatting during write */ /* mmc5r03c.pdf , 6.5.4.2.14, DVD+RW Basic Format */ c.page->data[8] = 0x26 << 2; /* Format type */ + /* Note: parameter "size" is ignored here */ memset(c.page->data + 4, 0xff, 4); /* maximum blocksize */ if (d->bg_format_status == 1) /* is partly formatted */ c.page->data[11] = 1; /* Restart bit */ diff --git a/libburn/trunk/libburn/mmc.h b/libburn/trunk/libburn/mmc.h index e79cb922..df0938b8 100644 --- a/libburn/trunk/libburn/mmc.h +++ b/libburn/trunk/libburn/mmc.h @@ -53,7 +53,7 @@ int mmc_setup_drive(struct burn_drive *d); /* ts A61219 : learned much from dvd+rw-tools-7.0: plus_rw_format() and mmc5r03c.pdf, 6.5 FORMAT UNIT */ -int mmc_format_unit(struct burn_drive *d, int flag); +int mmc_format_unit(struct burn_drive *d, off_t size, int flag); /* ts A61225 : obtain write speed descriptors via ACh GET PERFORMANCE */ int mmc_get_write_performance(struct burn_drive *d); diff --git a/libburn/trunk/libburn/transport.h b/libburn/trunk/libburn/transport.h index b8df4e7f..c058f795 100644 --- a/libburn/trunk/libburn/transport.h +++ b/libburn/trunk/libburn/transport.h @@ -224,7 +224,7 @@ struct burn_drive int (*read_buffer_capacity) (struct burn_drive *d); /* ts A61220 : format media (e.g. DVD+RW) */ - int (*format_unit) (struct burn_drive *d, int flag); + int (*format_unit) (struct burn_drive *d, off_t size, int flag); }; diff --git a/libburn/trunk/libburn/write.c b/libburn/trunk/libburn/write.c index b6abfbb2..8836f737 100644 --- a/libburn/trunk/libburn/write.c +++ b/libburn/trunk/libburn/write.c @@ -943,7 +943,7 @@ int burn_disc_setup_dvd_plus_rw(struct burn_write_opts *o, if (d->bg_format_status==0 || d->bg_format_status==1) { d->busy = BURN_DRIVE_FORMATTING; /* start or re-start dvd_plus_rw formatting */ - ret = d->format_unit(d, 0); + ret = d->format_unit(d, (off_t) 0, 0); if (ret <= 0) return 0; d->busy = BURN_DRIVE_WRITING; @@ -995,7 +995,7 @@ int burn_disc_setup_dvd_minus_rw(struct burn_write_opts *o, d->busy = BURN_DRIVE_FORMATTING; - ret = d->format_unit(d, 0); /* "quick grow" */ + ret = d->format_unit(d, (off_t) 0, 0); /* "quick grow" */ if (ret <= 0) return 0; d->busy = BURN_DRIVE_WRITING; diff --git a/libburn/trunk/test/libburner.c b/libburn/trunk/test/libburner.c index 00bf4465..91dd9cf8 100644 --- a/libburn/trunk/test/libburner.c +++ b/libburn/trunk/test/libburner.c @@ -321,7 +321,7 @@ int libburner_format_row(struct burn_drive *drive) return 0; } printf("Beginning to format media.\n"); - burn_disc_format(drive, 0); + burn_disc_format(drive, (off_t) 0, 0); sleep(1); while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) { if(p.sectors>0 && p.sector>=0) /* display 1 to 99 percent */