New report line "Media blocks :" with option -toc

This commit is contained in:
Thomas Schmitt 2011-08-01 13:04:14 +00:00
parent 27c59a8f73
commit adc3169e34
3 changed files with 75 additions and 3 deletions

View File

@ -800,7 +800,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
int track_count= 0, session_no, track_no, profile_no= -1, track_size; int track_count= 0, session_no, track_no, profile_no= -1, track_size;
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0; int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0;
int is_inout_drive= 0, drive_role, status, num_formats, emul_lba; int is_inout_drive= 0, drive_role, status, num_formats, emul_lba;
int not_recognizable= 0; int not_recognizable= 0, start_lba, end_lba;
char profile_name[80],*respt,*devadr, *typetext= ""; char profile_name[80],*respt,*devadr, *typetext= "";
struct burn_toc_entry toc_entry; struct burn_toc_entry toc_entry;
struct burn_drive_info *dinfo; struct burn_drive_info *dinfo;
@ -816,6 +816,8 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
int image_blocks= 0; int image_blocks= 0;
char volume_id[33]; char volume_id[33];
struct burn_toc_entry next_toc_entry; struct burn_toc_entry next_toc_entry;
int disk_category, part_version, num_layers, num_blocks;
char *book_name;
/* /*
int num_payload= 0, num_wasted= 0, num_nondata= 0; int num_payload= 0, num_wasted= 0, num_nondata= 0;
*/ */
@ -842,7 +844,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
{ret= 1; goto ex;} {ret= 1; goto ex;}
sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n", sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n",
dinfo[0].vendor, dinfo[0].product, dinfo[0].revision); dinfo[0].vendor, dinfo[0].product, dinfo[0].revision);
if((flag & 32) | !(flag & 1)) if((flag & 32) || !(flag & 1))
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
if(flag & 32) if(flag & 32)
{ret= 1; goto ex;} {ret= 1; goto ex;}
@ -912,6 +914,59 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
strcat(respt, "\n"); strcat(respt, "\n");
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
if((s == BURN_DISC_FULL || s == BURN_DISC_APPENDABLE ||
s == BURN_DISC_BLANK) && !(flag & 1)) {
ret= burn_get_read_capacity(drive, &num_data, 0);
if(ret != 1 || s == BURN_DISC_BLANK)
num_data= 0;
num_free= isoburn_disc_available_space(drive, NULL) / 2048;
nwa= -1;
if (s == BURN_DISC_APPENDABLE) {
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
if(ret <= 0)
nwa= -1;
} else if(s == BURN_DISC_BLANK) {
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
if(ret == 1) {
num_free+= nwa;
nwa= 0;
}
}
lba= num_data + num_free;
if(nwa >= 0) {
lba= nwa + num_free;
if(nwa < num_data)
num_data= nwa;
}
/* If closed CD-RW : obtain ATIP lead out address */
if(profile_no == 0x0a) {
ret= burn_disc_read_atip(drive);
if(ret < 0)
goto ex;
ret= burn_drive_get_start_end_lba(drive, &start_lba, &end_lba, 0);
if(s == BURN_DISC_FULL && ret == 1) {
lba= end_lba - 2;
} else {
if(ret == 1 && end_lba - 2 > lba) {
sprintf(xorriso->info_text,
"ATIP end_lba %d > overall %d", end_lba, lba);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
}
}
} else if(profile_no == 0x14) {
ret= burn_disc_get_phys_format_info(drive, &disk_category,
&book_name, &part_version,
&num_layers, &num_blocks, 0);
if(ret == 1 && num_blocks > lba)
lba= num_blocks;
}
sprintf(respt, "Media blocks : %d readable , %d writable , %d overall\n",
num_data, (int) num_free, lba);
Xorriso_toc_line(xorriso, flag & 8);
}
if(s == BURN_DISC_BLANK) { if(s == BURN_DISC_BLANK) {
sprintf(respt, "Media summary: 0 sessions, 0 data blocks, 0 data"); sprintf(respt, "Media summary: 0 sessions, 0 data blocks, 0 data");
num_free= isoburn_disc_available_space(drive, NULL); num_free= isoburn_disc_available_space(drive, NULL);
@ -990,6 +1045,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
*/ */
num_sessions= 1; num_sessions= 1;
} else { } else {
num_data= 0;
sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions); sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions);
for (session_no= 0; session_no<num_sessions && !(xorriso->request_to_abort); for (session_no= 0; session_no<num_sessions && !(xorriso->request_to_abort);
session_no++) { session_no++) {

View File

@ -1218,3 +1218,19 @@ char *Xorriso__hide_mode_text(int hide_mode, int flag)
return "invalid"; return "invalid";
} }
/* @return 0=truncated, 1=ok
*/
int Xorriso__to_upper(char *in, char *out, int out_size, int flag)
{
int i;
for(i= 0; i < out_size - 1 && in[i] != 0; i++)
if(isalpha(in[i]))
out[i]= toupper(in[i]);
else
out[i]= in[i];
out[i]= 0;
return(in[i] == 0);
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.07.31.145832" #define Xorriso_timestamP "2011.08.01.130400"