From c2e3a36d516935c2710c64dfa240df481121e9ca Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 8 Jul 2012 20:06:34 +0000 Subject: [PATCH] Re-introduced capability of multi-session on overwritables. Spoiled by rev 4780. --- xorriso/write_run.c | 90 ++++++++++++++++++++++--------------- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 56 insertions(+), 36 deletions(-) diff --git a/xorriso/write_run.c b/xorriso/write_run.c index 41f9d9e2..a6e95e13 100644 --- a/xorriso/write_run.c +++ b/xorriso/write_run.c @@ -610,7 +610,7 @@ ex:; int Xorriso_write_session(struct XorrisO *xorriso, int flag) { int ret, relax= 0, i, pacifier_speed= 0, data_lba, ext, is_bootable= 0; - int freshly_bootable= 0, hide_attr, pad_by_libisofs= 0, signal_mode; + int freshly_bootable= 0, hide_attr, pad_by_libisofs= 0, signal_mode, role; char *xorriso_id= NULL, *img_id, *sfe= NULL, *out_cs, *part_image; struct isoburn_imgen_opts *sopts= NULL; struct burn_drive_info *dinfo, *source_dinfo; @@ -622,6 +622,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) struct burn_session **sessions; struct burn_track **tracks; enum burn_disc_status s; + struct burn_multi_caps *caps= NULL; IsoImage *image= NULL; IsoNode *root_node; int profile_number; @@ -1010,38 +1011,6 @@ fprintf(stderr, "XORRISO_DEBUG: isoburn_igopt_set_tail_blocks(%d)\n", burn_write_opts_set_stream_recording(burn_options, data_lba); } - if(xorriso->do_tao) { - if (xorriso->do_tao > 0) - burn_write_opts_set_write_type(burn_options, - BURN_WRITE_TAO, BURN_BLOCK_MODE1); - else - burn_write_opts_set_write_type(burn_options, - BURN_WRITE_SAO, BURN_BLOCK_SAO); - - ret = burn_precheck_write(burn_options, disc, reasons, 0); - if(ret<=0) { - Xorriso_process_msg_queues(xorriso,0); - sprintf(xorriso->info_text, - "Cannot set write type %s for this medium.\n", - xorriso->do_tao > 0 ? "TAO" : "SAO"); - sprintf(xorriso->info_text+strlen(xorriso->info_text), - "Reasons given:\n %s", reasons); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - ret= 0; goto cancel_iso; - } - } else { - if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) == - BURN_WRITE_NONE) { - Xorriso_process_msg_queues(xorriso,0); - sprintf(xorriso->info_text, - "Failed to find a suitable write mode with this media.\n"); - sprintf(xorriso->info_text+strlen(xorriso->info_text), - "Reasons given:\n %s", reasons); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - ret= 0; goto cancel_iso; - } - } - ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, flag&1); if(ret<=0 || (flag&1)) { Xorriso_process_msg_queues(xorriso,0); @@ -1056,11 +1025,57 @@ fprintf(stderr, "XORRISO_DEBUG: isoburn_igopt_set_tail_blocks(%d)\n", if(ret <= 0) goto cancel_iso; + role= burn_drive_get_drive_role(drive); + +/* # define Libisoburn_write_type_autO yes */ +#ifndef Libisoburn_write_type_autO + + ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0); + if(ret > 0) { + if(caps->start_adr || role == 4) /* Multi will be emulated */ + burn_write_opts_set_multi(burn_options, 0); + } + if(xorriso->do_tao) { + if (xorriso->do_tao > 0) + burn_write_opts_set_write_type(burn_options, + BURN_WRITE_TAO, BURN_BLOCK_MODE1); + else + burn_write_opts_set_write_type(burn_options, + BURN_WRITE_SAO, BURN_BLOCK_SAO); + + ret = burn_precheck_write(burn_options, disc, reasons, 0); + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Cannot set write type %s for this medium.", + xorriso->do_tao > 0 ? "TAO" : "SAO"); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + "Reasons given:\n %s", reasons); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto cancel_iso; + } + sprintf(xorriso->info_text, "Explicitly chosen write type: %s", + xorriso->do_tao > 0 ? "TAO" : "SAO"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } else { + if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) == + BURN_WRITE_NONE) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Failed to find a suitable write mode with this media.\n"); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + "Reasons given:\n %s", reasons); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto cancel_iso; + } + } + +#endif /* Libisoburn_write_type_autO */ + /* Important: do not return until burn_is_aborting() was checked */ signal_mode= 1; - ret= burn_drive_get_drive_role(drive); - if(ret == 1) + if(role == 1) signal_mode|= 2; Xorriso_set_signal_handling(xorriso, signal_mode); @@ -1139,6 +1154,8 @@ ex:; isoburn_igopt_destroy(&sopts, 0); if(burn_options != NULL) burn_write_opts_free(burn_options); + if(caps != NULL) + burn_disc_free_multi_caps(&caps); Xorriso_process_msg_queues(xorriso,0); Xorriso_append_scdbackup_record(xorriso, 0); Xorriso_free_meM(sfe); @@ -1975,6 +1992,9 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address, Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); ret= 0; goto ex; } + sprintf(xorriso->info_text, "Explicitly chosen write type: %s", + xorriso->do_tao > 0 ? "TAO" : "SAO"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); } else { if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) == BURN_WRITE_NONE) { diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 5648c197..b9ea9507 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2012.07.08.171526" +#define Xorriso_timestamP "2012.07.08.200735"