New option -isosize with -as cdrecord

This commit is contained in:
Thomas Schmitt 2008-07-14 12:50:53 +00:00
parent 6b9794c77b
commit 5a7b45e7c5
4 changed files with 124 additions and 83 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Jul, 12, 2008"
.TH XORRISO 1 "Jul, 14, 2008"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -1802,12 +1802,11 @@ Personality "\fBcdrecord\fR" accepts the options listed with:
-as cdrecord -help --
.br
Among them: -v, dev=, speed=, blank=, fs=, -eject, -atip, padsize=,
-multi, -msinfo,
-isosize, -multi, -msinfo, --grow_overwriteable_iso, write_start_address=,
track source file path or "-" for standard input as track source.
.br
It ignores most other options of cdrecord and cdrskin but refuses on
-audio, -scanbus, -multi, -msinfo, --grow_overwriteable_iso,
and on blanking modes unknown to xorriso.
-audio, -scanbus, and on blanking modes unknown to xorriso.
.br
The scope is only a single data track per session to be written
to blank, overwriteable, or appendable media. The media gets closed if
@ -1822,6 +1821,11 @@ are not supported.
If a track source is given, then an automatic -commit happens at the end of
the "cdrecord" option list.
.br
--grow_overwriteable_iso enables emulation of multi-session on overwriteable
media. To enable emulation of a TOC, the first session needs -C 0,32 with
-as mkisofs (but no -M) and --grow_overwriteable_iso write_start_address=32s
with -as cdrecord.
.br
A much more elaborate libburn based cdrecord emulator is the program cdrskin.
.br
Personalites "\fBxorrecord\fR", "\fBwodim\fR", and "\fBcdrskin\fR" are aliases
@ -1971,10 +1975,12 @@ Manipulating an existing ISO image on the same media
.br
Copy modified ISO image from one media to another
.br
Write a ISO image into a pipe (single-session only)
Write a ISO image into a pipe
.br
Perform multi-session runs as of cdrtools traditions
.br
Let xorriso work underneath growisofs
.br
Adjust thresholds for verbosity, exit value and program abort
.br
Examples of input timestrings

View File

