liboggz
1.1.1
|
Overriding the functions used for input and output of raw data. More...
Go to the source code of this file.
Typedefs | |
typedef size_t(* | OggzIORead )(void *user_handle, void *buf, size_t n) |
This is the signature of a function which you provide for Oggz to call when it needs to acquire raw input data. More... | |
typedef size_t(* | OggzIOWrite )(void *user_handle, void *buf, size_t n) |
This is the signature of a function which you provide for Oggz to call when it needs to output raw data. More... | |
typedef int(* | OggzIOSeek )(void *user_handle, long offset, int whence) |
This is the signature of a function which you provide for Oggz to call when it needs to seek on the raw input or output data. More... | |
typedef long(* | OggzIOTell )(void *user_handle) |
This is the signature of a function which you provide for Oggz to call when it needs to determine the current offset of the raw input or output data. More... | |
typedef int(* | OggzIOFlush )(void *user_handle) |
This is the signature of a function which you provide for Oggz to call when it needs to flush the output data. More... | |
Functions | |
int | oggz_io_set_read (OGGZ *oggz, OggzIORead read, void *user_handle) |
Set a function for Oggz to call when it needs to read input data. More... | |
void * | oggz_io_get_read_user_handle (OGGZ *oggz) |
Retrieve the user_handle associated with the function you have provided for reading input data. More... | |
int | oggz_io_set_write (OGGZ *oggz, OggzIOWrite write, void *user_handle) |
Set a function for Oggz to call when it needs to write output data. More... | |
void * | oggz_io_get_write_user_handle (OGGZ *oggz) |
Retrieve the user_handle associated with the function you have provided for writing output data. More... | |
int | oggz_io_set_seek (OGGZ *oggz, OggzIOSeek seek, void *user_handle) |
Set a function for Oggz to call when it needs to seek on its raw data. More... | |
void * | oggz_io_get_seek_user_handle (OGGZ *oggz) |
Retrieve the user_handle associated with the function you have provided for seeking on input or output data. More... | |
int | oggz_io_set_tell (OGGZ *oggz, OggzIOTell tell, void *user_handle) |
Set a function for Oggz to call when it needs to determine the offset within its input data (if OGGZ_READ) or output data (if OGGZ_WRITE). More... | |
void * | oggz_io_get_tell_user_handle (OGGZ *oggz) |
Retrieve the user_handle associated with the function you have provided for determining the current offset in input or output data. More... | |
int | oggz_io_set_flush (OGGZ *oggz, OggzIOFlush flush, void *user_handle) |
Set a function for Oggz to call when it needs to flush its output. More... | |
void * | oggz_io_get_flush_user_handle (OGGZ *oggz) |
Retrieve the user_handle associated with the function you have provided for flushing output. More... | |
Overriding the functions used for input and output of raw data.
OggzIO provides a way of overriding the functions Oggz uses to access its raw input or output data. This is required in many situations where the raw stream cannot be accessed via stdio, but can be accessed by other means. This is typically useful within media frameworks, where accessing and moving around in the data is possible only using methods provided by the framework.
The functions you provide for overriding IO will be used by Oggz whenever you call oggz_read() or oggz_write(). They will also be used repeatedly by Oggz when you call oggz_seek().
typedef int(* OggzIOFlush)(void *user_handle) |
This is the signature of a function which you provide for Oggz to call when it needs to flush the output data.
The behaviour of this function is similar to that of fflush() in stdio.
user_handle | A generic pointer you have provided earlier |
0 | Success |
< 0 | An error condition |
typedef size_t(* OggzIORead)(void *user_handle, void *buf, size_t n) |
This is the signature of a function which you provide for Oggz to call when it needs to acquire raw input data.
user_handle | A generic pointer you have provided earlier |
n | The length in bytes that Oggz wants to read |
buf | The buffer that you read data into |
> 0 | The number of bytes successfully read into the buffer |
0 | to indicate that there is no more data to read (End of file) |
< 0 | An error condition |
typedef int(* OggzIOSeek)(void *user_handle, long offset, int whence) |
This is the signature of a function which you provide for Oggz to call when it needs to seek on the raw input or output data.
user_handle | A generic pointer you have provided earlier |
offset | The offset in bytes to seek to |
whence | SEEK_SET, SEEK_CUR or SEEK_END (as for stdio.h) |
>= 0 | The offset seeked to |
< 0 | An error condition |
typedef long(* OggzIOTell)(void *user_handle) |
This is the signature of a function which you provide for Oggz to call when it needs to determine the current offset of the raw input or output data.
user_handle | A generic pointer you have provided earlier |
>= 0 | The offset |
< 0 | An error condition |
typedef size_t(* OggzIOWrite)(void *user_handle, void *buf, size_t n) |
This is the signature of a function which you provide for Oggz to call when it needs to output raw data.
user_handle | A generic pointer you have provided earlier |
n | The length in bytes of the data |
buf | A buffer containing data to write |
>= 0 | The number of bytes successfully written (may be less than n if a write error has occurred) |
< 0 | An error condition |
void* oggz_io_get_flush_user_handle | ( | OGGZ * | oggz | ) |
Retrieve the user_handle associated with the function you have provided for flushing output.
oggz | An OGGZ handle |
void* oggz_io_get_read_user_handle | ( | OGGZ * | oggz | ) |
Retrieve the user_handle associated with the function you have provided for reading input data.
oggz | An OGGZ handle |
void* oggz_io_get_seek_user_handle | ( | OGGZ * | oggz | ) |
Retrieve the user_handle associated with the function you have provided for seeking on input or output data.
oggz | An OGGZ handle |
void* oggz_io_get_tell_user_handle | ( | OGGZ * | oggz | ) |
Retrieve the user_handle associated with the function you have provided for determining the current offset in input or output data.
oggz | An OGGZ handle |
void* oggz_io_get_write_user_handle | ( | OGGZ * | oggz | ) |
Retrieve the user_handle associated with the function you have provided for writing output data.
oggz | An OGGZ handle |
int oggz_io_set_flush | ( | OGGZ * | oggz, |
OggzIOFlush | flush, | ||
void * | user_handle | ||
) |
Set a function for Oggz to call when it needs to flush its output.
The meaning of this is similar to that of fflush() in stdio.
oggz | An OGGZ handle |
flush | Your flushing function |
user_handle | Any arbitrary data you wish to pass to the function |
0 | Success |
OGGZ_ERR_BAD_OGGZ | oggz does not refer to an existing OGGZ |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ; oggz not open for writing. |
OGGZ_ERR_OUT_OF_MEMORY | Out of memory |
int oggz_io_set_read | ( | OGGZ * | oggz, |
OggzIORead | read, | ||
void * | user_handle | ||
) |
Set a function for Oggz to call when it needs to read input data.
oggz | An OGGZ handle |
read | Your reading function |
user_handle | Any arbitrary data you wish to pass to the function |
0 | Success |
OGGZ_ERR_BAD_OGGZ | oggz does not refer to an existing OGGZ |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ; oggz not open for reading. |
OGGZ_ERR_OUT_OF_MEMORY | Out of memory |
int oggz_io_set_seek | ( | OGGZ * | oggz, |
OggzIOSeek | seek, | ||
void * | user_handle | ||
) |
Set a function for Oggz to call when it needs to seek on its raw data.
oggz | An OGGZ handle |
seek | Your seeking function |
user_handle | Any arbitrary data you wish to pass to the function |
0 | Success |
OGGZ_ERR_BAD_OGGZ | oggz does not refer to an existing OGGZ |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ |
OGGZ_ERR_OUT_OF_MEMORY | Out of memory |
int oggz_io_set_tell | ( | OGGZ * | oggz, |
OggzIOTell | tell, | ||
void * | user_handle | ||
) |
Set a function for Oggz to call when it needs to determine the offset within its input data (if OGGZ_READ) or output data (if OGGZ_WRITE).
oggz | An OGGZ handle |
tell | Your tell function |
user_handle | Any arbitrary data you wish to pass to the function |
0 | Success |
OGGZ_ERR_BAD_OGGZ | oggz does not refer to an existing OGGZ |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ |
OGGZ_ERR_OUT_OF_MEMORY | Out of memory |
int oggz_io_set_write | ( | OGGZ * | oggz, |
OggzIOWrite | write, | ||
void * | user_handle | ||
) |
Set a function for Oggz to call when it needs to write output data.
oggz | An OGGZ handle |
write | Your writing function |
user_handle | Any arbitrary data you wish to pass to the function |
0 | Success |
OGGZ_ERR_BAD_OGGZ | oggz does not refer to an existing OGGZ |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ; oggz not open for writing. |
OGGZ_ERR_OUT_OF_MEMORY | Out of memory |