Main: libMirage Reference Manual

## Main Main — Core libMirage functions |

## Functions

gboolean | (*MirageEnumFilterStreamInfoCallback) ()
gboolean | (*MirageEnumParserInfoCallback) ()
gboolean | (*MirageEnumWriterInfoCallback) ()
MirageWriter * | mirage_create_writer ()
gboolean | mirage_enumerate_filter_streams ()
gboolean | mirage_enumerate_parsers ()
gboolean | mirage_enumerate_writers ()
gboolean | mirage_get_filter_streams_info ()
gboolean | mirage_get_filter_streams_type ()
gboolean | mirage_get_parsers_info ()
gboolean | mirage_get_parsers_type ()
gboolean | mirage_get_supported_debug_masks ()
gboolean | mirage_get_writers_info ()
gboolean | mirage_get_writers_type ()
gboolean | mirage_initialize ()
gboolean | mirage_shutdown ()

## Types and Values

| MirageDebugMaskInfo

## Includes

    #include <mirage.h>

## Description

These functions represent the core of the libMirage API. Before the library can be used, it must be initialized using `mirage_initialize()`, which loads the plugins containing image parsers, writers and filter streams. When library is no longer needed, it can be shut down using `mirage_shutdown()`, which unloads the plugins.

The core functions listed in this section enable enumeration of supported parsers, writers and filter streams. Most of the core functionality of libMirage, such as loading images, is encapsulated in MirageContext object, which can be obtained using GLib's `g_object_new()`.

## Functions

### MirageEnumFilterStreamInfoCallback ()

    gboolean
    (*MirageEnumFilterStreamInfoCallback) (const MirageFilterStreamInfo *info,
                                           gpointer user_data);

Callback function type used with `mirage_enumerate_filter_streams()`. A pointer to filter stream information structure is stored in `info` ; the structure belongs to the filter stream object and should not be modified. `user_data` is user data passed to enumeration function.

#### Parameters

info | filter stream info. | [in]
user_data | user data passed to enumeration function. | [in][closure]

#### Returns

`TRUE` on success, otherwise `FALSE`

### MirageEnumParserInfoCallback ()

    gboolean
    (*MirageEnumParserInfoCallback) (const MirageParserInfo *info,
                                     gpointer user_data);

Callback function type used with `mirage_enumerate_parsers()`. A pointer to parser information structure is stored in `info` ; the structure belongs to the parser object and should not be modified. `user_data` is user data passed to enumeration function.

#### Parameters

info | parser info. | [in]
user_data | user data passed to enumeration function. | [in][closure]

#### Returns

`TRUE` on success, otherwise `FALSE`

### MirageEnumWriterInfoCallback ()

    gboolean
    (*MirageEnumWriterInfoCallback) (const MirageWriterInfo *info,
                                     gpointer user_data);

Callback function type used with `mirage_enumerate_writers()`. A pointer to writer information structure is stored in `info` ; the structure belongs to the writer object and should not be modified. `user_data` is user data passed to enumeration function.

#### Parameters

info | writer info. | [in]
user_data | user data passed to enumeration function. | [in][closure]

#### Returns

`TRUE` on success, otherwise `FALSE`

### mirage_create_writer ()

    MirageWriter *
    mirage_create_writer (const gchar *writer_id,
                          GError **error);

Attempts to create an instance of image writer whose ID is `writer_id` .

#### Parameters

writer_id | ID of writer to create. | [in]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

newly-created writer object on success, `NULL` on failure. The reference to the object should be released using `g_object_unref()` when no longer needed.

[transfer full]

### mirage_enumerate_filter_streams ()

    gboolean
    mirage_enumerate_filter_streams (MirageEnumFilterStreamInfoCallback func,
                                     gpointer user_data,
                                     GError **error);

Iterates over list of supported filter streams, calling `func` for each filter stream.

If `func` returns `FALSE`, the function immediately returns `FALSE`.

#### Parameters

func | callback function. | [in][scope call]
user_data | data to be passed to callback function. | [in][closure]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_enumerate_parsers ()

    gboolean
    mirage_enumerate_parsers (MirageEnumParserInfoCallback func,
                              gpointer user_data,
                              GError **error);

