Top | ![]() |
![]() |
![]() |
![]() |
gboolean | mirage_filter_stream_open () |
void | mirage_filter_stream_generate_info () |
const MirageFilterStreamInfo * | mirage_filter_stream_get_info () |
MirageStream * | mirage_filter_stream_get_underlying_stream () |
void | mirage_filter_stream_info_copy () |
void | mirage_filter_stream_info_free () |
goffset | mirage_filter_stream_simplified_get_position () |
void | mirage_filter_stream_simplified_set_stream_length () |
struct | MirageFilterStream |
struct | MirageFilterStreamClass |
struct | MirageFilterStreamInfo |
MirageFilterStream is a basic unit of file access abstraction used in libMirage. It implements MirageStream interface to perform I/O operations.
When opening a file with libMirage, mirage_context_create_input_stream()
function should be used. It creates a chain of MirageFilterStream objects
on top of a MirageFileStream, and returns the top object on the chain.
This allows transparent access to, for example, compressed data stored
in the file. Alternatively, you can create a MirageFileStream yourself
and open additional MirageFilterStream objects on top of it.
There are two ways to implement a MirageFilterStream. For full control
over the logic for reading from parts and managing position in the
stream, use "full interface", which requires implementation of three
virtual functions: read, seek and tell. The second option is to use
"simplified read interface", which provides framework for stream position
management and reading logic, and requires that filter stream implements
partial_read function. Additionally, it requires that filter stream
implementation sets the file stream size using
mirage_filter_stream_simplified_set_stream_length()
function. In
simplified_partial_read, the current position in the stream, which is
managed by the framework, can be obtained using mirage_filter_stream_simplified_get_position()
.
gboolean mirage_filter_stream_open (MirageFilterStream *self
,MirageStream *stream
,gboolean writable
,GError **error
);
Opens stream on top of provided underlying stream.
void mirage_filter_stream_generate_info (MirageFilterStream *self
,const gchar *id
,const gchar *name
,gboolean writable
,gint num_types
,...
);
Generates filter stream information from the input fields. It is intended as a function for creating filter stream information in filter stream implementations.
const MirageFilterStreamInfo *
mirage_filter_stream_get_info (MirageFilterStream *self
);
Retrieves filter stream information.
MirageStream *
mirage_filter_stream_get_underlying_stream
(MirageFilterStream *self
);
Retrieves filter stream's underlying stream.
void mirage_filter_stream_info_copy (const MirageFilterStreamInfo *info
,MirageFilterStreamInfo *dest
);
Copies parser information from info
to dest
.
info |
a MirageFilterStreamInfo to copy data from. |
[in] |
dest |
a MirageFilterStreamInfo to copy data to. |
[in] |
void
mirage_filter_stream_info_free (MirageFilterStreamInfo *info
);
Frees the allocated fields in info
(but not the structure itself!).
goffset
mirage_filter_stream_simplified_get_position
(MirageFilterStream *self
);
Retrieves position in the stream.
This function is intented for use in filter stream implementations that are based on the simplified interface. It should be used by the implementation's simplified_partial_read function to determine position to read from without having to worry about position management and update.
void mirage_filter_stream_simplified_set_stream_length (MirageFilterStream *self
,gsize length
);
Sets size of the stream.
This function is intented for use in filter stream implementations that are based on the simplified interface. It should be used by the implementation to set the stream size during stream parsing; the set stream size is then used by the read function that is implemented by the simplified interface.
struct MirageFilterStream;
All the fields in the MirageFilterStream structure are private to the MirageFilterStream implementation and should never be accessed directly.
struct MirageFilterStreamClass { MirageObjectClass parent_class; /* Class members */ gboolean (*open) (MirageFilterStream *self, MirageStream *stream, gboolean writable, GError **error); /* Functions implemented for MirageStream: */ gssize (*read) (MirageFilterStream *self, void *buffer, gsize count, GError **error); gssize (*write) (MirageFilterStream *self, const void *buffer, gsize count, GError **error); gboolean (*seek) (MirageFilterStream *self, goffset offset, GSeekType type, GError **error); goffset (*tell) (MirageFilterStream *self); /* Simplified read/write interface */ gssize (*simplified_partial_read) (MirageFilterStream *self, void *buffer, gsize count); gssize (*simplified_partial_write) (MirageFilterStream *self, const void *buffer, gsize count); };
The class structure for the MirageFilterStream type.
opens a filter stream on top underyling stream |
||
reads data from stream |
||
wrties data to stream |
||
seeks to a location within stream |
||
tells the current location within stream |
||
reads a chunk of requested data from stream (part of simplified interface) |
||
writes a chunk of requested data to stream (part of simplified interface) |
struct MirageFilterStreamInfo { gchar *id; gchar *name; gboolean writable; gchar **description; gchar **mime_type; };
A structure containing filter stream information. It can be obtained
with call to mirage_filter_stream_get_info()
.