Mirage.Sector¶
- Subclasses:
None
Methods¶
- Inherited:
Mirage.Object (2), GObject.Object (37), Mirage.Contextual (8)
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Mirage.Sector(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
All the fields in the
Mirage.Sector
structure are private to theMirage.Sector
implementation and should never be accessed directly.- extract_data(main_data_length, subchannel_data, subchannel_data_length)¶
- Parameters:
- Raises:
- Returns:
True
on success,False
on failure- main_data:
location to store pointer to main data buffer
- subchannel_format:
requested subchannel data format
- Return type:
(
bool
, main_data:int
, subchannel_format:Mirage.SectorSubchannelFormat
)
Extracts data from sector. Which parts of main channel data are extracted depends on provided main_data_length.
Intended for internal use.
- feed_data(address, type, main_data, main_data_length, subchannel_format, subchannel_data, subchannel_data_length, ignore_data_mask)¶
- Parameters:
address (
int
) – absolute disc address the sector represents. Given in sectors.type (
Mirage.SectorType
) – track type (one ofMirage.SectorType
)main_data (
int
) – main data buffermain_data_length (
int
) – length of data in main data buffersubchannel_format (
Mirage.SectorSubchannelFormat
) – subchannel data formatsubchannel_data_length (
int
) – length of data in subchannel data bufferignore_data_mask (
int
) – a mask ofMirage.SectorValidData
values, indicating which parts of main channel sector data, if any, should be ignored and regerated even though they are provided by the data feed
- Raises:
- Returns:
- Return type:
Feeds data to sector. If type is
Mirage.SectorType.RAW
orMirage.SectorType.RAW_SCRAMBLED
, the real sector type is determined during feeding.Intended for internal use.
- get_address()¶
- Returns:
sector address
- Return type:
Retrieves absolute disc address of the sector.
- get_data()¶
- Raises:
- Returns:
True
on success,False
on failure- ret_buf:
location to store pointer to buffer containing user data, or
None
- Return type:
Retrieves sector’s user data. The pointer to appropriate location in sector’s data buffer is stored into ret_buf; therefore, the buffer should not be modified.
- get_edc_ecc()¶
- Raises:
- Returns:
True
on success,False
on failure- ret_buf:
location to store pointer to buffer containing EDC/ECC data, or
None
- Return type:
Retrieves sector’s EDC/ECC data. The pointer to appropriate location in sector’s data buffer is stored into ret_buf; therefore, the buffer should not be modified.
If EDC/ECC data is not provided by image file(s), it is generated.
- get_header()¶
- Raises:
- Returns:
True
on success,False
on failure- ret_buf:
location to store pointer to buffer containing header, or
None
- Return type:
Retrieves sector’s header. The pointer to appropriate location in sector’s data buffer is stored into ret_buf; therefore, the buffer should not be modified.
If header is not provided by image file(s), it is generated.
- get_sector_type()¶
- Returns:
sector type (track mode)
- Return type:
Retrieves sector type (track mode); one of
Mirage.SectorType
.
- get_subchannel(format)¶
- Parameters:
format (
Mirage.SectorSubchannelFormat
) – subchannel format- Raises:
- Returns:
True
on success,False
on failure- ret_buf:
location to store pointer to buffer containing subchannel, or
None
- Return type:
Retrieves sector’s subchannel. format must be one of
Mirage.SectorSubchannelFormat
. The pointer to appropriate location in sector’s data buffer is stored into ret_buf; therefore, the buffer should not be modified.If subchannel is not provided by image file(s), it is generated.
- get_subheader()¶
- Raises:
- Returns:
True
on success,False
on failure- ret_buf:
location to store pointer to buffer containing subheader, or
None
- Return type:
Retrieves sector’s subheader. The pointer to appropriate location in sector’s data buffer is stored into ret_buf; therefore, the buffer should not be modified.
If subheader is not provided by image file(s), it is generated.
- get_sync()¶
- Raises:
- Returns:
True
on success,False
on failure- ret_buf:
location to store pointer to buffer containing sync pattern, or
None
- Return type:
Retrieves sector’s sync pattern. The pointer to appropriate location in sector’s data buffer is stored into ret_buf; therefore, the buffer should not be modified.
If sync pattern is not provided by image file(s), it is generated.
- scramble()¶
Scrambles 2340 bytes of sector data after sync pattern, using scrambler from ECMA-130 Annex B. Running this function on already-scrambled sector results in unscrambling.
- set_data(buf)¶
- Parameters:
buf (
bytes
) – buffer containing user data- Raises:
- Returns:
- Return type:
Sets sector’s user data to that stored in buf.
- set_edc_ecc(buf)¶
- Parameters:
buf (
bytes
) – buffer containing EDC/ECC data- Raises:
- Returns:
- Return type:
Sets sector’s EDC/ECC data to that stored in buf.
- set_header(buf)¶
- Parameters:
buf (
bytes
) – buffer containing header- Raises:
- Returns:
- Return type:
Sets sector’s header to that stored in buf.
- set_subchannel(format, buf)¶
- Parameters:
format (
Mirage.SectorSubchannelFormat
) – subchannel formatbuf (
bytes
) – buffer containing subchannel data
- Raises:
- Returns:
- Return type:
Sets sector’s subchannel data to that stored in buf. format must be one of
Mirage.SectorSubchannelFormat
.
- set_subheader(buf)¶
- Parameters:
buf (
bytes
) – buffer containing subheader- Raises:
- Returns:
- Return type:
Sets sector’s subheader to that stored in buf.
- set_sync(buf)¶
- Parameters:
buf (
bytes
) – buffer containing sync pattern- Raises:
- Returns:
- Return type:
Sets sector’s sync pattern to that stored in buf.
- verify_lec()¶
- Returns:
True
if sector passes verification (i.e. no L-EC errors are detected) otherwiseFalse
- Return type:
Verifies the sector data in terms of L-EC error detection/correction. Data sectors (Mode 1, Mode 2 Form 1 and Mode 2 Form 2) contain error detection/error correction codes which is part of so called layered error correction. This function calculates the EDC for sector data and compares it with EDC provided by the image file.
As a result of comparison, the sectors with intentionally faulty EDC (and possibly ECC, though ECC is not verified) can be discovered.
This function requires EDC/ECC data to be provided by the image. If it is not provided, it would be generated by
Mirage.Sector
on first access viaMirage.Sector.get_edc_ecc
() using the same algorithm as the one used by this function. Therefore, in case of EDC/ECC data missing, the verification automatically succeeds.
- verify_subchannel_crc()¶
-
Verifies the Q subchannel’s CRC for the sector.
As a result of comparison, the sectors with intentionally faulty Q subchannel can be discovered.
This function requires subchannel data to be provided by the image. If it is not provided, it would be generated by
Mirage.Sector
on first access viaMirage.Sector.get_subchannel
() using the same algorithm as the one used by this function. Therefore, in case of subchannel data missing, the verification automatically succeeds.