@ -7072,7 +7072,7 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
int ret, i, k, mem_do_close, aq_ret, eject_ret, msc1, msc2, hflag;
int do_atip= 0, do_checkdrive= 0, do_eject= 0, do_scanbus= 0;
int do_toc= 0, do_verbous= 0, do_version= 0, do_help= 0, do_waiti= 0;
int do_multi= 0, do_msinfo= 0, do_grow= 0;
int do_multi= 0, do_msinfo= 0, do_grow= 0, do_isosize= 0;
double write_start_address= -1.0;
char track_source[SfileadrL], sfe[5*SfileadrL], dev_adr[SfileadrL], *cpt;
char mem_report_about_text[80], *report_about= "SORRY", blank_mode[80];
@ -7104,7 +7104,7 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
"-cdi", "-preemp", "-nopreemp", "-copy", "-nocopy",
"-scms", "-shorttrack", "-noshorttrack", "-packet", "-noclose",
"-media-info", "-minfo",
"-isosize", "-load", "-lock", "-raw96r", "-sao", "-dao", "-swab",
"-load", "-lock", "-raw96r", "-sao", "-dao", "-swab",
"-tao", "-force", "-format",
"--adjust_speed_to_drive", "--allow_emulated_drives", "--allow_setuid",
@ -7245,6 +7245,8 @@ no_volunteer:;
strncmp(argv[i], "dev=", 4)==0) {
cpt= strchr(argv[i], '=')+1;
strcpy(dev_adr, cpt);
} else if(strcmp(argv[i], "--devices")==0) {
do_scanbus= 2;
} else if(strncmp(argv[i],"driveropts=", 11)==0 ||
strncmp(argv[i],"-driveropts=", 12)==0) {
if(strcmp(argv[i]+11, "help")==0) {
@ -7261,53 +7263,6 @@ no_volunteer:;
ret= Xorriso_option_fs(xorriso, cpt, 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "-inq")==0) {
do_checkdrive= 2;
} else if(strcmp(argv[i], "-nopad")==0) {
xorriso->padding= 0;
} else if(strcmp(argv[i], "-pad")==0) {
xorriso->padding= 15*2048;
} else if(strncmp(argv[i], "-padsize=", 9)==0 ||
strncmp(argv[i], "padsize=", 8)==0) {
cpt= strchr(argv[i], '=')+1;
ret= Xorriso_option_padding(xorriso, cpt, 0);
if(ret<=0)
goto ex;
} else if(strncmp(argv[i], "-speed=", 7)==0 ||
strncmp(argv[i], "speed=", 6)==0) {
cpt= strchr(argv[i], '=')+1;
strncpy(speed, cpt, 79);
speed[79]= 0;
} else if(strcmp(argv[i], "-multi")==0) {
/* MULTI : allow -multi */
/*
sprintf(xorriso->info_text, "-as %s: Option -multi not supported.", whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
*/
do_multi= 1;
} else if(strcmp(argv[i], "-msinfo")==0) {
/* MULTI : allow -msinfo */
/*
sprintf(xorriso->info_text, "-as %s: Option -msinfo not supported.",whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
*/
do_msinfo= 1;
} else if(strcmp(argv[i], "--devices")==0) {
do_scanbus= 2;
} else if(strcmp(argv[i], "-scanbus")==0) {
sprintf(xorriso->info_text, "-as %s: Option -scanbus not supported.",
whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
/* do_scanbus= 1; */
} else if(strcmp(argv[i], "-toc")==0) {
do_toc= 1;
} else if(strcmp(argv[i], "--grow_overwriteable_iso")==0) {
/* MULTI : allow --grow_overwriteable_iso */
@ -7320,14 +7275,55 @@ no_volunteer:;
*/
do_grow= 1;
} else if(strncmp(argv[i], "write_start_address=", 20)==0) {
} else if(strcmp(argv[i], "-help")==0) {
do_help= 1;
} else if(strcmp(argv[i], "-isosize")==0) {
do_isosize= 1;
} else if(strcmp(argv[i], "-inq")==0) {
do_checkdrive= 2;
} else if(strcmp(argv[i], "-msinfo")==0) {
/* MULTI : allow write_start_address= */
write_start_address= Scanf_io_size(argv[i]+20,0);
/* MULTI : allow -msinfo */
/*
sprintf(xorriso->info_text, "-as %s: Option -msinfo not supported.",whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
*/
do_msinfo= 1;
} else if(strcmp(argv[i], "-multi")==0) {
/* ??? >>> MULTI : combine write_start_address=32 with --grow_overwriteable_iso */
/* ??? >>> MULTI : ??? how about cdrskin. shouldn't it combine too ? */
/* MULTI : allow -multi */
/*
sprintf(xorriso->info_text, "-as %s: Option -multi not supported.", whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
*/
do_multi= 1;
} else if(strcmp(argv[i], "-nopad")==0) {
xorriso->padding= 0;
} else if(strcmp(argv[i], "-pad")==0) {
xorriso->padding= 15*2048;
} else if(strncmp(argv[i], "-padsize=", 9)==0 ||
strncmp(argv[i], "padsize=", 8)==0) {
cpt= strchr(argv[i], '=')+1;
ret= Xorriso_option_padding(xorriso, cpt, 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "-scanbus")==0) {
sprintf(xorriso->info_text, "-as %s: Option -scanbus not supported.",
whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
/* do_scanbus= 1; */
} else if(strncmp(argv[i], "-speed=", 7)==0 ||
strncmp(argv[i], "speed=", 6)==0) {
cpt= strchr(argv[i], '=')+1;
strncpy(speed, cpt, 79);
speed[79]= 0;
} else if(strcmp(argv[i], "-toc")==0) {
do_toc= 1;
} else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i],"-verbose")==0) {
do_verbous++;
} else if(strcmp(argv[i], "-vv")==0) {
@ -7338,8 +7334,14 @@ no_volunteer:;
do_version= 1;
} else if(strcmp(argv[i], "-waiti")==0) {
do_waiti= 1;
} else if(strcmp(argv[i], "-help")==0) {
do_help= 1;
} else if(strncmp(argv[i], "write_start_address=", 20)==0) {
/* MULTI : allow write_start_address= */
write_start_address= Scanf_io_size(argv[i]+20,0);
/* ??? >>> MULTI : combine write_start_address=32 with --grow_overwriteable_iso */
/* ??? >>> MULTI : ??? how about cdrskin. shouldn't it combine too ? */
} else if(argv[i][0]=='-' && argv[i][1]!=0) {
sprintf(xorriso->info_text, "-as %s: Unknown option %s",
whom, Text_shellsafe(argv[i], sfe, 0));
@ -7483,7 +7485,7 @@ no_volunteer:;
xorriso->do_close= !do_multi;
ret= Xorriso_burn_track(xorriso, (off_t) write_start_address,
track_source, !!do_grow);
track_source, (!!do_grow)|((!!do_isosize)<<1));
aq_ret= Xorriso_reaquire_outdev(xorriso, 2*(ret>0));
if(ret<=0 && ret<aq_ret)
goto ex;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.07.14.120527"
#define Xorriso_timestamP "2008.07.14.125133"

View File

@ -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);