New formatting parameter "size". Sorry for changing API. Function is a week old.
This commit is contained in:
parent
ee909f8f1d
commit
f78e267af1
@ -4021,7 +4021,7 @@ unsupported_with_dvd_minus_rw:;
|
|||||||
|
|
||||||
#ifdef Cdrskin_libburn_has_burn_disc_formaT
|
#ifdef Cdrskin_libburn_has_burn_disc_formaT
|
||||||
} else if(do_format==1) {
|
} else if(do_format==1) {
|
||||||
burn_disc_format(drive,0);
|
burn_disc_format(drive,(off_t) 0,0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2007.01.05.125715"
|
#define Cdrskin_timestamP "2007.01.06.120551"
|
||||||
|
@ -41,6 +41,7 @@ struct erase_opts
|
|||||||
struct format_opts
|
struct format_opts
|
||||||
{
|
{
|
||||||
struct burn_drive *drive;
|
struct burn_drive *drive;
|
||||||
|
off_t size;
|
||||||
int flag;
|
int flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -254,14 +255,15 @@ void burn_disc_erase(struct burn_drive *drive, int fast)
|
|||||||
/* ts A61230 */
|
/* ts A61230 */
|
||||||
static void *format_worker_func(struct w_list *w)
|
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());
|
remove_worker(pthread_self());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ts A61230 */
|
/* 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;
|
struct format_opts o;
|
||||||
char msg[160];
|
char msg[160];
|
||||||
@ -286,6 +288,7 @@ void burn_disc_format(struct burn_drive *drive, int flag)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
o.drive = drive;
|
o.drive = drive;
|
||||||
|
o.size = size;
|
||||||
o.flag = flag;
|
o.flag = flag;
|
||||||
add_worker(drive, (WorkerFunc) format_worker_func, &o);
|
add_worker(drive, (WorkerFunc) format_worker_func, &o);
|
||||||
}
|
}
|
||||||
|
@ -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;
|
int ret;
|
||||||
|
|
||||||
d->cancel = 0;
|
d->cancel = 0;
|
||||||
d->busy = BURN_DRIVE_FORMATTING;
|
d->busy = BURN_DRIVE_FORMATTING;
|
||||||
ret = d->format_unit(d, 0);
|
ret = d->format_unit(d, (off_t) 0, 0);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
d->cancel = 1;
|
d->cancel = 1;
|
||||||
/* reset the progress */
|
/* reset the progress */
|
||||||
|
@ -93,6 +93,6 @@ int burn_mdata_free_subs(struct scsi_mode_data *m);
|
|||||||
|
|
||||||
|
|
||||||
/* ts A61230 */
|
/* 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 */
|
#endif /* __DRIVE */
|
||||||
|
@ -842,14 +842,15 @@ void burn_read_opts_free(struct burn_read_opts *opts);
|
|||||||
void burn_disc_erase(struct burn_drive *drive, int fast);
|
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
|
/** Format media for use with libburn. This currently applies only to DVD-RW
|
||||||
in state "Sequential Recording" (profile 0014h) which get formatted to
|
in state "Sequential Recording" (profile 0014h) which get formatted to
|
||||||
state "Restricted Overwrite" (profile 0013h).
|
state "Restricted Overwrite" (profile 0013h).
|
||||||
@param drive The drive with the disc to format.
|
@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 */
|
/* ts A61109 : this was and is defunct */
|
||||||
|
@ -1169,11 +1169,12 @@ int mmc_read_buffer_capacity(struct burn_drive *d)
|
|||||||
|
|
||||||
@param flag unused yet, submit 0
|
@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 buffer buf;
|
||||||
struct command c;
|
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];
|
char msg[160],descr[80];
|
||||||
|
|
||||||
mmc_function_spy("mmc_format_unit");
|
mmc_function_spy("mmc_format_unit");
|
||||||
@ -1189,11 +1190,15 @@ int mmc_format_unit(struct burn_drive *d, int flag)
|
|||||||
descr[0] = 0;
|
descr[0] = 0;
|
||||||
c.page->data[1] = 0x02; /* Immed */
|
c.page->data[1] = 0x02; /* Immed */
|
||||||
c.page->data[3] = 8; /* Format descriptor length */
|
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 */
|
if (d->current_profile == 0x1a) { /* DVD+RW */
|
||||||
/* >>> use case: background formatting during write */
|
/* >>> use case: background formatting during write */
|
||||||
|
|
||||||
/* mmc5r03c.pdf , 6.5.4.2.14, DVD+RW Basic Format */
|
/* mmc5r03c.pdf , 6.5.4.2.14, DVD+RW Basic Format */
|
||||||
c.page->data[8] = 0x26 << 2; /* Format type */
|
c.page->data[8] = 0x26 << 2; /* Format type */
|
||||||
|
/* Note: parameter "size" is ignored here */
|
||||||
memset(c.page->data + 4, 0xff, 4); /* maximum blocksize */
|
memset(c.page->data + 4, 0xff, 4); /* maximum blocksize */
|
||||||
if (d->bg_format_status == 1) /* is partly formatted */
|
if (d->bg_format_status == 1) /* is partly formatted */
|
||||||
c.page->data[11] = 1; /* Restart bit */
|
c.page->data[11] = 1; /* Restart bit */
|
||||||
|
@ -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()
|
/* ts A61219 : learned much from dvd+rw-tools-7.0: plus_rw_format()
|
||||||
and mmc5r03c.pdf, 6.5 FORMAT UNIT */
|
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 */
|
/* ts A61225 : obtain write speed descriptors via ACh GET PERFORMANCE */
|
||||||
int mmc_get_write_performance(struct burn_drive *d);
|
int mmc_get_write_performance(struct burn_drive *d);
|
||||||
|
@ -224,7 +224,7 @@ struct burn_drive
|
|||||||
int (*read_buffer_capacity) (struct burn_drive *d);
|
int (*read_buffer_capacity) (struct burn_drive *d);
|
||||||
|
|
||||||
/* ts A61220 : format media (e.g. DVD+RW) */
|
/* 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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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) {
|
if (d->bg_format_status==0 || d->bg_format_status==1) {
|
||||||
d->busy = BURN_DRIVE_FORMATTING;
|
d->busy = BURN_DRIVE_FORMATTING;
|
||||||
/* start or re-start dvd_plus_rw 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)
|
if (ret <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
d->busy = BURN_DRIVE_WRITING;
|
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;
|
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)
|
if (ret <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
d->busy = BURN_DRIVE_WRITING;
|
d->busy = BURN_DRIVE_WRITING;
|
||||||
|
@ -321,7 +321,7 @@ int libburner_format_row(struct burn_drive *drive)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
printf("Beginning to format media.\n");
|
printf("Beginning to format media.\n");
|
||||||
burn_disc_format(drive, 0);
|
burn_disc_format(drive, (off_t) 0, 0);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) {
|
while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) {
|
||||||
if(p.sectors>0 && p.sector>=0) /* display 1 to 99 percent */
|
if(p.sectors>0 && p.sector>=0) /* display 1 to 99 percent */
|
||||||
|
Loading…
Reference in New Issue
Block a user