Improved -as cdrecord

This commit is contained in:
Thomas Schmitt 2008-02-19 21:24:05 +00:00
parent 2d2e04bef4
commit 2c1f9280a0
5 changed files with 109 additions and 30 deletions

View File

@ -1260,24 +1260,27 @@ comparable actions in said programs.
\fB\-as\fR personality option [options] --
.br
Performs its variable length option list as sparse emulation of the program
depicted by personality.
depicted by the personality word.
.br
Personality "\fBcdrecord\fR" accepts the options listed with:
.br
-as cdrecord -help --
.br
Among them: dev=, speed=, blank=, fs=, -eject, -atip, padsize=,
one track source file path or "-" for standard input as track source.
Among them: -v, dev=, speed=, blank=, fs=, -eject, -atip, padsize=,
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 and on blank modes unknown to xorriso.
-audio, -scanbus, -multi, -msinfo, --grow_overwriteable_iso,
and on blanking modes unknown to xorriso.
.br
The scope is for now a single data track to be written to blank or
overwriteable media. If possible the media will get closed afterwards.
dev= must be given as xorriso device address. Adresses like 0,0,0 or ATA:1,1,0
are not supported.
.br
Personality "\fBcdrskin\fR" is an alias for "cdrecord".
A much more elaborate libburn based cdrecord emulator is the program cdrskin.
.br
Personality "\fBwodim\fR" is an alias for "cdrecord".
Personalites "\fBwodim\fR" and "\fBcdrskin\fR" are aliases for "cdrecord".
.TP
.B Scripting, dialog and program control features:
.TP

View File

