Chris@1: Chris@1: Chris@1: Chris@1: Vorbisfile - datatype - ov_callbacks Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1:

Vorbisfile documentation

vorbisfile version 1.3.2 - 20101101

Chris@1: Chris@1:

ov_callbacks

Chris@1: Chris@1:

declared in "vorbis/codec.h"

Chris@1: Chris@1:

Chris@1: The ov_callbacks structure contains file manipulation function prototypes necessary for opening, closing, seeking, and location. Chris@1: Chris@1:

Chris@1: The ov_callbacks structure does not need to be user-defined if you are Chris@1: working with stdio-based file manipulation; the ov_fopen() and ov_open() calls internally provide default callbacks for Chris@1: stdio. ov_callbacks are defined and passed to ov_open_callbacks() when Chris@1: implementing non-stdio based stream manipulation (such as playback Chris@1: from a memory buffer) or when ov_open()-style initialization from a FILE * is required under Windows [a]. Chris@1:

Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1:
Chris@1:
typedef struct {
Chris@1:   size_t (*read_func)  (void *ptr, size_t size, size_t nmemb, void *datasource);
Chris@1:   int    (*seek_func)  (void *datasource, ogg_int64_t offset, int whence);
Chris@1:   int    (*close_func) (void *datasource);
Chris@1:   long   (*tell_func)  (void *datasource);
Chris@1: } ov_callbacks;
Chris@1:
Chris@1: Chris@1:

Relevant Struct Members

Chris@1:
Chris@1:
read_func
Chris@1:
Pointer to custom data reading function.
Chris@1:
seek_func
Chris@1:
Pointer to custom data seeking function. If the data source is not seekable (or the application wants the data source to be treated as unseekable at all times), the provided seek callback should always return -1 (failure) or the seek_func and tell_func fields should be set to NULL.
Chris@1:
close_func
Chris@1:
Pointer to custom data source closure function. Set to NULL if libvorbisfile should not attempt to automatically close the file/data handle.
Chris@1:
tell_func
Chris@1:
Pointer to custom data location function. If the data source is not seekable (or the application wants the data source to be treated as unseekable at all times), the provided tell callback should always return -1 (failure) or the seek_func and tell_func fields should be set to NULL.
Chris@1:
Chris@1: Chris@1:

Chris@1: Chris@1:

Predefined callbacks

Chris@1: The header vorbis/vorbisfile.h provides several predefined static ov_callbacks structures that may be passed to ov_open_callbacks(): Chris@1:
Chris@1:
OV_CALLBACKS_DEFAULT
Chris@1: Chris@1: These callbacks provide the same behavior as used internally by ov_fopen() and ov_open(). Chris@1: Chris@1:
OV_CALLBACKS_NOCLOSE
Chris@1: Chris@1: The same as OV_CALLBACKS_DEFAULT, but with the Chris@1: close_func field set to NULL. The most typical use would be Chris@1: to use ov_open_callbacks() to Chris@1: provide the same behavior as ov_open(), but Chris@1: not close the file/data handle in ov_clear(). Chris@1: Chris@1:
OV_CALLBACKS_STREAMONLY
Chris@1: Chris@1: A set of callbacks that set seek_func and tell_func Chris@1: to NULL, thus forcing strict streaming-only behavior regardless of Chris@1: whether or not the input is actually seekable. Chris@1: Chris@1:
OV_CALLBACKS_STREAMONLY_NOCLOSE
Chris@1: Chris@1: The same as OV_CALLBACKS_STREAMONLY, but with Chris@1: close_func also set to null, preventing libvorbisfile from Chris@1: attempting to close the file/data handle in ov_clear(). Chris@1: Chris@1:
Chris@1:

Chris@1: Chris@1:

Examples and usage

Chris@1: Chris@1: See the callbacks and non-stdio I/O document for more Chris@1: detailed information on required behavior of the various callback Chris@1: functions.

Chris@1: Chris@1:

Chris@1:


Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1: Chris@1:

copyright © 2000-2010 Xiph.Org

Ogg Vorbis

Vorbisfile documentation

vorbisfile version 1.3.2 - 20101101

Chris@1: Chris@1: Chris@1: Chris@1: