Improved error messages if DVD-RW media can only be written with -close on

This commit is contained in:
2011-05-29 10:01:56 +00:00
parent eaf29d9d3f
commit b4306f2c9e
5 changed files with 119 additions and 49 deletions

View File

@ -58,6 +58,60 @@
#include "write_run.h"
/* @param flag bit0= talk of -as cdrecord -multi rather than of -close
*/
int Xorriso_check_multi(struct XorrisO *xorriso, struct burn_drive *drive,
int flag)
{
int profile_no= 0, ret;
struct burn_multi_caps *caps= NULL;
char profile_name[80];
if(!xorriso->do_close) {
burn_disc_get_profile(drive, &profile_no, profile_name);
if(profile_no == 0x14) { /* DVD-RW sequential */
ret= burn_disc_get_multi_caps(drive, BURN_WRITE_TAO, &caps, 0);
if(caps != NULL)
burn_disc_free_multi_caps(&caps);
if(ret == 0) {
if(flag & 1) {
sprintf(xorriso->info_text,
"This DVD-RW media can only be written without option -multi");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
sprintf(xorriso->info_text,
"Possibly it was blanked by blank=deformat_quickest");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
sprintf(xorriso->info_text,
"After writing a session without -multi, apply blank=all");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
} else {
sprintf(xorriso->info_text,
"This DVD-RW media can only be written with -close \"on\"");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
sprintf(xorriso->info_text,
"Possibly it was blanked by -blank \"deformat_quickest\"");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
sprintf(xorriso->info_text,
"After writing a session with -closed \"on\", apply -blank \"all\"");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
}
return(0);
}
} else if(profile_no == 0x15) { /* DVD-RW DL */
if(flag & 1)
sprintf(xorriso->info_text,
"DVD-R DL media can only be written without option -multi");
else
sprintf(xorriso->info_text,
"DVD-R DL media can only be written with -close \"on\"");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
}
return(1);
}
int Xorriso_make_write_options(
struct XorrisO *xorriso, struct burn_drive *drive,
struct burn_write_opts **burn_options, int flag)
@ -634,6 +688,10 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
else if(ret == 3)
pacifier_speed= 2;
ret= Xorriso_check_multi(xorriso, drive, 0);
if(ret<=0)
goto ex;
ret= isoburn_igopt_new(&sopts, 0);
if(ret<=0) {
Xorriso_process_msg_queues(xorriso, 0);
@ -1668,6 +1726,10 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
"on attempt to burn track", 2);
if(ret<=0)
{ret= 0; goto ex;}
ret= Xorriso_check_multi(xorriso, drive, 1);
if(ret<=0)
goto ex;
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
if(ret<=0)
goto ex;