Automatic re-try with -close "as_needed" and unannounced fast-blanked DVD-RW
This commit is contained in:
@ -132,8 +132,10 @@ int Xorriso_make_write_options(
|
||||
struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
struct burn_write_opts **burn_options, int flag)
|
||||
{
|
||||
int drive_role, stream_mode= 0;
|
||||
|
||||
int drive_role, stream_mode= 0, ret, profile;
|
||||
char profile_name[80];
|
||||
enum burn_disc_status s;
|
||||
|
||||
*burn_options= burn_write_opts_new(drive);
|
||||
if(*burn_options==NULL) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
@ -145,6 +147,16 @@ int Xorriso_make_write_options(
|
||||
drive_role= burn_drive_get_drive_role(drive);
|
||||
burn_write_opts_set_multi(*burn_options,
|
||||
!(xorriso->do_close || drive_role==0 || drive_role==3));
|
||||
|
||||
ret= burn_disc_get_profile(drive, &profile, profile_name);
|
||||
if(ret > 0) {
|
||||
s= isoburn_disc_get_status(drive);
|
||||
if(xorriso->auto_close && xorriso->do_close == 0 &&
|
||||
profile == 0x14 && s == BURN_DISC_BLANK)
|
||||
/* Prepare for missing feature 21h despite drive's announcement */
|
||||
burn_write_opts_set_fail21h_sev(*burn_options, "NOTE");
|
||||
}
|
||||
|
||||
if(xorriso->write_speed != -2)
|
||||
burn_drive_set_speed(drive, 0, xorriso->write_speed);
|
||||
if(xorriso->do_stream_recording == 1)
|
||||
@ -707,7 +719,31 @@ ex:
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_retry_write_session(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret, auto_close_mem, do_close_mem;
|
||||
|
||||
if(xorriso->do_tao == 1) {
|
||||
Xorriso_msgs_submit(xorriso, 0,
|
||||
"There is no hope for a re-try with -close \"on\" as long as -write_type is \"tao\"",
|
||||
0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
Xorriso_msgs_submit(xorriso, 0, "Re-trying with -close \"on\"", 0, "NOTE", 0);
|
||||
do_close_mem= xorriso->do_close;
|
||||
auto_close_mem= xorriso->auto_close;
|
||||
xorriso->do_close= 1;
|
||||
xorriso->auto_close= 0;
|
||||
ret= Xorriso_write_session(xorriso, 0);
|
||||
xorriso->do_close= do_close_mem;
|
||||
xorriso->auto_close= auto_close_mem;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= do not write but only prepare and return size in sectors
|
||||
@return <=0 error , 1= success
|
||||
2= failure with DVD-RW, please call Xorriso_retry_write_session()
|
||||
*/
|
||||
int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
@ -1163,6 +1199,15 @@ fprintf(stderr, "XORRISO_DEBUG: isoburn_igopt_set_tail_blocks(%d)\n",
|
||||
if(!isoburn_drive_wrote_well(drive)) {
|
||||
isoburn_cancel_prepared_write(source_drive, drive, 0);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(xorriso->auto_close && xorriso->do_close == 0) {
|
||||
if(burn_drive_was_feat21_failure(drive)) {
|
||||
sprintf(xorriso->info_text,
|
||||
"libburn indicates failure with writing DVD-RW to appendable state.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
/* Urge caller to call Xorriso_retry_write_session() */
|
||||
ret= 2; goto ex;
|
||||
}
|
||||
}
|
||||
sprintf(xorriso->info_text,
|
||||
"libburn indicates failure with writing.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
@ -1855,11 +1900,38 @@ int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag)
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_retry_burn_track(struct XorrisO *xorriso,
|
||||
off_t write_start_address,
|
||||
char *track_source, off_t tsize, int flag)
|
||||
{
|
||||
int ret, auto_close_mem, do_close_mem;
|
||||
|
||||
if(xorriso->do_tao == 1) {
|
||||
Xorriso_msgs_submit(xorriso, 0,
|
||||
"There is no hope for a re-try with -close \"on\" as long as -write_type is \"tao\"",
|
||||
0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
Xorriso_msgs_submit(xorriso, 0, "Re-trying with -close \"on\"", 0, "NOTE", 0);
|
||||
do_close_mem= xorriso->do_close;
|
||||
auto_close_mem= xorriso->auto_close;
|
||||
xorriso->do_close= 1;
|
||||
xorriso->auto_close= 0;
|
||||
ret= Xorriso_burn_track(xorriso, write_start_address, track_source, tsize,
|
||||
flag);
|
||||
xorriso->do_close= do_close_mem;
|
||||
xorriso->auto_close= auto_close_mem;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* @param write_start_address is valid if >=0
|
||||
@param tsize is valid if >0
|
||||
@param flag bit0= grow_overwriteable_iso
|
||||
bit1= do_isosize
|
||||
bit2= do_xa1 conversion
|
||||
@return <=0 error , 1= success
|
||||
2= failure with DVD-RW, please call Xorriso_retry_burn_track()
|
||||
*/
|
||||
int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
char *track_source, off_t tsize, int flag)
|
||||
@ -2113,6 +2185,15 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
goto ex;
|
||||
if(!burn_drive_wrote_well(drive)) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(xorriso->auto_close && xorriso->do_close == 0) {
|
||||
if(burn_drive_was_feat21_failure(drive)) {
|
||||
sprintf(xorriso->info_text,
|
||||
"libburn indicates failure with writing DVD-RW to appendable state.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
/* Urge caller to call Xorriso_retry_burn_rack() */
|
||||
ret= 2; goto ex;
|
||||
}
|
||||
}
|
||||
sprintf(xorriso->info_text,
|
||||
"libburn indicates failure with writing.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
|
Reference in New Issue
Block a user