New option -isosize with -as cdrecord
This commit is contained in:
@ -3649,6 +3649,8 @@ int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
|
||||
sprintf(xorriso->info_text, "Full drive scan done\n");
|
||||
Xorriso_info(xorriso,0);
|
||||
|
||||
sprintf(xorriso->info_text, "-----------------------------------------------------------------------------\n");
|
||||
Xorriso_info(xorriso,0);
|
||||
respt= xorriso->result_line;
|
||||
for(i= 0; i < drive_count && !(xorriso->request_to_abort); i++) {
|
||||
if(burn_drive_get_adr(&(drive_list[i]), adr)<=0)
|
||||
@ -3681,6 +3683,9 @@ int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
|
||||
perms, drive_list[i].vendor, drive_list[i].product);
|
||||
Xorriso_result(xorriso,0);
|
||||
}
|
||||
sprintf(xorriso->info_text, "-----------------------------------------------------------------------------\n");
|
||||
Xorriso_info(xorriso,0);
|
||||
|
||||
burn_drive_info_free(drive_list);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
return(1);
|
||||
@ -5938,12 +5943,13 @@ int Xorriso_atip(struct XorrisO *xorriso, int flag)
|
||||
|
||||
/* @param write_start_address is valid if >=0
|
||||
@param flag bit0= grow_overwriteable_iso
|
||||
bit1= do_isosize
|
||||
*/
|
||||
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, dummy, nwa= -1;
|
||||
int isosize= -1, i, full_size;
|
||||
int isosize= -1, i, full_size, do_isosize;
|
||||
struct burn_drive_info *dinfo;
|
||||
struct burn_drive *drive;
|
||||
struct burn_write_opts *burn_options;
|
||||
@ -5955,9 +5961,9 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
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;
|
||||
|
||||
char head_buffer[64*1024], *headpt;
|
||||
|
||||
do_isosize= !!(flag&2);
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to burn track", 2);
|
||||
if(ret<=0)
|
||||
@ -5997,6 +6003,8 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
if(do_isosize && xorriso->fs < 64)
|
||||
xorriso->fs= 64;
|
||||
fifo_src= burn_fifo_source_new(data_src, 2048, xorriso->fs, 0);
|
||||
if(fifo_src == NULL) {
|
||||
sprintf(xorriso->info_text, "Could not create fifo object of 4 MB");
|
||||
@ -6060,21 +6068,39 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
}
|
||||
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,
|
||||
"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 ex;
|
||||
|
||||
/* >>> MULTI : if -isosize :
|
||||
*/
|
||||
if(do_isosize) {
|
||||
ret= burn_fifo_peek_data(xorriso->pacifier_fifo, head_buffer, 64*1024, 0);
|
||||
if(ret<=0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot obtain first 64 kB from input stream.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
|
||||
/* read isosize from head_buffer, not from media*/
|
||||
ret= isoburn_read_iso_head(drive, 0, &isosize, head_buffer, (1<<13));
|
||||
if(ret<=0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,
|
||||
"Option -isosize given but data stream seems not to be ISO 9660");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
sprintf(xorriso->info_text, "Size of ISO 9660 image: %ds", isosize);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
fixed_size= ((off_t) (isosize)) * (off_t) 2048;
|
||||
burn_track_set_size(track, fixed_size);
|
||||
}
|
||||
|
||||
ret= Xorriso_get_profile(xorriso, &profile_number, profile_name, 2);
|
||||
is_cd= (ret==2);
|
||||
|
||||
/* MULTI :
|
||||
consider overwriteables as blank if not grow_overwriteable_iso */
|
||||
consider overwriteables as blank if not grow_overwriteable_iso */
|
||||
|
||||
if(isoburn_needs_emulation(drive)) {
|
||||
if(flag&1) {
|
||||
@ -6103,6 +6129,16 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
burn_write_opts_set_start_byte(burn_options, ((off_t) nwa) * (off_t) 2048);
|
||||
}
|
||||
|
||||
if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) ==
|
||||
BURN_WRITE_NONE) {
|
||||
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 ex;
|
||||
}
|
||||
|
||||
ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, 2);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
@ -6124,12 +6160,9 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
/* 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(!do_isosize) {
|
||||
/* head_buffer was not filled yet. Read it from output media. */
|
||||
ret= isoburn_read_iso_head(drive, nwa, &isosize, head_buffer, 2);
|
||||
if(ret<=0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,
|
||||
@ -6140,10 +6173,10 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
}
|
||||
/* patch ISO header */
|
||||
full_size= nwa + isosize;
|
||||
headpt= buffer + 32*1024;
|
||||
headpt= head_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,
|
||||
ret= burn_random_access_write(drive, (off_t) 0, head_buffer,
|
||||
(off_t) (64*1024), 1);
|
||||
if(ret<=0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
|
Reference in New Issue
Block a user