Automatic fast format on attempt to write to unformatted DVD-RAM or BD-RE

This commit is contained in:
Thomas Schmitt 2008-05-14 17:34:09 +00:00
parent b287c109c3
commit d7c4fadba3
2 changed files with 31 additions and 9 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.05.14.173201"
#define Xorriso_timestamP "2008.05.14.173430"

View File

@ -850,7 +850,8 @@ no_track:;
padding= xorriso->padding / 2048;
if(xorriso->padding > padding * 2048)
padding++;
if(img_sectors>0 && (profile==0x09 || profile==0x0a)) { /* CD-R , CD-RW */
if(img_sectors>0 && ret>0 &&
(profile==0x09 || profile==0x0a)) { /* CD-R , CD-RW */
if(img_sectors + padding < Xorriso_cd_min_track_sizE) {
padding= Xorriso_cd_min_track_sizE - img_sectors;
sprintf(xorriso->info_text,
@ -888,15 +889,16 @@ ex:;
*/
int Xorriso_write_session(struct XorrisO *xorriso, int flag)
{
int ret, relax= 0, i;
int ret, relax= 0, i, profile, status, num_formats;
int major, minor, micro;
char xorriso_id[256], *img_id;
unsigned dummy;
char xorriso_id[256], *img_id, profile_name[80];
struct isoburn_imgen_opts *sopts= NULL;
struct burn_drive_info *dinfo, *source_dinfo;
struct burn_drive *drive, *source_drive;
struct burn_disc *disc= NULL;
struct burn_write_opts *burn_options;
off_t readcounter= 0,writecounter= 0;
off_t readcounter= 0,writecounter= 0, size;
int num_sessions= 0, num_tracks= 0;
struct burn_session **sessions;
struct burn_track **tracks;
@ -908,6 +910,28 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
"on attempt to write", 2);
if(ret<=0)
return(0);
ret= burn_disc_get_profile(drive, &profile, profile_name);
if(ret>0 && (!(flag&1)) &&
(profile==0x12 || profile==0x43)) { /* DVD-RAM or BD-RE */
ret= burn_disc_get_formats(drive, &status, &size, &dummy, &num_formats);
if(ret>0 && status==BURN_FORMAT_IS_UNFORMATTED) {
sprintf(xorriso->info_text,
"Unformatted %s media detected. Trying -format fast.",
profile_name);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
ret= Xorriso_format_media(xorriso, 1);
if(ret<=0) {
sprintf(xorriso->info_text, "Automatic formatting of %s failed",
profile_name);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(ret);
}
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to write", 2);
if(ret<=0)
return(0);
}
}
if(xorriso->out_drive_handle == xorriso->in_drive_handle) {
source_drive= drive;
@ -2378,13 +2402,11 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
#ifdef Xorriso_new_toc_formaT
if(flag&1)
ret= 0;
else
ret= isoburn_read_iso_head(drive, 0, &image_blocks, volume_id, 1);
ret= isoburn_read_iso_head(drive, 0, &image_blocks, volume_id, 1);
if(ret>0) {
sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n",
1, 0, image_blocks, volume_id);
nwa= image_blocks;
} else {
nwa= 0;
ret= burn_disc_get_formats(drive, &status, &size, &dummy,