New options --grow_overwriteable_iso and write_start_address= with -as cdrecord
This commit is contained in:
@ -956,10 +956,8 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
if(ret<0)
|
||||
{ret= 0; goto ex;}
|
||||
Xorriso_set_abort_severity(xorriso, 1);
|
||||
if(xorriso->out_drive_handle == xorriso->in_drive_handle ||
|
||||
xorriso->in_drive_handle == NULL) {
|
||||
ret= isoburn_prepare_disc(source_drive, &disc, sopts);
|
||||
} else if (xorriso->grow_blindly_msc2 >= 0) {
|
||||
if (xorriso->grow_blindly_msc2 >= 0 &&
|
||||
xorriso->out_drive_handle != xorriso->in_drive_handle) {
|
||||
ret= isoburn_prepare_blind_grow(source_drive, &disc, sopts, drive,
|
||||
xorriso->grow_blindly_msc2);
|
||||
if(ret>0) {
|
||||
@ -969,6 +967,9 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
}
|
||||
} else if(xorriso->out_drive_handle == xorriso->in_drive_handle ||
|
||||
xorriso->in_drive_handle == NULL) {
|
||||
ret= isoburn_prepare_disc(source_drive, &disc, sopts);
|
||||
} else {
|
||||
ret= isoburn_prepare_new_image(source_drive, &disc, sopts, drive);
|
||||
}
|
||||
@ -5935,9 +5936,14 @@ int Xorriso_atip(struct XorrisO *xorriso, int flag)
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
|
||||
/* @param write_start_address is valid if >=0
|
||||
@param flag bit0= grow_overwriteable_iso
|
||||
*/
|
||||
int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
char *track_source, int flag)
|
||||
{
|
||||
int ret, fd, unpredicted_size, profile_number, is_cd= 0;
|
||||
int ret, fd, unpredicted_size, profile_number, is_cd= 0, dummy, nwa= -1;
|
||||
int isosize= -1, i, full_size;
|
||||
struct burn_drive_info *dinfo;
|
||||
struct burn_drive *drive;
|
||||
struct burn_write_opts *burn_options;
|
||||
@ -5949,6 +5955,7 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
|
||||
struct burn_source *data_src, *fifo_src;
|
||||
enum burn_disc_status disc_state;
|
||||
char reasons[BURN_REASONS_LEN], sfe[5*SfileadrL], profile_name[80];
|
||||
char buffer[64*1024], *headpt;
|
||||
|
||||
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
@ -6006,12 +6013,14 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
|
||||
burn_session_add_track(session, track, BURN_POS_END);
|
||||
burn_source_free(data_src);
|
||||
|
||||
/* >>> MULTI :
|
||||
/* MULTI :
|
||||
if grow_overwriteable_iso:
|
||||
consider overwriteables with ISO as appendable
|
||||
*/
|
||||
|
||||
disc_state = burn_disc_get_status(drive);
|
||||
if(flag&1)
|
||||
disc_state = isoburn_disc_get_status(drive);
|
||||
else
|
||||
disc_state = burn_disc_get_status(drive);
|
||||
if(disc_state == BURN_DISC_BLANK) {
|
||||
/* ok */;
|
||||
} else if(disc_state == BURN_DISC_APPENDABLE) {
|
||||
@ -6049,6 +6058,8 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
|
||||
}
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
if(isoburn_needs_emulation(drive))
|
||||
burn_write_opts_set_multi(burn_options, 0);
|
||||
if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) ==
|
||||
BURN_WRITE_NONE) {
|
||||
sprintf(xorriso->info_text,
|
||||
@ -6062,11 +6073,36 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
|
||||
ret= Xorriso_get_profile(xorriso, &profile_number, profile_name, 2);
|
||||
is_cd= (ret==2);
|
||||
|
||||
/* >>> MULTI :
|
||||
consider overwriteables as blank if not grow_overwriteable_iso*/
|
||||
/* MULTI :
|
||||
consider overwriteables as blank if not grow_overwriteable_iso */
|
||||
|
||||
if(isoburn_needs_emulation(drive)) {
|
||||
if(flag&1) {
|
||||
ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &dummy, &nwa);
|
||||
if(ret<=0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot obtain next writeable address of emulated multi-session media\n");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
if(nwa==32)
|
||||
nwa= 0; /* No automatic toc emulation. Formatter might not be aware. */
|
||||
burn_write_opts_set_start_byte(burn_options,((off_t) nwa) * (off_t) 2048);
|
||||
} else {
|
||||
nwa= 0;
|
||||
burn_write_opts_set_start_byte(burn_options, (off_t) 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* MULTI : */
|
||||
if(write_start_address>=0) {
|
||||
nwa= write_start_address / (off_t) 2048;
|
||||
if(((off_t) nwa) * (off_t) 2048 < write_start_address )
|
||||
nwa++;
|
||||
burn_write_opts_set_start_byte(burn_options, ((off_t) nwa) * (off_t) 2048);
|
||||
}
|
||||
|
||||
if(isoburn_needs_emulation(drive))
|
||||
burn_write_opts_set_start_byte(burn_options, (off_t) 0);
|
||||
ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, 2);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
@ -6085,6 +6121,39 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
|
||||
/* MULTI : */
|
||||
/* update ISO header at lba 0 */
|
||||
if((flag&1) && nwa >= 32) {
|
||||
if(isosize>0) {
|
||||
|
||||
/* >>> MULTI : copy memorized stream header from -isosize into buffer */;
|
||||
|
||||
} else {
|
||||
ret= isoburn_read_iso_head(drive, nwa, &isosize, buffer, 2);
|
||||
if(ret<=0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot read freshly written ISO image head");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
}
|
||||
/* patch ISO header */
|
||||
full_size= nwa + isosize;
|
||||
headpt= buffer + 32*1024;
|
||||
for(i=0;i<4;i++)
|
||||
headpt[87-i]= headpt[80+i]= (full_size >> (8*i)) & 0xff;
|
||||
ret= burn_random_access_write(drive, (off_t) 0, buffer,
|
||||
(off_t) (64*1024), 1);
|
||||
if(ret<=0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot write new ISO image head to LBA 0");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(xorriso->info_text, "Writing to %s completed sucessfully.\n\n",
|
||||
Text_shellsafe(xorriso->outdev,sfe,0));
|
||||
Xorriso_info(xorriso, 0);
|
||||
@ -6397,7 +6466,8 @@ int Xorriso_libburn_adr(struct XorrisO *xorriso, char *path, char adr[],
|
||||
|
||||
|
||||
/* MULTI : */
|
||||
/* @param flag bit1= obtain info from outdev
|
||||
/* @param flag bit0= grow_overwriteable_iso
|
||||
bit1= obtain info from outdev
|
||||
*/
|
||||
int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag)
|
||||
{
|
||||
@ -6410,10 +6480,14 @@ int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag)
|
||||
"on attempt to obtain msinfo", flag&2);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
/* >>> if grow_overwriteable_iso :
|
||||
/* MULTI:
|
||||
if grow_overwriteable_iso :
|
||||
inquire by isoburn_disc_get_status()
|
||||
*/;
|
||||
disc_state = burn_disc_get_status(drive);
|
||||
if(flag&1)
|
||||
disc_state= isoburn_disc_get_status(drive);
|
||||
else
|
||||
disc_state= burn_disc_get_status(drive);
|
||||
if(disc_state != BURN_DISC_APPENDABLE) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,
|
||||
|
Reference in New Issue
Block a user