Main Page | Modules | Directories | File List | Globals

oggz_io.h File Reference


Detailed Description

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().

Note:
Opening a file with oggz_open() or oggz_open_stdio() is equivalent to calling oggz_new() and setting stdio based functions for data IO.

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.
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.
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.
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.
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.

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.
void * oggz_io_get_read_user_handle (OGGZ *oggz)
 Retrieve the user_handle associated with the function you have provided for reading input data.
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.
void * oggz_io_get_write_user_handle (OGGZ *oggz)
 Retrieve the user_handle associated with the function you have provided for writing output data.
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.
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.
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).
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.
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.
void * oggz_io_get_flush_user_handle (OGGZ *oggz)
 Retrieve the user_handle associated with the function you have provided for flushing output.


Typedef Documentation

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.

Parameters:
user_handle A generic pointer you have provided earlier
Return values:
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.

Parameters:
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
Return values:
> 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.

Parameters:
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)
Return values:
>= 0 The offset seeked to
< 0 An error condition
Note:
If you provide an OggzIOSeek function, you MUST also provide an OggzIOTell function, or else all your seeks will fail.

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.

Parameters:
user_handle A generic pointer you have provided earlier
Return values:
>= 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.

Parameters:
user_handle A generic pointer you have provided earlier
n The length in bytes of the data
buf A buffer containing data to write
Return values:
>= 0 The number of bytes successfully written (may be less than n if a write error has occurred)
< 0 An error condition


Function Documentation

void* oggz_io_get_flush_user_handle OGGZ oggz  ) 
 

Retrieve the user_handle associated with the function you have provided for flushing output.

Parameters:
oggz An OGGZ handle
Returns:
the associated user_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.

Parameters:
oggz An OGGZ handle
Returns:
the associated user_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.

Parameters:
oggz An OGGZ handle
Returns:
the associated user_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.

Parameters:
oggz An OGGZ handle
Returns:
the associated user_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.

Parameters:
oggz An OGGZ handle
Returns:
the associated user_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.

Parameters:
oggz An OGGZ handle
flush Your flushing function
user_handle Any arbitrary data you wish to pass to the function
Return values:
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.

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.

Parameters:
oggz An OGGZ handle
read Your reading function
user_handle Any arbitrary data you wish to pass to the function
Return values:
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.

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.

Parameters:
oggz An OGGZ handle
seek Your seeking function
user_handle Any arbitrary data you wish to pass to the function
Return values:
0 Success
OGGZ_ERR_BAD_OGGZ oggz does not refer to an existing OGGZ
OGGZ_ERR_INVALID Operation not suitable for this OGGZ
Note:
If you provide an OggzIOSeek function, you MUST also provide an OggzIOTell function, or else all your seeks will fail.

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).

Parameters:
oggz An OGGZ handle
tell Your tell function
user_handle Any arbitrary data you wish to pass to the function
Return values:
0 Success
OGGZ_ERR_BAD_OGGZ oggz does not refer to an existing OGGZ
OGGZ_ERR_INVALID Operation not suitable for this OGGZ

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.

Parameters:
oggz An OGGZ handle
write Your writing function
user_handle Any arbitrary data you wish to pass to the function
Return values:
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.


Generated on Mon Feb 14 18:00:07 2005 for liboggz by  doxygen 1.4.0