Mirage.Parser

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.Parser Mirage.Parser Mirage.Object->Mirage.Parser

Subclasses:

None

Methods

Inherited:

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

Structs:

GObject.ObjectClass (5)

add_redbook_pregap (disc)

create_text_stream (stream)

get_info ()

guess_medium_type (disc)

load_image (streams)

Virtual Methods

Inherited:

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

do_load_image (streams)

Properties

None

Signals

Inherited:

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

Fields

Inherited:

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

Name

Type

Access

Description

parent_instance

Mirage.Object

r

Class Details

class Mirage.Parser(**kwargs)
Bases:

Mirage.Object

Abstract:

Yes

Structure:

Mirage.ParserClass

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

add_redbook_pregap(disc)
Parameters:

disc (Mirage.Disc) – disc object

A helper function, intended to be used in simpler parsers that don’t get proper pregap information from the image file.

First, it sets disc layout start to -150. Then, it adds 150-sector pregap to first track of each session found on the layout; for this, a None fragment is used. If track already has a pregap, then the pregaps are stacked.

Note that the function works only on discs which have medium type set to CD-ROM. On other discs, it does nothing.

create_text_stream(stream)
Parameters:

stream (Mirage.Stream) – a Mirage.Stream

Raises:

GLib.Error

Returns:

a Gio.DataInputStream object on success, or None on failure.

Return type:

Gio.DataInputStream

Constructs a filter chain for reading text files on top of provided stream. First, if encoding is provided via parser parameters, or if a multi-byte encoding is detected, a Gio.ConverterInputStream with a Gio.CharsetConverter is applied. Then on top of it, a Gio.DataInputStream is created, which can be used to read text file line-by-line.

get_info()
Returns:

a pointer to parser information structure. The structure belongs to object and should not be modified.

Return type:

Mirage.ParserInfo

Retrieves parser information.

guess_medium_type(disc)
Parameters:

disc (Mirage.Disc) – disc object

Returns:

a value from Mirage.MediumType, according to the guessed medium type.

Return type:

int

Attempts to guess medium type by looking at the length of the disc layout. Currently, it supports identification of CD-ROM media, which are assumed to have layout length of 90 minutes or less.

Note that this function does not set the medium type to disc object; you still need to do it via Mirage.Disc.set_medium_type(). It is meant to be used in simple parsers whose image files don’t provide medium type information.

load_image(streams)
Parameters:

streams ([Mirage.Stream]) – None-terminated array of data streams

Raises:

GLib.Error

Returns:

a Mirage.Disc object representing image on success, None on failure

Return type:

Mirage.Disc

Loads the image stored in streams.

do_load_image(streams) virtual
Parameters:

streams ([Mirage.Stream]) – None-terminated array of data streams

Returns:

a Mirage.Disc object representing image on success, None on failure

Return type:

Mirage.Disc

Loads the image stored in streams.