Implemented option -blank
This commit is contained in:
@ -147,11 +147,16 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
if(flag&2)
|
||||
if(flag&2) {
|
||||
xorriso->out_drive_handle= dinfo;
|
||||
if(flag&1)
|
||||
if(Sfile_str(xorriso->indev, adr, 0)<=0)
|
||||
return(-1);
|
||||
}
|
||||
if(flag&1) {
|
||||
xorriso->in_drive_handle= dinfo;
|
||||
else
|
||||
if(Sfile_str(xorriso->outdev, adr, 0)<=0)
|
||||
return(-1);
|
||||
} else
|
||||
return(1);
|
||||
|
||||
drive= dinfo[0].drive;
|
||||
@ -234,6 +239,7 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
||||
if(dinfo!=NULL)
|
||||
burn_drive_info_free(dinfo);
|
||||
xorriso->out_drive_handle= NULL;
|
||||
xorriso->outdev[0]= 0;
|
||||
}
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
return(1);
|
||||
@ -755,8 +761,78 @@ int Xorriso_tell_media_space(struct XorrisO *xorriso, int flag)
|
||||
|
||||
/* >>> subtract space needed for pending session image */
|
||||
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(free_space<=0)
|
||||
free_space= 0;
|
||||
return(free_space);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0=fast */
|
||||
int Xorriso_blank_media(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret;
|
||||
struct burn_drive_info *dinfo;
|
||||
struct burn_drive *drive;
|
||||
enum burn_disc_status disc_state;
|
||||
struct burn_progress p;
|
||||
double percent = 1.0;
|
||||
int current_profile;
|
||||
char current_profile_name[80];
|
||||
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to -blank", 2);
|
||||
if(ret<=0)
|
||||
return(0);
|
||||
|
||||
burn_disc_get_profile(drive, ¤t_profile, current_profile_name);
|
||||
|
||||
/* >>> */;
|
||||
|
||||
disc_state = isoburn_disc_get_status(drive);
|
||||
if(current_profile == 0x13) {
|
||||
; /* formatted DVD-RW will get blanked to sequential state */
|
||||
} else if(disc_state == BURN_DISC_BLANK) {
|
||||
sprintf(xorriso->info_text,"Blank media detected. Will leave it untouched");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
return 2;
|
||||
} else if(disc_state==BURN_DISC_FULL || disc_state==BURN_DISC_APPENDABLE) {
|
||||
;
|
||||
} else if(disc_state == BURN_DISC_EMPTY) {
|
||||
sprintf(xorriso->info_text,"No media detected in drive");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return 0;
|
||||
} else {
|
||||
sprintf(xorriso->info_text, "Unsuitable drive and media state");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return 0;
|
||||
}
|
||||
if(!isoburn_disc_erasable(drive)) {
|
||||
sprintf(xorriso->info_text, "Media is not of erasable type");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return 0;
|
||||
}
|
||||
sprintf(xorriso->info_text, "Beginning to %s-blank media.\n",
|
||||
((flag&1)?"fast":"full"));
|
||||
Xorriso_info(xorriso,0);
|
||||
isoburn_disc_erase(drive, (flag&1));
|
||||
usleep(1000000);
|
||||
while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) {
|
||||
if(p.sectors>0 && p.sector>=0) /* display 1 to 99 percent */
|
||||
percent = 1.0 + ((double) p.sector+1.0) / ((double) p.sectors) * 98.0;
|
||||
sprintf(xorriso->info_text, "Blanking ( %.1f%% done )", percent);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
|
||||
usleep(1000000);
|
||||
}
|
||||
sprintf(xorriso->info_text, "Blanking done\n");
|
||||
Xorriso_info(xorriso,0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_format_media(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
fprintf(stderr, ">>> XORRISO : -format not implemented yet\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user