Made Xorriso_toc() ready for long block adresses
This commit is contained in:
parent
82deb547c0
commit
662b305d12
@ -1057,13 +1057,11 @@ int Xorriso_media_product(struct XorrisO *xorriso, int flag)
|
|||||||
*/
|
*/
|
||||||
int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
||||||
{
|
{
|
||||||
int num_sessions= 0, num_tracks= 0, lba= 0, nwa= -1, ret;
|
int num_sessions= 0, num_tracks= 0, ret;
|
||||||
int track_count= 0, session_no, track_no, profile_no= -1, track_size;
|
int track_count= 0, session_no, track_no, profile_no= -1;
|
||||||
int session_size, first_track_start= 0;
|
int is_data= 0;
|
||||||
int num_session_data, num_session_other;
|
int is_inout_drive= 0, drive_role, status, num_formats;
|
||||||
int num_data= 0, other_data= 0, is_data= 0;
|
int not_recognizable= 0;
|
||||||
int is_inout_drive= 0, drive_role, status, num_formats, emul_lba;
|
|
||||||
int not_recognizable= 0, start_lba, end_lba;
|
|
||||||
int sessions_seen, open_sessions= 0, have_real_open_session= 0;
|
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;
|
||||||
@ -1077,14 +1075,16 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
struct isoburn_toc_disc *disc= NULL;
|
struct isoburn_toc_disc *disc= NULL;
|
||||||
struct isoburn_toc_session **sessions;
|
struct isoburn_toc_session **sessions;
|
||||||
struct isoburn_toc_track **tracks;
|
struct isoburn_toc_track **tracks;
|
||||||
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;
|
int disk_category, part_version, num_layers, num_blocks;
|
||||||
char *book_name;
|
char *book_name;
|
||||||
int num_data_from_format= 0;
|
int num_data_from_format= 0;
|
||||||
char *sno = NULL;
|
char *sno = NULL;
|
||||||
int sno_len, i, is_bdr_pow= 0, overburn_blocks= 0;
|
int sno_len, i, is_bdr_pow= 0, int_start_lba= -1, int_end_lba= -1;
|
||||||
|
off_t lba= 0, nwa= -1, track_size, session_size, first_track_start= 0;
|
||||||
|
off_t num_session_data, num_session_other, num_data, other_data= 0;
|
||||||
|
off_t emul_lba, end_lba, image_blocks, overburn_blocks= 0;
|
||||||
|
|
||||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||||
"on attempt to print Table Of Content",
|
"on attempt to print Table Of Content",
|
||||||
@ -1233,17 +1233,17 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
sno= NULL;
|
sno= NULL;
|
||||||
respt= xorriso->result_line;
|
respt= xorriso->result_line;
|
||||||
|
|
||||||
ret= burn_get_read_capacity(drive, &num_data, 0);
|
ret= burn_get_read_capacity_v2(drive, &num_data, 0);
|
||||||
if(ret != 1 || s == BURN_DISC_BLANK)
|
if(ret != 1 || s == BURN_DISC_BLANK)
|
||||||
num_data= 0;
|
num_data= 0;
|
||||||
num_free= isoburn_disc_available_space(drive, NULL) / 2048;
|
num_free= isoburn_disc_available_space(drive, NULL) / 2048;
|
||||||
nwa= -1;
|
nwa= -1;
|
||||||
if (s == BURN_DISC_APPENDABLE) {
|
if (s == BURN_DISC_APPENDABLE) {
|
||||||
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
|
ret= isoburn_disc_track_lba_nwa_v2(drive, NULL, 0, &lba, &nwa);
|
||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
nwa= -1;
|
nwa= -1;
|
||||||
} else if(s == BURN_DISC_BLANK) {
|
} else if(s == BURN_DISC_BLANK) {
|
||||||
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
|
ret= isoburn_disc_track_lba_nwa_v2(drive, NULL, 0, &lba, &nwa);
|
||||||
if(ret == 1) {
|
if(ret == 1) {
|
||||||
num_free+= nwa;
|
num_free+= nwa;
|
||||||
nwa= 0;
|
nwa= 0;
|
||||||
@ -1261,7 +1261,8 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
ret= burn_disc_read_atip(drive);
|
ret= burn_disc_read_atip(drive);
|
||||||
if(ret < 0)
|
if(ret < 0)
|
||||||
goto ex;
|
goto ex;
|
||||||
ret= burn_drive_get_start_end_lba(drive, &start_lba, &end_lba, 0);
|
ret= burn_drive_get_start_end_lba(drive, &int_start_lba, &int_end_lba, 0);
|
||||||
|
end_lba= int_end_lba;
|
||||||
if(s == BURN_DISC_FULL && ret == 1) {
|
if(s == BURN_DISC_FULL && ret == 1) {
|
||||||
if(lba > end_lba - 2) {
|
if(lba > end_lba - 2) {
|
||||||
overburn_blocks= lba - end_lba + 2;
|
overburn_blocks= lba - end_lba + 2;
|
||||||
@ -1271,7 +1272,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
} else {
|
} else {
|
||||||
if(ret == 1 && end_lba - 2 > lba) {
|
if(ret == 1 && end_lba - 2 > lba) {
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
"ATIP end_lba %d > overall %d", end_lba, lba);
|
"ATIP end_lba %.f > overall %.f", (double) end_lba, (double) lba);
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1291,11 +1292,12 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
num_free_text = "unused";
|
num_free_text = "unused";
|
||||||
else
|
else
|
||||||
num_free_text = "writable";
|
num_free_text = "writable";
|
||||||
sprintf(respt, "Media blocks : %d %s , %d %s , %d overall\n",
|
sprintf(respt, "Media blocks : %.f %s , %.f %s , %.f overall\n",
|
||||||
num_data, num_data_text, (int) num_free, num_free_text, lba);
|
(double) num_data, num_data_text,
|
||||||
|
(double) num_free, num_free_text, (double) lba);
|
||||||
Xorriso_toc_line(xorriso, flag & 8);
|
Xorriso_toc_line(xorriso, flag & 8);
|
||||||
if(overburn_blocks > 0) {
|
if(overburn_blocks > 0) {
|
||||||
sprintf(respt, "Overburnt by : %d blocks\n", overburn_blocks);
|
sprintf(respt, "Overburnt by : %.f blocks\n", (double) overburn_blocks);
|
||||||
Xorriso_toc_line(xorriso, flag & 8);
|
Xorriso_toc_line(xorriso, flag & 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1349,7 +1351,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
Xorriso_process_msg_queues(xorriso,0);
|
Xorriso_process_msg_queues(xorriso,0);
|
||||||
nwa= 0;
|
nwa= 0;
|
||||||
if(drive_role == 5 && s == BURN_DISC_APPENDABLE) {
|
if(drive_role == 5 && s == BURN_DISC_APPENDABLE) {
|
||||||
ret= burn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
|
ret= burn_disc_track_lba_nwa_v2(drive, NULL, 0, &lba, &nwa);
|
||||||
if(ret != 1)
|
if(ret != 1)
|
||||||
nwa= 0;
|
nwa= 0;
|
||||||
} else {
|
} else {
|
||||||
@ -1371,10 +1373,10 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
ret= 0;
|
ret= 0;
|
||||||
typetext= "Session ";
|
typetext= "Session ";
|
||||||
} else
|
} else
|
||||||
ret= isoburn_read_iso_head(drive, 0, &image_blocks, volume_id, 1);
|
ret= isoburn_read_iso_head_v2(drive, 0, &image_blocks, volume_id, 1);
|
||||||
if(ret>0) {
|
if(ret>0) {
|
||||||
sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n",
|
sprintf(respt, "ISO session : %3d , %9d , %9.fs , %s\n",
|
||||||
1, 0, image_blocks, volume_id);
|
1, 0, (double) image_blocks, volume_id);
|
||||||
nwa= image_blocks;
|
nwa= image_blocks;
|
||||||
} else {
|
} else {
|
||||||
ret= burn_disc_get_formats(drive, &status, &size, &dummy,
|
ret= burn_disc_get_formats(drive, &status, &size, &dummy,
|
||||||
@ -1382,17 +1384,17 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
if(ret <= 0 || status != BURN_FORMAT_IS_FORMATTED)
|
if(ret <= 0 || status != BURN_FORMAT_IS_FORMATTED)
|
||||||
size= 0;
|
size= 0;
|
||||||
if(size <= 0) {
|
if(size <= 0) {
|
||||||
ret= burn_get_read_capacity(drive, &num_data, 0);
|
ret= burn_get_read_capacity_v2(drive, &num_data, 0);
|
||||||
if(ret == 1)
|
if(ret == 1)
|
||||||
size= ((off_t) num_data) * (off_t) 2048;
|
size= num_data * (off_t) 2048;
|
||||||
} else {
|
} else {
|
||||||
num_data_from_format= 1;
|
num_data_from_format= 1;
|
||||||
}
|
}
|
||||||
num_data= size / 2048;
|
num_data= size / 2048;
|
||||||
if(num_data == 0 && drive_role == 5 && s == BURN_DISC_APPENDABLE)
|
if(num_data == 0 && drive_role == 5 && s == BURN_DISC_APPENDABLE)
|
||||||
num_data= nwa;
|
num_data= nwa;
|
||||||
sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
|
sprintf(respt, "%13s: %3d , %9d , %9.fs , \n",
|
||||||
typetext, 1, 0, num_data);
|
typetext, 1, 0, (double) num_data);
|
||||||
}
|
}
|
||||||
if(!(flag&1))
|
if(!(flag&1))
|
||||||
Xorriso_toc_line(xorriso, flag & 8);
|
Xorriso_toc_line(xorriso, flag & 8);
|
||||||
@ -1418,7 +1420,10 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
isoburn_toc_track_get_entry(tracks[track_no], &toc_entry);
|
isoburn_toc_track_get_entry(tracks[track_no], &toc_entry);
|
||||||
if((toc_entry.control & 7) >= 4) /* data track */
|
if((toc_entry.control & 7) >= 4) /* data track */
|
||||||
is_data= 1;
|
is_data= 1;
|
||||||
if (toc_entry.extensions_valid & 1) {
|
if(toc_entry.extensions_valid & 8) {
|
||||||
|
lba= toc_entry.long_start_lba;
|
||||||
|
track_size= toc_entry.long_track_blocks;
|
||||||
|
} else if(toc_entry.extensions_valid & 1) {
|
||||||
/* DVD extension valid */
|
/* DVD extension valid */
|
||||||
lba= toc_entry.start_lba;
|
lba= toc_entry.start_lba;
|
||||||
track_size= toc_entry.track_blocks;
|
track_size= toc_entry.track_blocks;
|
||||||
@ -1437,14 +1442,15 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
if((flag & (1 | 4)) || !is_data) {
|
if((flag & (1 | 4)) || !is_data) {
|
||||||
ret= 0;
|
ret= 0;
|
||||||
} else {
|
} else {
|
||||||
ret= isoburn_toc_track_get_emul(tracks[track_no], &emul_lba,
|
ret= isoburn_toc_track_get_emul_v2(tracks[track_no], &emul_lba,
|
||||||
&image_blocks, volume_id, 0);
|
&image_blocks, volume_id, 0);
|
||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
ret= isoburn_read_iso_head(drive, lba, &image_blocks, volume_id, 1);
|
ret= isoburn_read_iso_head_v2(drive, lba, &image_blocks, volume_id,
|
||||||
|
1);
|
||||||
if(image_blocks > track_size) {
|
if(image_blocks > track_size) {
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
"Session %d bears ISO image size %ds larger than track size %ds",
|
"Session %d bears ISO image size %.fs larger than track size %.fs",
|
||||||
session_no + 1, image_blocks, track_size);
|
session_no + 1, (double) image_blocks, (double) track_size);
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING",
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING",
|
||||||
0);
|
0);
|
||||||
image_blocks= track_size;
|
image_blocks= track_size;
|
||||||
@ -1453,26 +1459,28 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
if(session_no >= num_sessions && track_no == 0) {
|
if(session_no >= num_sessions && track_no == 0) {
|
||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
volume_id[0]= 0;
|
volume_id[0]= 0;
|
||||||
sprintf(respt, "Incmp session: %3d , %9d , %9ds , %s\n",
|
sprintf(respt, "Incmp session: %3d , %9.f , %9.fs , %s\n",
|
||||||
session_no+1, lba, image_blocks, volume_id);
|
session_no + 1, (double) lba, (double) image_blocks,
|
||||||
|
volume_id);
|
||||||
} else if(ret>0 && track_no==0) {
|
} else if(ret>0 && track_no==0) {
|
||||||
sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n",
|
sprintf(respt, "ISO session : %3d , %9.f , %9.fs , %s\n",
|
||||||
session_no+1, lba, image_blocks , volume_id);
|
session_no + 1, (double) lba, (double) image_blocks ,
|
||||||
|
volume_id);
|
||||||
} else if(ret>0) {
|
} else if(ret>0) {
|
||||||
sprintf(respt, "ISO track : %3d , %9d , %9ds , %s\n",
|
sprintf(respt, "ISO track : %3d , %9.f , %9.fs , %s\n",
|
||||||
track_count, lba, image_blocks , volume_id);
|
track_count, (double) lba, (double) image_blocks , volume_id);
|
||||||
} else if(track_no==0) {
|
} else if(track_no==0) {
|
||||||
typetext= "Other session";
|
typetext= "Other session";
|
||||||
if(flag & 4)
|
if(flag & 4)
|
||||||
typetext= "Session ";
|
typetext= "Session ";
|
||||||
sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
|
sprintf(respt, "%13s: %3d , %9.f , %9.fs , \n",
|
||||||
typetext, session_no+1, lba, track_size);
|
typetext, session_no+1, (double) lba, (double) track_size);
|
||||||
} else {
|
} else {
|
||||||
typetext= "Other track ";
|
typetext= "Other track ";
|
||||||
if(flag & 4)
|
if(flag & 4)
|
||||||
typetext= "Track ";
|
typetext= "Track ";
|
||||||
sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
|
sprintf(respt, "%13s: %3d , %9.f , %9.fs , \n",
|
||||||
typetext, track_count, lba, track_size);
|
typetext, track_count, (double) lba, (double) track_size);
|
||||||
}
|
}
|
||||||
if(!(flag&1))
|
if(!(flag&1))
|
||||||
Xorriso_toc_line(xorriso, flag & 8);
|
Xorriso_toc_line(xorriso, flag & 8);
|
||||||
@ -1484,7 +1492,9 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
first_track_start= lba;
|
first_track_start= lba;
|
||||||
}
|
}
|
||||||
isoburn_toc_session_get_leadout_entry(sessions[session_no], &toc_entry);
|
isoburn_toc_session_get_leadout_entry(sessions[session_no], &toc_entry);
|
||||||
if (toc_entry.extensions_valid & 1) {
|
if (toc_entry.extensions_valid & 8) {
|
||||||
|
lba= toc_entry.long_start_lba;
|
||||||
|
} else if(toc_entry.extensions_valid & 1) {
|
||||||
lba= toc_entry.start_lba;
|
lba= toc_entry.start_lba;
|
||||||
} else {
|
} else {
|
||||||
lba= burn_msf_to_lba(toc_entry.pmin, toc_entry.psec, toc_entry.pframe);
|
lba= burn_msf_to_lba(toc_entry.pmin, toc_entry.psec, toc_entry.pframe);
|
||||||
@ -1507,8 +1517,9 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
sessions_seen= num_sessions + open_sessions;
|
sessions_seen= num_sessions + open_sessions;
|
||||||
if(open_sessions > 0 && !have_real_open_session)
|
if(open_sessions > 0 && !have_real_open_session)
|
||||||
sessions_seen--;
|
sessions_seen--;
|
||||||
sprintf(respt, "Media summary: %d session%s, %d data blocks, %s data",
|
sprintf(respt, "Media summary: %d session%s, %.f data blocks, %s data",
|
||||||
sessions_seen, (sessions_seen == 1 ? "" : "s"), num_data, mem_text);
|
sessions_seen, (sessions_seen == 1 ? "" : "s"), (double) num_data,
|
||||||
|
mem_text);
|
||||||
if(num_data_from_format)
|
if(num_data_from_format)
|
||||||
num_free= 0;
|
num_free= 0;
|
||||||
else
|
else
|
||||||
@ -1520,14 +1531,14 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
Xorriso_toc_line(xorriso, flag & 8);
|
Xorriso_toc_line(xorriso, flag & 8);
|
||||||
|
|
||||||
if(other_data > 0) {
|
if(other_data > 0) {
|
||||||
sprintf(respt, "Non-data blks: %d\n", other_data);
|
sprintf(respt, "Non-data blks: %.f\n", (double) other_data);
|
||||||
Xorriso_toc_line(xorriso, flag & 8);
|
Xorriso_toc_line(xorriso, flag & 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s==BURN_DISC_APPENDABLE && nwa!=0) {
|
if (s==BURN_DISC_APPENDABLE && nwa!=0) {
|
||||||
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
|
ret= isoburn_disc_track_lba_nwa_v2(drive, NULL, 0, &lba, &nwa);
|
||||||
if(ret>0) {
|
if(ret>0) {
|
||||||
sprintf(respt, "Media nwa : %ds\n", nwa);
|
sprintf(respt, "Media nwa : %.fs\n", (double) nwa);
|
||||||
if(!(flag&1))
|
if(!(flag&1))
|
||||||
Xorriso_toc_line(xorriso, flag & 8);
|
Xorriso_toc_line(xorriso, flag & 8);
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2024.03.19.112303"
|
#define Xorriso_timestamP "2024.03.19.185848"
|
||||||
|
Loading…
Reference in New Issue
Block a user