New option -list_formats

This commit is contained in:
Thomas Schmitt 2008-05-13 11:58:43 +00:00
parent 8cecbb1699
commit ab7591f04b
7 changed files with 117 additions and 20 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 "May, 12, 2008"
.TH XORRISO 1 "May, 13, 2008"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -974,6 +974,12 @@ quite unrealistic. Do not conclude success or failure from the
reported percentages. Formatting was successful if no SORRY event
or worse occured.
.TP
\fB\-list_formats\fR
Put out a list of format descriptors as reported by the output drive for
the current media. The list gives a "Format idx" number, a MMC profile
code (like "00h" or "26h"), the announced size in blocks (like "2236704s")
and the same size in MiB.
.TP
.B Settings for data insertion:
.TP
\fB\-not_mgt\fR code[:code[...]]

View File

@ -9036,7 +9036,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
"",
" -devices Show list of available optical drives and their addresses.",
"",
" -toc Show media specific table of content. (MMC, not ISO 9660)",
" -toc Show media specific table of content (sessions).",
"",
" -list_formats Show media specific list of format descriptors.",
"",
" -print-size Print the foreseeable consumption by next -commit.",
"",
@ -9381,6 +9383,16 @@ int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag)
}
/* Option -list_formats */
int Xorriso_option_list_formats(struct XorrisO *xorriso, int flag)
{
int ret;
ret= Xorriso_list_formats(xorriso, 0);
return(ret);
}
/* Option -load session|track|sbsector value */
/* @return <=0 error , 1 success, 2 revoked by -reassure
*/
@ -11122,6 +11134,9 @@ next_command:;
(*idx)++;
ret= Xorriso_option_joliet(xorriso, arg1, 0);
} else if(strcmp(cmd,"list_formats")==0) {
ret= Xorriso_option_list_formats(xorriso, 0);
} else if(strcmp(cmd,"load")==0) {
(*idx)+= 2;
ret= Xorriso_option_load(xorriso, arg1, arg2, 0);

View File

@ -306,6 +306,15 @@ int Xorriso_option_history(struct XorrisO *xorriso, char *line, int flag);
/* Option -joliet "on"|"off" */
int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag);
/* Option -list_formats */
int Xorriso_option_list_formats(struct XorrisO *xorriso, int flag);
/* Option -load session|track|sbsector value */
/* @return <=0 error , 1 success, 2 revoked by -reassure
*/
int Xorriso_option_load(struct XorrisO *xorriso, char *adr_mode,
char *adr_value, int flag);
/* Option -logfile */
int Xorriso_option_logfile(struct XorrisO *xorriso, char *channel,
char *fileadr, int flag);
@ -417,7 +426,8 @@ int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag);
/* Option -rollback */
/* @return <=0 error , 1 success, 2 revoked by -reassure
/* @param flag bit0= do not -reassure
@return <=0 error , 1 success, 2 revoked by -reassure
*/
int Xorriso_option_rollback(struct XorrisO *xorriso, int flag);

View File

@ -355,12 +355,14 @@ Bug fixes towards xorriso-0.1.2.pl00:
</DD>
<DD>Enhancements towards stable version 0.1.4.pl00:
<UL>
<LI>New option -error_behavior with a first occasion 'image_loading'</LI>
<LI>Support for BD-RE</LI>
<LI>New options -not_paths, -not_leaf, -not_list, -not_mgt, -as mkisofs -m</LI>
<LI>Emulated -toc on overwriteable media</LI>
<LI>New TOC layout with volume id</LI>
<LI>Emulated -toc on overwriteable media, new -toc layout with volume id</LI>
<LI>New option -rom_toc_scan for read-only drive problems</LI>
<LI>New option -load makes alternative sessions accessible</LI>
<LI>New option -error_behavior with a first occasion 'image_loading'</LI>
<LI>New -blank and -format option 'as_needed'</LI>
<LI>New option -list_formats</LI>
<!-- <LI>- none yet -</LI> -->
</UL>
</DD>

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.05.12.193642"
#define Xorriso_timestamP "2008.05.13.115901"

View File

