Browse Source

New API call isoburn_toc_disc_get_incmpl_sess()

master
Thomas Schmitt 9 years ago
parent
commit
3b241f7234
  1. 47
      libisoburn/burn_wrap.c
  2. 2
      libisoburn/isoburn.h
  3. 16
      libisoburn/libisoburn.h
  4. 1
      libisoburn/libisoburn.ver
  5. 2
      xorriso/xorriso_timestamp.h

47
libisoburn/burn_wrap.c

@ -1586,6 +1586,7 @@ int isoburn_toc_destroy_arrays(struct isoburn_toc_disc *o, int flag)
struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d)
{
int ret, session_count= 0, track_count= 0, num_tracks= 0, i, j;
int open_sessions= 0;
struct isoburn *o;
struct isoburn_toc_entry *t;
struct isoburn_toc_disc *toc_disc= NULL;
@ -1601,6 +1602,7 @@ struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d)
toc_disc->tracks= NULL;
toc_disc->track_pointers= NULL;
toc_disc->session_count= 0;
toc_disc->incomplete_session_count= 0;
toc_disc->track_count= 0;
toc_disc->toc= NULL;
@ -1641,18 +1643,26 @@ failure:;
return(NULL);
}
s= burn_disc_get_sessions(toc_disc->disc, &session_count);
for(i= 0; i<session_count; i++) {
open_sessions= burn_disc_get_incomplete_sessions(toc_disc->disc);
for(i= 0; i < session_count + open_sessions; i++) {
tracks = burn_session_get_tracks(s[i], &num_tracks);
if(i == session_count + open_sessions - 1 && open_sessions > 0) {
/* Do not count the invisible track of the last incomplete session */
num_tracks--;
}
track_count+= num_tracks;
}
if(session_count<=0 || track_count<=0)
if(session_count + open_sessions <= 0 || track_count <= 0)
goto failure;
ret= isoburn_toc_new_arrays(toc_disc, session_count, track_count, 0);
ret= isoburn_toc_new_arrays(toc_disc, session_count + open_sessions,
track_count, 0);
if(ret<=0)
goto failure;
track_count= 0;
for(i= 0; i<session_count; i++) {
for(i= 0; i < session_count + open_sessions; i++) {
tracks = burn_session_get_tracks(s[i], &num_tracks);
if(i == session_count + open_sessions - 1 && open_sessions > 0)
num_tracks--;
toc_disc->sessions[i].session= s[i];
toc_disc->sessions[i].track_pointers= toc_disc->track_pointers+track_count;
toc_disc->sessions[i].track_count= num_tracks;
@ -1664,6 +1674,7 @@ failure:;
track_count+= num_tracks;
}
toc_disc->session_count= session_count;
toc_disc->incomplete_session_count= open_sessions;
toc_disc->track_count= track_count;
return(toc_disc);
}
@ -1672,7 +1683,7 @@ failure:;
int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc)
{
struct isoburn_toc_entry *t;
int ret= 0, num_sessions, num_tracks;
int ret= 0, num_sessions, num_tracks, open_sessions= 0, session_idx= -1;
struct burn_session **sessions;
struct burn_track **tracks;
struct burn_toc_entry entry;
@ -1684,9 +1695,23 @@ int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc)
ret= t->start_lba + t->track_blocks;
} else if(disc->disc!=NULL) {
sessions= burn_disc_get_sessions(disc->disc, &num_sessions);
if(num_sessions > 0) {
tracks = burn_session_get_tracks(sessions[num_sessions - 1],
&num_tracks);
open_sessions= burn_disc_get_incomplete_sessions(disc->disc);
if(num_sessions + open_sessions > 0) {
session_idx= num_sessions + open_sessions - 1;
tracks = burn_session_get_tracks(sessions[session_idx], &num_tracks);
if(open_sessions > 0) {
/* Do not count the invisible track of the last incomplete session */
num_tracks--;
}
if(num_tracks <= 0)
session_idx--;
}
if(session_idx >= 0) {
tracks = burn_session_get_tracks(sessions[session_idx], &num_tracks);
if(session_idx == num_sessions + open_sessions - 1 && open_sessions > 0) {
/* Do not count the invisible track of the last incomplete session */
num_tracks--;
}
if(num_tracks > 0) {
burn_track_get_entry(tracks[num_tracks - 1], &entry);
if(entry.extensions_valid & 1)
@ -1709,6 +1734,12 @@ struct isoburn_toc_session **isoburn_toc_disc_get_sessions(
}
int isoburn_toc_disc_get_incmpl_sess(struct isoburn_toc_disc *disc)
{
return(disc->incomplete_session_count);
}
int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s)
{
struct isoburn_toc_entry *t;

2
libisoburn/isoburn.h

@ -28,7 +28,6 @@ struct isoburn_toc_entry {
int track_no; /* point */
int start_lba;
int track_blocks;
char *volid; /* For caching a volume id from emulated toc on overwriteables */
struct isoburn_toc_entry *next;
@ -768,6 +767,7 @@ struct isoburn_toc_disc {
struct isoburn_toc_track *tracks; /* storage array */
struct isoburn_toc_track **track_pointers; /* storage array */
int session_count;
int incomplete_session_count;
int track_count;
struct isoburn_toc_entry *toc;
};

16
libisoburn/libisoburn.h

@ -596,7 +596,11 @@ struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d);
int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc);
/** Get the array of session handles from the table of content.
/** Get the array of session handles and the number of complete sessions
from the table of content.
The result array contains *num + isoburn_toc_disc_get_incmpl_sess()
elements. All above *num are incomplete sessions.
Typically there is at most one incomplete session with no track.
Wrapper for: burn_disc_get_sessions()
@since 0.1.6
@param disc The master handle of the medium
@ -607,6 +611,16 @@ struct isoburn_toc_session **isoburn_toc_disc_get_sessions(
struct isoburn_toc_disc *disc, int *num);
/** Obtain the number of incomplete sessions which are recorded in the
result array of isoburn_toc_disc_get_sessions() after the complete
sessions. See above.
@since 1.2.8
@param disc The master handle of the medium
@return the number of incomplete sessions
*/
int isoburn_toc_disc_get_incmpl_sess(struct isoburn_toc_disc *disc);
/** Tell the number of 2048 byte blocks covered by a particular session.
Wrapper for: burn_session_get_sectors()
@since 0.1.6

1
libisoburn/libisoburn.ver

@ -105,6 +105,7 @@ isoburn_set_read_pacifier;
isoburn_set_truncate;
isoburn_sync_after_write;
isoburn_toc_disc_free;
isoburn_toc_disc_get_incmpl_sess;
isoburn_toc_disc_get_sectors;
isoburn_toc_disc_get_sessions;
isoburn_toc_drive_get_disc;

2
xorriso/xorriso_timestamp.h

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

Loading…
Cancel
Save