Making use of new libisoburn API call to show incomplete sessions

This commit is contained in:
Thomas Schmitt 2013-01-14 09:45:20 +00:00
parent 3b241f7234
commit 9d8da6bbc3
2 changed files with 26 additions and 7 deletions

View File

@ -941,6 +941,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
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, start_lba, end_lba; int not_recognizable= 0, start_lba, end_lba;
int sessions_seen, open_sessions= 0, have_real_open_session= 0;
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;
@ -1194,11 +1195,16 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
} else { } else {
num_data= 0; 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); open_sessions= isoburn_toc_disc_get_incmpl_sess(disc);
for (session_no= 0;
session_no < num_sessions + open_sessions &&
!(xorriso->request_to_abort);
session_no++) { session_no++) {
tracks= isoburn_toc_session_get_tracks(sessions[session_no], &num_tracks); tracks= isoburn_toc_session_get_tracks(sessions[session_no], &num_tracks);
if (tracks==NULL) if (tracks == NULL || num_tracks <= 0)
continue; continue;
if(session_no == num_sessions + open_sessions - 1 && open_sessions > 0)
have_real_open_session= 1;
for(track_no= 0; track_no<num_tracks && !(xorriso->request_to_abort); for(track_no= 0; track_no<num_tracks && !(xorriso->request_to_abort);
track_no++) { track_no++) {
track_count++; track_count++;
@ -1236,7 +1242,12 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
image_blocks= track_size; image_blocks= track_size;
} }
} }
if(ret>0 && track_no==0) { if(session_no >= num_sessions && track_no == 0) {
if(ret <= 0)
volume_id[0]= 0;
sprintf(respt, "Incmp session: %3d , %9d , %9ds , %s\n",
session_no+1, lba, image_blocks, volume_id);
} else if(ret>0 && track_no==0) {
sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n", sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n",
session_no+1, lba, image_blocks , volume_id); session_no+1, lba, image_blocks , volume_id);
} else if(ret>0) { } else if(ret>0) {
@ -1289,8 +1300,11 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
*/ */
Sfile_scale(((double) num_data) * 2048.0, mem_text,5,1e4,1); Sfile_scale(((double) num_data) * 2048.0, mem_text,5,1e4,1);
sessions_seen= num_sessions + open_sessions;
if(open_sessions > 0 && !have_real_open_session)
sessions_seen--;
sprintf(respt, "Media summary: %d session%s, %d data blocks, %s data", sprintf(respt, "Media summary: %d session%s, %d data blocks, %s data",
num_sessions, (num_sessions==1 ? "" : "s"), num_data, mem_text); sessions_seen, (sessions_seen == 1 ? "" : "s"), num_data, mem_text);
if(num_data_from_format) if(num_data_from_format)
num_free= 0; num_free= 0;
else else
@ -1309,10 +1323,15 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
} }
} }
if(profile_no == 0x41 && num_sessions >= 300) { if(profile_no == 0x41 && sessions_seen >= 300) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Sequential BD-R medium now contains %d sessions. It is likely to soon fail writing.", "Sequential BD-R medium now contains %d sessions. It is likely to soon fail writing.",
num_sessions); sessions_seen);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
}
if(have_real_open_session) {
sprintf(xorriso->info_text, "Incomplete session encountered !");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
} }

View File

@ -1 +1 @@
#define Xorriso_timestamP "2013.01.13.200742" #define Xorriso_timestamP "2013.01.14.094419"