Mirage.Fragment

g GObject.GInterface GObject.GInterface Mirage.Contextual Mirage.Contextual GObject.GInterface->Mirage.Contextual GObject.Object GObject.Object Mirage.Object Mirage.Object GObject.Object->Mirage.Object Mirage.Contextual->Mirage.Object Mirage.Fragment Mirage.Fragment Mirage.Object->Mirage.Fragment

Subclasses:

None

Methods

Inherited:

Mirage.Object (2), GObject.Object (37), Mirage.Contextual (8)

Structs:

GObject.ObjectClass (5)

contains_address (address)

get_address ()

get_length ()

is_writable ()

main_data_get_filename ()

main_data_get_format ()

main_data_get_offset ()

main_data_get_size ()

main_data_set_format (format)

main_data_set_offset (offset)

main_data_set_size (size)

main_data_set_stream (stream)

read_main_data (address)

read_subchannel_data (address, buffer)

set_address (address)

set_length (length)

subchannel_data_get_filename ()

subchannel_data_get_format ()

subchannel_data_get_offset ()

subchannel_data_get_size ()

subchannel_data_set_format (format)

subchannel_data_set_offset (offset)

subchannel_data_set_size (size)

subchannel_data_set_stream (stream)

use_the_rest_of_file ()

write_main_data (address, buffer)

write_subchannel_data (address, buffer)

Virtual Methods

Inherited:

GObject.Object (7), Mirage.Contextual (2)

Properties

None

Signals

Inherited:

Mirage.Object (1), GObject.Object (1)

Name

Short Description

layout-changed

Emitted when a layout of Mirage.Fragment changed in a way that causes a bottom-up change.

Fields

Inherited:

Mirage.Object (1), GObject.Object (1)

Name

Type

Access

Description

parent_instance

Mirage.Object

r

Class Details

class Mirage.Fragment(**kwargs)
Bases:

Mirage.Object

Abstract:

No

Structure:

Mirage.FragmentClass

All the fields in the Mirage.Fragment structure are private to the Mirage.Fragment implementation and should never be accessed directly.

contains_address(address)
Parameters:

address (int) – address to be checked

Returns:

True if address falls inside fragment, False if it does not

Return type:

bool

Checks whether the fragment contains the given address or not.

get_address()
Returns:

start address

Return type:

int

Retrieves fragment’s start address. The address is given in sectors.

Intended for internal use only.

get_length()
Returns:

length

Return type:

int

Retrieves fragment’s length. The returned length is given in sectors.

Intended for internal use only.

is_writable()
Returns:

True if fragment is writable, False if it is not.

Return type:

bool

Checks if fragment is writable, i.e., whether it has main channel data stream set and this stream is writable.

main_data_get_filename()
Returns:

pointer to main channel data file name string. The string belongs to object and should not be modified.

Return type:

str

Retrieves filename of main channel data stream.

main_data_get_format()
Returns:

main data file format

Return type:

int

Retrieves main data file format.

main_data_get_offset()
Returns:

main data file offset

Return type:

int

Retrieves main data file offset.

main_data_get_size()
Returns:

main data file sector size

Return type:

int

Retrieves main data file sector size.

main_data_set_format(format)
Parameters:

format (int) – main data file format

Sets main data file format. format must be one of Mirage.MainDataFormat.

main_data_set_offset(offset)
Parameters:

offset (int) – main data file offset

Sets main data file offset.

main_data_set_size(size)
Parameters:

size (int) – main data file sector size

Sets main data file sector size.

main_data_set_stream(stream)
Parameters:

stream (Mirage.Stream) – a Mirage.Stream on main channel data file

Sets main channel data stream.

read_main_data(address)
Parameters:

address (int) – address

Raises:

GLib.Error

Returns:

True on success, False on failure

buffer:

location to store pointer to buffer with read data, or None

Return type:

(bool, buffer: bytes)

Reads main channel data for sector at fragment-relative address (given in sectors). The buffer for reading data into is allocated by function and should be freed using GLib.free() when no longer needed. The pointer to buffer is stored into buffer and the length of read data is stored into length.

read_subchannel_data(address, buffer)
Parameters:
  • address (int) – address

  • buffer (bytes or None) – buffer with data to write, or None

Raises:

GLib.Error

Returns:

True on success, False on failure

Return type:

bool

Writes subchannel data for sector at fragment-relative address (given in sectors).

set_address(address)
Parameters:

address (int) – start address

Sets fragment’s start address. The address is given in sectors.

Intended for internal use only.

Causes top-down change.

set_length(length)
Parameters:

length (int) – length

Sets fragment’s length. The length is given in sectors.

Intended for internal use only.

Causes bottom-up change.

subchannel_data_get_filename()
Returns:

pointer to subchannel data file name string. The string belongs to object and should not be modified.

Return type:

str

Retrieves filename of subchannel data input stream.

subchannel_data_get_format()
Returns:

subchannel data file format

Return type:

int

Retrieves subchannel data file format.

subchannel_data_get_offset()
Returns:

subchannel data file offset

Return type:

int

Retrieves subchannel data file offset.

subchannel_data_get_size()
Returns:

subchannel data file sector size

Return type:

int

Retrieves subchannel data file sector size.

subchannel_data_set_format(format)
Parameters:

format (int) – subchannel data file format

Sets subchannel data file format. format must be a combination of Mirage.SubchannelDataFormat.

subchannel_data_set_offset(offset)
Parameters:

offset (int) – subchannel data file offset

Sets subchannel data file offset.

subchannel_data_set_size(size)
Parameters:

size (int) – subchannel data file sector size

Sets subchannel data file sector size.

subchannel_data_set_stream(stream)
Parameters:

stream (Mirage.Stream) – a Mirage.Stream on subchannel data file

Sets subchannel data stream.

use_the_rest_of_file()
Raises:

GLib.Error

Returns:

True on success, False on failure

Return type:

bool

Uses the rest of data file. It automatically calculates and sets fragment’s length.

write_main_data(address, buffer)
Parameters:
  • address (int) – address

  • buffer (bytes or None) – buffer with data to write, or None

Raises:

GLib.Error

Returns:

True on success, False on failure

Return type:

bool

Writes main channel data for sector at fragment-relative address (given in sectors).

write_subchannel_data(address, buffer)
Parameters:
  • address (int) – address

  • buffer (bytes or None) – buffer with read data, or None

Raises:

GLib.Error

Returns:

True on success, False on failure

Return type:

bool

Reads subchannel data for sector at fragment-relative address (given in sectors). The buffer for reading data into is allocated by function and should be freed using GLib.free() when no longer needed. The pointer to buffer is stored into buffer and the length of read data is stored into length.

Signal Details

Mirage.Fragment.signals.layout_changed(fragment)
Signal Name:

layout-changed

Flags:

RUN_LAST

Parameters:

fragment (Mirage.Fragment) – The object which received the signal

Emitted when a layout of Mirage.Fragment changed in a way that causes a bottom-up change.