Top | ![]() |
![]() |
![]() |
![]() |
MirageDisc object is a top-level object in the disc layout representation, representing the actual disc.
It provides functions for manipulating the disc layout; adding and removing sessions and tracks, manipulating medium type, and convenience functions for accessing sectors on the disc.
Typically, a MirageDisc is obtained as a result of loading an image
using MirageContext and its mirage_context_load_image()
function.
gboolean (*MirageEnumSessionCallback) (MirageSession *session
,gpointer user_data
);
Callback function type used with mirage_disc_enumerate_sessions()
.
A pointer to a session object is stored in session
, without incrementing
its reference counter. user_data
is user data passed to enumeration function.
void mirage_disc_add_session_by_index (MirageDisc *self
,gint index
,MirageSession *session
);
Adds session to disc layout.
index
is the index at which session is added. Negative index denotes
index going backwards (i.e. -1 adds session at the end, -2 adds session
second-to-last, etc.). If index, either negative or positive, is too big,
session is added at the beginning or at the end of the layout, respectively.
self |
||
index |
index at which session should be added. |
[in] |
session |
a MirageSession to be added. |
[in][transfer full] |
gboolean mirage_disc_add_session_by_number (MirageDisc *self
,gint number
,MirageSession *session
,GError **error
);
Adds session to disc layout.
number
is session number that should be assigned to added session. It determines
session's position in the layout. If session with that number already exists in
the layout, the function fails.
self |
||
number |
session number for the added session. |
[in] |
session |
a MirageSession to be added. |
[in][transfer full] |
error |
location to store error, or |
[out][allow-none] |
gboolean mirage_disc_add_track_by_index (MirageDisc *self
,gint index
,MirageTrack *track
,GError **error
);
Adds track to disc layout.
index
is the index at which track is added. The function attempts to find
appropriate session by iterating over sessions list and verifying index ranges,
then adds the track using mirage_session_add_track_by_index()
. Negative
index
denotes index going backwards (i.e. -1 adds track at the end of last
session, etc.). If index
, either negative or positive, is too big, track is
respectively added at the beginning of the first or at the end of the last
session in the layout.
If disc layout is empty (i.e. contains no sessions), then session is created.
The rest of behavior is same as of mirage_session_add_track_by_index()
.
self |
||
index |
index at which track should be added. |
[in] |
track |
a MirageTrack to be added. |
[in][transfer full] |
error |
location to store error, or |
[out][allow-none] |
gboolean mirage_disc_add_track_by_number (MirageDisc *self
,gint number
,MirageTrack *track
,GError **error
);
Adds track to disc layout.
number
is track number that should be assigned to added track. It determines
track's position in the layout. The function attempts to find appropriate session
using mirage_disc_get_session_by_track()
, then adds the track using
mirage_session_add_track_by_number()
.
If disc layout is empty (i.e. contains no sessions), then session is created.
If number
is greater than last track's number, the track is added at the end
of last session.
The rest of behavior is same as of mirage_session_add_track_by_number()
.
self |
||
number |
track number for the added track. |
[in] |
track |
a MirageTrack to be added. |
[in][transfer full] |
error |
location to store error, or |
[out][allow-none] |
gboolean mirage_disc_enumerate_sessions (MirageDisc *self
,MirageEnumSessionCallback func
,gpointer user_data
);
Iterates over sessions list, calling func
for each session in the layout.
If func
returns FALSE
, the function immediately returns FALSE
.
gboolean mirage_disc_get_disc_structure (MirageDisc *self
,gint layer
,gint type
,const guint8 **data
,gint *len
,GError **error
);
Retrieves disc structure of type type
from layer layer
. The pointer to buffer
containing the disc structure is stored in data
; the buffer belongs to the
object and therefore should not be modified.
MIRAGE_MEDIUM_DVD
or MIRAGE_MEDIUM_BD
prior to calling this
function, the function will fail.
self |
||
layer |
disc layer. |
[in] |
type |
disc structure type. |
[in] |
data |
location to store buffer containing disc structure data, or |
[out][transfer none][allow-none][array length=len] |
len |
location to store data length, or |
[out][allow-none] |
error |
location to store error, or |
[out][allow-none] |
void mirage_disc_get_dpm_data (MirageDisc *self
,gint *start
,gint *resolution
,gint *num_entries
,const guint32 **data
);
Retrieves DPM data for disc. The pointer to buffer containing DPM data entries
is stored in data
; the buffer belongs to object and therefore should not be
modified.
self |
||
start |
location to store DPM start sector, or |
[out][allow-none] |
resolution |
location to store DPM data resolution, or |
[out][allow-none] |
num_entries |
location to store number of DPM entries, or |
[out][allow-none] |
data |
location to store pointer to buffer containing DPM data, or |
[out][allow-none][array length=num_entries][transfer none] |
gboolean mirage_disc_get_dpm_data_for_sector (MirageDisc *self
,gint address
,gdouble *angle
,gdouble *density
,GError **error
);
Retrieves DPM data for sector at address address
. Two pieces of data can be
retrieved; first one is sector angle, expressed in rotations (i.e. 0.25 would
mean 1/4 of rotation or 90˚ and 1.0 means one full rotation or 360˚), and the
other one is sector density at given address, expressed in degrees per sector).
gchar **
mirage_disc_get_filenames (MirageDisc *self
);
Retrieves image filename(s).
MirageMediumType
mirage_disc_get_medium_type (MirageDisc *self
);
Retrieves medium type.
gint
mirage_disc_get_number_of_sessions (MirageDisc *self
);
Retrieves number of sessions in the disc layout.
gint
mirage_disc_get_number_of_tracks (MirageDisc *self
);
Retrieves number of tracks in the disc layout.
MirageSector * mirage_disc_get_sector (MirageDisc *self
,gint address
,GError **error
);
Retrieves sector object representing sector at sector address address
.
This function attempts to retrieve appropriate track using
mirage_disc_get_track_by_address()
,
then retrieves sector object using mirage_track_get_sector()
.
MirageSession * mirage_disc_get_session_after (MirageDisc *self
,MirageSession *session
,GError **error
);
Retrieves session that comes after session
.
a MirageSession on success, NULL
on failure.
The reference to the object should be released using g_object_unref()
when no longer needed.
[transfer full]
MirageSession * mirage_disc_get_session_before (MirageDisc *self
,MirageSession *session
,GError **error
);
Retrieves session that comes before session
.
a MirageSession on success, NULL
on failure.
The reference to the object should be released using g_object_unref()
when no longer needed.
[transfer full]
MirageSession * mirage_disc_get_session_by_address (MirageDisc *self
,gint address
,GError **error
);
Retrieves session by address. address
must be valid (disc-relative) sector
address that is part of the session to be retrieved (i.e. lying between session's
start and end sector).
self |
||
address |
address belonging to session to be retrieved. |
[in] |
error |
location to store error, or |
[out][allow-none] |
a MirageSession on success, NULL
on failure.
The reference to the object should be released using g_object_unref()
when no longer needed.
[transfer full]
MirageSession * mirage_disc_get_session_by_index (MirageDisc *self
,gint index
,GError **error
);
Retrieves session by index. If index
is negative, sessions from the end of
layout are retrieved (e.g. -1 is for last session, -2 for second-to-last
session, etc.). If index
is out of range, regardless of the sign, the
function fails.
self |
||
index |
index of session to be retrieved. |
[in] |
error |
location to store error, or |
[out][allow-none] |
a MirageSession on success, NULL
on failure.
The reference to the object should be released using g_object_unref()
when no longer needed.
[transfer full]
MirageSession * mirage_disc_get_session_by_number (MirageDisc *self
,gint number
,GError **error
);
Retrieves session by session number.
self |
||
number |
number of session to be retrieved. |
[in] |
error |
location to store error, or |
[out][allow-none] |
a MirageSession on success, NULL
on failure.
The reference to the object should be released using g_object_unref()
when no longer needed.
[transfer full]
MirageSession * mirage_disc_get_session_by_track (MirageDisc *self
,gint track
,GError **error
);
Retrieves session by track number. track
must be valid track number of track
that is part of the session.
self |
||
track |
number of track belonging to session to be retrieved. |
[in] |
error |
location to store error, or |
[out][allow-none] |
a MirageSession on success, NULL
on failure.
The reference to the object should be released using g_object_unref()
when no longer needed.
[transfer full]
MirageTrack * mirage_disc_get_track_by_address (MirageDisc *self
,gint address
,GError **error
);
Retrieves track by address. address
must be valid (disc-relative) sector
address that is part of the track to be retrieved (i.e. lying between track's
start and end sector).
The function attempts to find appropriate session using
mirage_disc_get_session_by_address()
, then retrieves the track using
mirage_session_get_track_by_address()
.
The rest of behavior is same as of mirage_session_get_track_by_address()
.
self |
||
address |
address belonging to track to be retrieved. |
[in] |
error |
location to store error, or |
[out][allow-none] |
a MirageTrack on success, NULL
on failure.
The reference to the object should be released using g_object_unref()
when no longer needed.
[transfer full]
MirageTrack * mirage_disc_get_track_by_index (MirageDisc *self
,gint index
,GError **error
);
Retrieves track by index. The function attempts to find appropriate session
by iterating over sessions list and verifying index ranges, then retrieves
the track using mirage_session_get_track_by_index()
. If index
is negative,
tracks from the end of layout are retrieved (e.g. -1 is for last track, -2
for second-to-last track, etc.). If index
is out of range, regardless of
the sign, the function fails.
The rest of behavior is same as of mirage_session_get_track_by_index()
.
self |
||
index |
index of track to be retrieved. |
[in] |
error |
location to store error, or |
[out][allow-none] |
a MirageTrack on success, NULL
on failure.
The reference to the object should be released using g_object_unref()
when no longer needed.
[transfer full]
MirageTrack * mirage_disc_get_track_by_number (MirageDisc *self
,gint number
,GError **error
);
Retrieves track by track number. The function attempts to find appropriate session
using mirage_disc_get_session_by_track()
, then retrieves the track using
mirage_session_get_track_by_number()
.
The rest of behavior is same as of mirage_session_get_track_by_number()
.
self |
||
number |
track number of track to be retrieved. |
[in] |
error |
location to store error, or |
[out][allow-none] |
a MirageTrack on success, NULL
on failure.
The reference to the object should be released using g_object_unref()
when no longer needed.
[transfer full]
gboolean mirage_disc_layout_contains_address (MirageDisc *self
,gint address
);
Checks whether the disc contains the given address or not.
gint
mirage_disc_layout_get_first_session (MirageDisc *self
);
Retrieves session number of the first session in the disc layout.
gint
mirage_disc_layout_get_first_track (MirageDisc *self
);
Retrieves track number of the first track in the disc layout.
gint
mirage_disc_layout_get_length (MirageDisc *self
);
Retrieves length of the disc layout. The returned length is given in sectors.
gint
mirage_disc_layout_get_start_sector (MirageDisc *self
);
Retrieves start sector of the disc layout.
void mirage_disc_layout_set_first_session (MirageDisc *self
,gint first_session
);
Sets first session number to first_session
. This is a number that is
assigned to the first session in the disc layout.
void mirage_disc_layout_set_first_track (MirageDisc *self
,gint first_track
);
Sets first track number to first_track
. This is a number that is
assigned to the first track in the disc layout.
void mirage_disc_layout_set_start_sector (MirageDisc *self
,gint start_sector
);
Sets start sector of the disc layout to start_sector
. This is a sector at which
the first session (and consequently first track) in the disc layout will start.
gboolean mirage_disc_put_sector (MirageDisc *self
,MirageSector *sector
,GError **error
);
Writes the sector
to disc.
This function attempts to retrieve appropriate track using
mirage_disc_get_track_by_address()
,
then writes sector object using mirage_track_put_sector()
; therefore,
same restrictions regarding sector address apply as when putting sector
directly to track.
self |
||
sector |
a MirageSector representing sector to be written. |
[in] |
error |
location to store error, or |
[out][allow-none] |
gboolean mirage_disc_remove_session_by_index (MirageDisc *self
,gint index
,GError **error
);
Removes session from disc layout.
index
is the index of the session to be removed. This function calls
mirage_disc_get_session_by_index()
so index
behavior is determined by that
function.
gboolean mirage_disc_remove_session_by_number (MirageDisc *self
,gint number
,GError **error
);
Removes session from disc layout.
number
is session number of the session to be removed.
void mirage_disc_remove_session_by_object (MirageDisc *self
,MirageSession *session
);
Removes session from disc layout.
session
is a MirageSession object to be removed.
gboolean mirage_disc_remove_track_by_index (MirageDisc *self
,gint index
,GError **error
);
Removes track from disc layout.
index
is the index of the track to be removed. This function calls
mirage_disc_get_track_by_index()
so index
behavior is determined by that
function.
gboolean mirage_disc_remove_track_by_number (MirageDisc *self
,gint number
,GError **error
);
Removes track from disc layout.
number
is track number of the track to be removed. This function calls
mirage_disc_get_track_by_number()
so number
behavior is determined by that
function.
void mirage_disc_set_disc_structure (MirageDisc *self
,gint layer
,gint type
,const guint8 *data
,gint len
);
Sets disc structure of type type
to layer layer
to disc. data
is buffer
containing disc structure data and len
is data length.
void mirage_disc_set_dpm_data (MirageDisc *self
,gint start
,gint resolution
,gint num_entries
,const guint32 *data
);
Sets the DPM data for disc. If num_entries
is not positive, DPM data is reset.
start
is the address at which DPM data begins, resolution
is resolution of
DPM data and num_entries
is the number of DPM entries in buffer pointed to by
data
.
void mirage_disc_set_filename (MirageDisc *self
,const gchar *filename
);
Sets image filename. The functionality is similar to mirage_disc_set_filenames()
,
except that only one filename is set. It is intended to be used in parsers which
support only single-file images.
void mirage_disc_set_filenames (MirageDisc *self
,gchar **filenames
);
Sets image filename(s).
void mirage_disc_set_medium_type (MirageDisc *self
,MirageMediumType medium_type
);
Sets medium type. medium_type
must be one of MirageMediumType.
typedef struct _MirageDisc MirageDisc;
All the fields in the MirageDisc structure are private to the MirageDisc implementation and should never be accessed directly.
struct MirageDiscClass { MirageObjectClass parent_class; };
The class structure for the MirageDisc type.
“layout-changed”
signalvoid user_function (MirageDisc *disc, gpointer user_data)
Emitted when a layout of MirageDisc changed in a way that causes a bottom-up change.
Flags: Run Last