|
|
|
@ -96,6 +96,27 @@ int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* @param flag bit1= obtain outdrive, else indrive */
|
|
|
|
|
int Xorriso_get_drive_handles(struct XorrisO *xorriso,
|
|
|
|
|
struct burn_drive_info **dinfo,
|
|
|
|
|
struct burn_drive **drive,
|
|
|
|
|
char *attempt, int flag)
|
|
|
|
|
{
|
|
|
|
|
if(flag&2)
|
|
|
|
|
*dinfo= (struct burn_drive_info *) xorriso->out_drive_handle;
|
|
|
|
|
else
|
|
|
|
|
*dinfo= (struct burn_drive_info *) xorriso->in_drive_handle;
|
|
|
|
|
if(*dinfo==NULL) {
|
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
|
sprintf(xorriso->info_text, "No drive aquired %s", attempt);
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
*drive= (*dinfo)[0].drive;
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* @param flag bit0=aquire as isoburn input drive
|
|
|
|
|
bit1=aquire as libburn output drive (as isoburn drive if bit0)
|
|
|
|
|
*/
|
|
|
|
@ -185,8 +206,8 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
|
|
|
|
in_is_out_too= (xorriso->in_drive_handle == xorriso->out_drive_handle);
|
|
|
|
|
|
|
|
|
|
if((flag&1) && xorriso->in_drive_handle != NULL) {
|
|
|
|
|
dinfo= (struct burn_drive_info *) xorriso->in_drive_handle;
|
|
|
|
|
drive= dinfo[0].drive;
|
|
|
|
|
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
|
|
|
|
"on attempt to give drive up", 0);
|
|
|
|
|
isoburn_drive_release(drive,0);
|
|
|
|
|
|
|
|
|
|
iso_volset_free((struct iso_volset *) xorriso->in_volset_handle);
|
|
|
|
@ -202,18 +223,36 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if((flag&2) && xorriso->out_drive_handle!=NULL) {
|
|
|
|
|
dinfo= (struct burn_drive_info *) xorriso->out_drive_handle;
|
|
|
|
|
drive= dinfo[0].drive;
|
|
|
|
|
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
|
|
|
|
"on attempt to give drive up", 2);
|
|
|
|
|
isoburn_drive_release(drive,0);
|
|
|
|
|
burn_drive_info_free(dinfo);
|
|
|
|
|
xorriso->out_drive_handle= NULL;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_make_write_options(
|
|
|
|
|
struct XorrisO *xorriso, struct burn_drive *drive,
|
|
|
|
|
struct burn_write_opts **burn_options, int flag)
|
|
|
|
|
{
|
|
|
|
|
*burn_options= burn_write_opts_new(drive);
|
|
|
|
|
if(*burn_options==NULL) {
|
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
|
sprintf(xorriso->info_text,"Cannot allocate option set");
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
burn_write_opts_set_simulate(*burn_options, !!xorriso->do_dummy);
|
|
|
|
|
burn_write_opts_set_multi(*burn_options, !xorriso->do_close);
|
|
|
|
|
burn_drive_set_speed(drive, xorriso->speed, xorriso->speed);
|
|
|
|
|
burn_write_opts_set_underrun_proof(*burn_options, 1);
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
@ -223,13 +262,10 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
|
|
|
|
|
struct burn_disc *disc;
|
|
|
|
|
struct burn_write_opts *burn_options;
|
|
|
|
|
|
|
|
|
|
dinfo= (struct burn_drive_info *) xorriso->in_drive_handle;
|
|
|
|
|
if(dinfo==NULL) {
|
|
|
|
|
sprintf(xorriso->info_text,"No drive aquired on attempt to write");
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
|
|
|
|
"on attempt to write", 2);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
drive= dinfo[0].drive;
|
|
|
|
|
|
|
|
|
|
sopts.level= 2;
|
|
|
|
|
sopts.flags= ECMA119_ROCKRIDGE;
|
|
|
|
@ -260,17 +296,9 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
burn_options= burn_write_opts_new(drive);
|
|
|
|
|
if(burn_options==NULL) {
|
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
|
sprintf(xorriso->info_text,"Cannot allocate option set");
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
burn_write_opts_set_simulate(burn_options, !!xorriso->do_dummy);
|
|
|
|
|
burn_write_opts_set_multi(burn_options, !xorriso->do_close);
|
|
|
|
|
burn_drive_set_speed(drive, xorriso->speed, xorriso->speed);
|
|
|
|
|
burn_write_opts_set_underrun_proof(burn_options, 1);
|
|
|
|
|
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
return(ret);
|
|
|
|
|
|
|
|
|
|
isoburn_disc_write(burn_options, disc);
|
|
|
|
|
burn_write_opts_free(burn_options);
|
|
|
|
@ -339,10 +367,11 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
|
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
|
sprintf(xorriso->info_text,"No volset is loaded.");
|
|
|
|
|
if(xorriso->indev[0]==0)
|
|
|
|
|
sprintf(xorriso->info_text," No -dev or -indev is selected.");
|
|
|
|
|
sprintf(xorriso->info_text+strlen(xorriso->info_text),
|
|
|
|
|
" No -dev or -indev is selected.");
|
|
|
|
|
else
|
|
|
|
|
sprintf(xorriso->info_text," Possible program error with drive '%s'.",
|
|
|
|
|
xorriso->indev);
|
|
|
|
|
sprintf(xorriso->info_text+strlen(xorriso->info_text),
|
|
|
|
|
" Possible program error with drive '%s'.", xorriso->indev);
|
|
|
|
|
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
@ -514,15 +543,10 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|
|
|
|
struct burn_drive *drive;
|
|
|
|
|
enum burn_disc_status s;
|
|
|
|
|
|
|
|
|
|
dinfo= (struct burn_drive_info *) xorriso->in_drive_handle;
|
|
|
|
|
if(dinfo==NULL) {
|
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
|
"No drive aquired on attempt to print Table Of Content");
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
|
|
|
|
"on attempt to print Table Of Content", 2);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
drive= dinfo[0].drive;
|
|
|
|
|
|
|
|
|
|
respt= xorriso->result_line;
|
|
|
|
|
|
|
|
|
@ -695,3 +719,29 @@ int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_tell_media_space(struct XorrisO *xorriso, int flag)
|
|
|
|
|
{
|
|
|
|
|
int ret, free_space;
|
|
|
|
|
struct burn_drive_info *dinfo;
|
|
|
|
|
struct burn_drive *drive;
|
|
|
|
|
struct burn_write_opts *burn_options;
|
|
|
|
|
|
|
|
|
|
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
|
|
|
|
"on attempt to -tell_media_space", 2);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
return(0);
|
|
|
|
|
|
|
|
|
|
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
return(-1);
|
|
|
|
|
free_space= burn_disc_available_space(drive, burn_options) / (off_t) 2048;
|
|
|
|
|
burn_write_opts_free(burn_options);
|
|
|
|
|
|
|
|
|
|
/* >>> subtract space needed for pending session image */
|
|
|
|
|
|
|
|
|
|
if(free_space<=0)
|
|
|
|
|
free_space= 0;
|
|
|
|
|
return(free_space);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|