Tremor - Setup/Teardown

Tremor documentation | Tremor version 1.0 - 20020403

# Setup/Teardown

In order to decode audio using libvorbisidec, a bitstream containing Vorbis audio must be properly initialized before decoding and cleared when decoding is finished. The simplest possible case is to use `fopen()` to open a Vorbis file and then pass the `FILE *` to an ov_open() call. A successful return code from ov_open() indicates the file is ready for use. Once the file is no longer needed, ov_clear() is used to close the file and deallocate decoding resources. Do not call `fclose()` on the file; libvorbisidec does this in the ov_clear() call.

All libvorbisidec initialization and deallocation routines are declared in "ivorbisfile.h".

function | purpose
ov_open | Initializes the Ogg Vorbis bitstream with a pointer to a bitstream and default values. This must be called before other functions in the library may be used.
ov_open_callbacks | Initializes the Ogg Vorbis bitstream with a pointer to a bitstream, default values, and custom file/bitstream manipulation routines. Used instead of ov_open() when working with other than stdio based I/O.
ov_test | Partially opens a file just far enough to determine if the file is an Ogg Vorbis file or not. A successful return indicates that the file appears to be an Ogg Vorbis file, but the OggVorbis_File struct is not yet fully initialized for actual decoding. After a successful return, the file may be closed using ov_clear() or fully opened for decoding using ov_test_open(). This call is intended to be used as a less expensive file open test than a full ov_open(). Note that libvorbisidec owns the passed in file resource is it returns success; do not `fclose()` files owned by libvorbisidec.
ov_test_callbacks | As above but allowing application-define I/O callbacks. Note that libvorbisidec owns the passed in file resource is it returns success; do not `fclose()` files owned by libvorbisidec.
ov_test_open | Finish opening a file after a successful call to ov_test() or ov_test_callbacks().
ov_clear | Closes the bitstream and cleans up loose ends. Must be called when finished with the bitstream. After return, the OggVorbis_File struct is invalid and may not be used before being initialized again before begin reinitialized.

copyright © 2002 Xiph.org | Ogg Vorbis
Tremor documentation | Tremor version 1.0 - 20020403