@ -2746,6 +2746,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->pacifier_interval= 1.0;
m->pacifier_count= 0;
m->pacifier_total= 0;
m->pacifier_fifo= NULL;
m->start_time= 0.0;
m->last_update_time= 0.0;
m->result_line[0]= 0;
@ -6103,7 +6104,9 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
"drive_scsi_dev_family=", "fallback_program=", "modesty_on_drive=",
"tao_to_sao_tsize=",
"direct_write_amount=", "write_start_address=", "msifile=", "tsize=",
"direct_write_amount=", "write_start_address=", "msifile=",
"tsize=",
""
};
@ -6125,7 +6128,7 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
"--list_ignored_options", "--no_rc", "--no_convert_fs_adr",
"--prodvd_cli_compatible", "--single_track",
"--grow_overwriteable_iso", "--help", "--tell_media_space",
"--tell_media_space",
""
};
@ -6135,6 +6138,7 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
"Note: This is not cdrecord. See xorriso -help, xorriso -version, man xorriso",
"Options:",
"\t-version\tprint version information and exit emulation",
"\t--devices\tprint list of available MMC drives and exit emulation",
"\tdev=target\tpseudo-SCSI target to use as CD-Recorder",
"\t-v\t\tincrement verbose level by one",
"\t-checkdrive\tcheck if a driver for the drive is present",
@ -6149,7 +6153,8 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
"\t-data\t\tSubsequent tracks are CD-ROM data mode 1 (default)",
"\t-pad\t\tpadsize=30k",
"\t-nopad\t\tDo not pad",
"\t-help\t\tprint this text to stderr and exit",
"\t-help\t\tprint this text to stderr and exit emulation",
"\t--help\t\tprint xorriso help and exit emulation",
"Actually this is the integrated ISO RockRidge filesystem manipulator xorriso",
"lending its libburn capabilities to a very limited cdrecord emulation.",
"Only a single data track can be burnt to blank or overwriteable media which",
@ -6295,6 +6300,12 @@ no_volunteer:;
/* do_scanbus= 1; */
} else if(strcmp(argv[i], "-toc")==0) {
do_toc= 1;
} else if(strcmp(argv[i], "--grow_overwriteable_iso")==0) {
sprintf(xorriso->info_text,
"-as %s: Option --grow_overwriteable_iso not supported.",
whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
} else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i],"-verbose")==0) {
do_verbous++;
} else if(strcmp(argv[i], "-vv")==0) {
@ -6305,6 +6316,8 @@ no_volunteer:;
do_version= 1;
} else if(strcmp(argv[i], "-help")==0) {
do_help= 1;
} else if(strcmp(argv[i], "--help")==0) {
do_help= 2;
} 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));
@ -6334,10 +6347,14 @@ no_volunteer:;
ret= 1; goto ex;
}
if(do_help) {
if(do_help==2) {
Xorriso_option_help(xorriso, 0);
} else {
for(i= 0; strcmp(helptext[i], "@End_of_helptexT@")!=0; i++) {
sprintf(xorriso->info_text, "%s\n", helptext[i]);
Xorriso_info(xorriso,0);
}
}
ret= 1; goto ex;
}
if(do_scanbus) {
@ -7927,6 +7944,11 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -findx disk_path [-name pattern] like -find but in local filesystem.",
" Any -exec option is ignored. Action is always echo.",
"",
"Compatibility emulation (argument list may be ended by --):",
" -as cdrecord [-help|-v|dev=|speed=|blank=|fs=|-eject|-atip|padsize=|path|-]",
" Perform some cdrecord gestures, eventually write at most one",
" data track to blank or overwriteable media. See man cdrecord.",
"",
"General options:",
" -help Print this text",
" -abort_on severity Set the threshhold for events to abort the program.",

View File

@ -210,6 +210,8 @@ struct XorrisO { /* the global context of xorriso */
off_t pacifier_count;
off_t pacifier_total;
void *pacifier_fifo;
/* result (stdout, R: ) */
char result_line[5*SfileadrL];
int result_line_counter;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.02.19.184432"
#define Xorriso_timestamP "2008.02.19.212322"

View File

@ -1065,26 +1065,71 @@ int Xorriso_check_burn_abort(struct XorrisO *xorriso, int flag)
/* This loop watches burn runs until they end.
It issues pacifying update messages to the user.
@param flag bit0-3 = emulation mode
0= xorriso
1= cdrskin
bit4= report speed in CD units
*/
int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
int flag)
{
int ret, size, free_bytes, i, aborting= 0;
int ret, size, free_bytes, i, aborting= 0, emul, buffer_fill= 50, last_sector;
struct burn_progress progress;
char *status_text;
enum burn_drive_status drive_status;
double start_time, current_time;
double start_time, current_time, last_time;
double measured_speed, speed_factor= 1385000;
start_time= Sfile_microtime(0);
while(burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING)
usleep(100002);
emul= flag&15;
if(flag&16)
speed_factor= 150.0*1024;
progress.sector= 0;
current_time= Sfile_microtime(0);
while(1) {
last_time= current_time;
last_sector= progress.sector;
drive_status= burn_drive_get_status(drive, &progress);
if(drive_status == BURN_DRIVE_IDLE)
break;
current_time= Sfile_microtime(0);
if(drive_status == BURN_DRIVE_WRITING && progress.sectors > 0) {
if(emul==1) {
if(progress.sector<=progress.sectors)
sprintf(xorriso->info_text, "%4d of %4d MB written",
progress.sector / 512, progress.sectors / 512);
else
sprintf(xorriso->info_text, "%4d MB written",
progress.sector / 512);
if(xorriso->pacifier_fifo!=NULL) {
ret= burn_fifo_inquire_status(xorriso->pacifier_fifo,
&size, &free_bytes, &status_text);
if(ret>0 )
sprintf(xorriso->info_text+strlen(xorriso->info_text),
" (fifo %2d%%)",
(int) (100.0-100.0*((double) free_bytes)/(double) size));
}
buffer_fill= 50;
if(progress.buffer_capacity>0)
buffer_fill= (double) (progress.buffer_capacity
- progress.buffer_available) * 100.0
/ (double) progress.buffer_capacity;
sprintf(xorriso->info_text+strlen(xorriso->info_text), " [buf %3d%%]",
buffer_fill);
if(current_time-last_time>0.2) {
measured_speed= (progress.sector - last_sector) * 2048.0 /
(current_time - last_time);
sprintf(xorriso->info_text+strlen(xorriso->info_text), " %4.1fx.",
measured_speed/speed_factor);
}
} else {
if(progress.sector<=progress.sectors)
sprintf(xorriso->info_text, "Writing: sector %d of %d",
progress.sector, progress.sectors);
@ -1095,6 +1140,7 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
sprintf(xorriso->info_text+strlen(xorriso->info_text),
" [fifo %s, %2d%% fill]", status_text,
(int) (100.0-100.0*((double) free_bytes)/(double) size));
}
} else if(drive_status == BURN_DRIVE_CLOSING_SESSION ||
drive_status == BURN_DRIVE_CLOSING_TRACK)
sprintf(xorriso->info_text,
@ -3937,7 +3983,7 @@ int Xorriso_atip(struct XorrisO *xorriso, int flag)
int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
{
int ret, fd, unpredicted_size;
int ret, fd, unpredicted_size, profile_number, is_cd= 0;
struct burn_drive_info *dinfo;
struct burn_drive *drive;
struct burn_write_opts *burn_options;
@ -3948,7 +3994,7 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
off_t fixed_size= 0;
struct burn_source *data_src, *fifo_src;
enum burn_disc_status disc_state;
char reasons[BURN_REASONS_LEN], sfe[5*SfileadrL];
char reasons[BURN_REASONS_LEN], sfe[5*SfileadrL], profile_name[80];
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
@ -3994,6 +4040,7 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
ret= 0; goto ex;
}
xorriso->pacifier_fifo= fifo_src;
if(burn_track_set_source(track, fifo_src)!=BURN_SOURCE_OK) {
sprintf(xorriso->info_text,
"Cannot attach source object to track object");
@ -4042,6 +4089,8 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
ret= 0; goto ex;
}
ret= Xorriso_get_profile(xorriso, &profile_number, profile_name, 2);
is_cd= (ret==2);
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);
@ -4051,7 +4100,7 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag)
xorriso->run_state= 1; /* Indicate that burning has started */
burn_disc_write(burn_options, disc);
ret= Xorriso_pacifier_loop(xorriso, drive, 0);
ret= Xorriso_pacifier_loop(xorriso, drive, 1|(is_cd<<4));
if(ret<=0)
goto ex;
if(!burn_drive_wrote_well(drive)) {
@ -4069,6 +4118,9 @@ ex:;
Xorriso_process_msg_queues(xorriso,0);
if(disc!=NULL)
burn_disc_free(disc);
if(xorriso->pacifier_fifo!=NULL)
burn_source_free(xorriso->pacifier_fifo);
xorriso->pacifier_fifo= NULL;
xorriso->run_state= 0; /* Indicate that burning has ended */
return(ret);
}