Iterates over list of supported parsers, calling `func` for each parser.

If `func` returns `FALSE`, the function immediately returns `FALSE`.

#### Parameters

func | callback function. | [in][scope call]
user_data | data to be passed to callback function. | [in][closure]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_enumerate_writers ()

    gboolean
    mirage_enumerate_writers (MirageEnumWriterInfoCallback func,
                              gpointer user_data,
                              GError **error);

Iterates over list of supported writers, calling `func` for each writers.

If `func` returns `FALSE`, the function immediately returns `FALSE`.

#### Parameters

func | callback function. | [in][scope call]
user_data | data to be passed to callback function. | [in][closure]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_get_filter_streams_info ()

    gboolean
    mirage_get_filter_streams_info (const MirageFilterStreamInfo **info,
                                    gint *num_filter_streams,
                                    GError **error);

Retrieves information structures for supported filter streams.

#### Parameters

info | array of filter streams' information structures. | [out][array length=num_filter_streams][transfer none]
num_filter_streams | number of supported filter streams. | [out]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_get_filter_streams_type ()

    gboolean
    mirage_get_filter_streams_type (const GType **types,
                                    gint *num_filter_streams,
                                    GError **error);

Retrieves GType values for supported filter streams.

#### Parameters

types | array of filter streams' GType values. | [out][array length=num_filter_streams][transfer none]
num_filter_streams | number of supported filter streams. | [out]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_get_parsers_info ()

    gboolean
    mirage_get_parsers_info (const MirageParserInfo **info,
                             gint *num_parsers,
                             GError **error);

Retrieves information structures for supported parsers.

#### Parameters

info | array of parsers' information structures. | [out][array length=num_parsers][transfer none]
num_parsers | number of supported parsers. | [out]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_get_parsers_type ()

    gboolean
    mirage_get_parsers_type (const GType **types,
                             gint *num_parsers,
                             GError **error);

Retrieves GType values for supported parsers.

#### Parameters

types | array of parsers' GType values. | [out][array length=num_parsers][transfer none]
num_parsers | number of supported parsers. | [out]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_get_supported_debug_masks ()

    gboolean
    mirage_get_supported_debug_masks (const MirageDebugMaskInfo **masks,
                                      gint *num_masks,
                                      GError **error);

Retrieves the pointer to array of supported debug masks and stores it in `masks` . The array consists of one or more structures of type MirageDebugMaskInfo. The number of elements in the array is stored in `num_masks` . The array belongs to libMirage and should not be altered or freed.

#### Parameters

masks | location to store pointer to masks array. | [out][transfer none][array length=num_masks]
num_masks | location to store number of elements in masks array. | [out]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_get_writers_info ()

    gboolean
    mirage_get_writers_info (const MirageWriterInfo **info,
                             gint *num_writers,
                             GError **error);

Retrieves information structures for supported parsers.

#### Parameters

info | array of writers' information structures. | [out][array length=num_writers][transfer none]
num_writers | number of supported writers. | [out]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_get_writers_type ()

    gboolean
    mirage_get_writers_type (const GType **types,
                             gint *num_writers,
                             GError **error);

Retrieves GType values for supported writers.

#### Parameters

types | array of writers' GType values. | [out][array length=num_writers][transfer none]
num_writers | number of supported writers. | [out]
error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_initialize ()

    gboolean
    mirage_initialize (GError **error);

Initializes libMirage library. It should be called before any other of libMirage functions.

#### Parameters

error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

### mirage_shutdown ()

    gboolean
    mirage_shutdown (GError **error);

Shuts down libMirage library. It should be called when libMirage is no longer needed.

#### Parameters

error | location to store error, or `NULL`. | [out][allow-none]

#### Returns

`TRUE` on success, `FALSE` on failure

## Types and Values

### MirageDebugMaskInfo

    typedef struct {
        gchar *name;
        gint value;
    } MirageDebugMaskInfo;

Structure containing debug mask information.

#### Members

gchar *`name`; | name |
gint `value`; | value |

## See Also

MirageContext