@ -1060,7 +1060,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
burn_track_get_counters(tracks[0],&readcounter,&writecounter);
xorriso->session_blocks= (int) (writecounter/ (off_t) 2048);
sprintf(xorriso->info_text,
"ISO image produced: %d sectors. Written to media: %d sectors at LBA %d\n",
"ISO image produced: %d sectors\nWritten to media : %d sectors at LBA %d\n",
(int) (readcounter/ (off_t) 2048),
xorriso->session_blocks, xorriso->session_lba);
Xorriso_info(xorriso, 0);
@ -2667,6 +2667,7 @@ int Xorriso_blank_media(struct XorrisO *xorriso, int flag)
double percent = 1.0;
int current_profile;
char current_profile_name[80];
time_t start_time;
char mode_names[4][80]= {"all", "fast", "deformat", "deformat_quickest"};
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
@ -2727,12 +2728,14 @@ int Xorriso_blank_media(struct XorrisO *xorriso, int flag)
burn_disc_erase(drive, (flag&1));
else
isoburn_disc_erase(drive, (flag&1));
start_time= time(0);
usleep(1000000);
while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) {
Xorriso_process_msg_queues(xorriso,0);
if(p.sectors>0 && p.sector>=0) /* display 1 to 99 percent */
percent = 1.0 + ((double) p.sector+1.0) / ((double) p.sectors) * 98.0;
sprintf(xorriso->info_text, "Blanking ( %.1f%% done )", percent);
sprintf(xorriso->info_text, "Blanking ( %.1f%% done in %d seconds )",
percent, (int) (time(0) - start_time));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
usleep(1000000);
}
@ -2818,28 +2821,18 @@ int Xorriso_format_media(struct XorrisO *xorriso, int flag)
Xorriso_info(xorriso, 0);
burn_disc_format(drive, size, mode_flag);
#ifdef NIX
/* <<< too boring */
ret= Xorriso_pacifier_loop(xorriso, drive, 0);
if(ret<=0)
return(ret);
#else
start_time= time(0);
usleep(1000000);
while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) {
Xorriso_process_msg_queues(xorriso,0);
if(p.sectors>0 && p.sector>=0) /* display 1 to 99 percent */
percent = 1.0 + ((double) p.sector+1.0) / ((double) p.sectors) * 98.0;
sprintf(xorriso->info_text, "Formatting ( %.1f%% done in %d seconds)",
sprintf(xorriso->info_text, "Formatting ( %.1f%% done in %d seconds )",
percent, (int) (time(0) - start_time));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
usleep(1000000);
}
#endif /* ! NIX */
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, "Formatting done\n");
Xorriso_info(xorriso,0);
@ -2901,6 +2894,73 @@ int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag)
}
/* @return <=0 error, 1 success
*/
int Xorriso_list_formats(struct XorrisO *xorriso, int flag)
{
int ret, i, status, num_formats, profile_no, type;
off_t size;
unsigned dummy;
char status_text[80], profile_name[90], *respt;
struct burn_drive_info *dinfo;
struct burn_drive *drive;
respt= xorriso->result_line;
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to obtain format descriptor list", 2);
if(ret<=0)
return(0);
ret = burn_disc_get_formats(drive, &status, &size, &dummy,
&num_formats);
if(ret <= 0) {
sprintf(xorriso->info_text, "Cannot obtain format list info");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 2; goto ex;
}
ret= Xorriso_toc(xorriso, 3);
if(ret<=0)
goto ex;
ret= burn_disc_get_profile(drive, &profile_no, profile_name);
if(ret<=0)
goto ex;
if(status == BURN_FORMAT_IS_UNFORMATTED)
sprintf(status_text, "unformatted, up to %.1f MiB",
((double) size) / 1024.0 / 1024.0);
else if(status == BURN_FORMAT_IS_FORMATTED) {
if(profile_no==0x12 || profile_no==0x13 || profile_no==0x1a ||
profile_no==0x43)
sprintf(status_text, "formatted, with %.1f MiB",
((double) size) / 1024.0 / 1024.0);
else
sprintf(status_text, "written, with %.1f MiB",
((double) size) / 1024.0 / 1024.0);
} else if(status == BURN_FORMAT_IS_UNKNOWN) {
if (profile_no > 0)
sprintf(status_text, "intermediate or unknown");
else
sprintf(status_text, "no media or unknown media");
} else
sprintf(status_text, "illegal status according to MMC-5");
sprintf(respt, "Format status: %s\n", status_text);
Xorriso_result(xorriso,0);
for (i= 0; i < num_formats; i++) {
ret= burn_disc_get_format_descr(drive, i, &type, &size, &dummy);
if (ret <= 0)
continue;
sprintf(respt, "Format idx %-2d: %2.2Xh , %.fs , %.1f MiB\n",
i, type, ((double) size) / 2048.0, ((double) size) / 1024.0/1024.0);
Xorriso_result(xorriso,0);
}
ret= 1;
ex:;
return(ret);
}
int Xorriso_cannot_create_iter(struct XorrisO *xorriso, int iso_error,int flag)
{
Xorriso_process_msg_queues(xorriso,0);

View File

@ -74,6 +74,10 @@ int Xorriso_blank_media(struct XorrisO *xorriso, int flag);
*/
int Xorriso_format_media(struct XorrisO *xorriso, int flag);
/* @return <=0 error, 1 success
*/
int Xorriso_list_formats(struct XorrisO *xorriso, int flag);
/* @param flag bit2= formatting rather than blanking
@return 0=failure, did not touch media , -1=failure, altered media
1=success, altered media , 2=success, did not touch media