Top | ![]() |
![]() |
![]() |
![]() |
void | mirage_parser_add_redbook_pregap () |
GDataInputStream * | mirage_parser_create_text_stream () |
void | mirage_parser_generate_info () |
const MirageParserInfo * | mirage_parser_get_info () |
gint | mirage_parser_guess_medium_type () |
void | mirage_parser_info_copy () |
void | mirage_parser_info_free () |
MirageDisc * | mirage_parser_load_image () |
MirageParser object is a base object for image parser implementations. In addition to providing function for image loading and obtaining parser information, it also provides some helper functions that can be used in parser implementations.
MirageParser provides a single virtual function - mirage_parser_load_image()
.
This function must be implemented by image parsers, which derive from
MirageParser object. The function must first check if given file(s)
are supported by the given parser, and then the actual loading is
performed. The result is a MirageDisc object, which represents the
disc stored in the image file(s).
void mirage_parser_add_redbook_pregap (MirageParser *self
,MirageDisc *disc
);
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 NULL 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.
GDataInputStream * mirage_parser_create_text_stream (MirageParser *self
,MirageStream *stream
,GError **error
);
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 GConverterInputStream with a
GCharsetConverter is applied. Then on top of it, a GDataInputStream
is created, which can be used to read text file line-by-line.
self |
||
stream |
a MirageStream. |
[in][transfer full] |
error |
location to store error, or |
[out][allow-none] |
void mirage_parser_generate_info (MirageParser *self
,const gchar *id
,const gchar *name
,gint num_types
,...
);
Generates parser information from the input fields. It is intended as a function for creating parser information in parser implementations.
const MirageParserInfo *
mirage_parser_get_info (MirageParser *self
);
Retrieves parser information.
gint mirage_parser_guess_medium_type (MirageParser *self
,MirageDisc *disc
);
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.
void mirage_parser_info_copy (const MirageParserInfo *info
,MirageParserInfo *dest
);
Copies parser information from info
to dest
.
info |
a MirageParserInfo to copy data from. |
[in] |
dest |
a MirageParserInfo to copy data to. |
[in] |
void
mirage_parser_info_free (MirageParserInfo *info
);
Frees the allocated fields in info
(but not the structure itself!).
MirageDisc * mirage_parser_load_image (MirageParser *self
,MirageStream **streams
,GError **error
);
Loads the image stored in streams
.
struct MirageParser;
All the fields in the MirageParser structure are private to the MirageParser implementation and should never be accessed directly.
struct MirageParserClass { MirageObjectClass parent_class; /* Class members */ MirageDisc *(*load_image) (MirageParser *self, MirageStream **streams, GError **error); };
The class structure for the MirageParser type.
struct MirageParserInfo { gchar *id; gchar *name; gchar **description; gchar **mime_type; };
A structure containing parser information. It can be obtained with call to
mirage_parser_get_info()
.