Reading emulated toc info from overwriteable media, new API isoburn_toc_*()

This commit is contained in:
2008-05-07 17:54:55 +00:00
parent 947bb33173
commit e9171b5133
4 changed files with 527 additions and 1 deletions

View File

@ -381,6 +381,120 @@ int isoburn_disc_erasable(struct burn_drive *d);
void isoburn_disc_erase(struct burn_drive *drive, int fast);
/* ----------------------------------------------------------------------- */
/*
Wrappers for emulation of TOC on overwriteable media
Media which match the overwriteable usage model lack of a history of sessions
and tracks. libburn will not even hand out a burn_disc object for them and
always declare them blank. libisoburn checks for a valid ISO filesystem
header at LBA 0 and eventually declares them appendable.
Nevertheless one can only determine an upper limit of the size of the overall
image (by isoburn_get_min_start_byte()) but not a list of stored sessions
and their LBAs, as it is possible with true multi-session media.
The following wrappers add the capability to obtain a session and track TOC
from emulated multi-session images on overwriteables if the first session
was written by libisoburn-0.1.6 or later (i.e. with a header copy at LBA 32).
Be aware that the structs emitted by these isoburn calls are not compatible
with the libburn structs. I.e. you may use them only with isoburn_toc_*
calls.
isoburn_toc_disc needs to be freed after use. isoburn_toc_session and
isoburn_toc_track vanish together with their isoburn_toc_disc.
*/
/* Opaque handles to media, session, track */
struct isoburn_toc_disc;
struct isoburn_toc_session;
struct isoburn_toc_track;
/** Obtain a master handle for the table of content.
This handle governs allocated resources which have to be released by
isoburn_toc_disc_free() when no longer needed.
Wrapper for: burn_drive_get_disc()
@since 0.1.6
@param drive The drive with the media to inspect
@return NULL in case there is no content info, else it is a valid handle
*/
struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d);
/** Tell the number of 2048 byte blocks covered by the table of content.
Wrapper for: burn_disc_get_sectors()
@since 0.1.6
@param disc The master handle of the media
@return number of blocks, <=0 indicates unknown or unreadable state
*/
int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc);
/** Get the array of session handles from the table of content.
Wrapper for: burn_disc_get_sessions()
@since 0.1.6
@param disc The master handle of the media
@param num returns the number of sessions in the array
@return the address of the array of session handles
*/
struct isoburn_toc_session **isoburn_toc_disc_get_sessions(
struct isoburn_toc_disc *disc, int *num);
/** Tell the number of 2048 byte blocks covered by a particular session.
Wrapper for: burn_session_get_sectors()
@since 0.1.6
@param s The session handle
@return number of blocks, <=0 indicates unknown or unreadable state
*/
int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s);
/** Obtain a copy of the entry which describes the end of a particular session.
Wrapper for: burn_session_get_leadout_entry()
@since 0.1.6
@param s The session handle
@param entry A pointer to memory provided by the caller. It will be filled
with info according to struct burn_toc_entry as defined
in libburn.h
*/
void isoburn_toc_session_get_leadout_entry(struct isoburn_toc_session *s,
struct burn_toc_entry *entry);
/** Get the array of track handles from a particular session.
Wrapper for: burn_session_get_tracks()
@since 0.1.6
@param s The session handle
@param num returns the number of tracks in the array
@return the address of the array of track handles
*/
struct isoburn_toc_track **isoburn_toc_session_get_tracks(
struct isoburn_toc_session *s, int *num);
/** Obtain a copy of the entry which describes a particular itrack.
Wrapper for: burn_track_get_entry()
@since 0.1.6
@param s The track handle
@param entry A pointer to memory provided by the caller. It will be filled
with info according to struct burn_toc_entry as defined
in libburn.h
*/
void isoburn_toc_track_get_entry(struct isoburn_toc_track *t,
struct burn_toc_entry *entry);
/** Release the memory associated with a master handle of media.
The handle is invalid afterwards and may not be used any more.
Wrapper for: burn_disc_free()
@since 0.1.6
@param disc The master handle of the media
*/
void isoburn_toc_disc_free(struct isoburn_toc_disc *disc);
/* ----------------------------------------------------------------------- */
/*