Vorbisfile documentation

vorbisfile version 1.3.2 - 20101101


declared in "vorbis/vorbisfile.h";

This is the main function used to decode a Vorbis file within a loop. It returns up to the specified number of bytes of decoded PCM audio in the requested endianness, signedness, and word size. If the audio is multichannel, the channels are interleaved in the output buffer. If the passed in buffer is large, ov_read() will not fill it; the passed in buffer size is treated as a limit and not a request.

The output channels are in stream order and not remapped. Vorbis I defines channel order as follows:

Note that up to this point, the Vorbisfile API could more or less hide the multiple logical bitstream nature of chaining from the toplevel application if the toplevel application didn't particularly care. However, when reading audio back, the application must be aware that multiple bitstream sections do not necessarily use the same number of channels or sampling rate.

ov_read() passes back the index of the sequential logical bitstream currently being decoded (in *bitstream) along with the PCM data in order that the toplevel application can handle channel and/or sample rate changes. This number will be incremented at chaining boundaries even for non-seekable streams. For seekable streams, it represents the actual chaining index within the physical bitstream.

long ov_read(OggVorbis_File *vf, char *buffer, int length, int bigendianp, int word, int sgned, int *bitstream);


A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile functions.
A pointer to an output buffer. The decoded output is inserted into this buffer.
Number of bytes to be read into the buffer. Should be the same size as the buffer. A typical value is 4096.
Specifies big or little endian byte packing. 0 for little endian, 1 for b ig endian. Typical value is 0.
Specifies word size. Possible arguments are 1 for 8-bit samples, or 2 or 16-bit samples. Typical value is 2.
Signed or unsigned data. 0 for unsigned, 1 for signed. Typically 1.
A pointer to the number of the current logical bitstream.

Return Values

indicates there was an interruption in the data.
(one of: garbage between pages, loss of sync followed by recapture, or a corrupt page)
indicates that an invalid stream section was supplied to libvorbisfile, or the requested link is corrupt.
indicates the initial file headers couldn't be read or are corrupt, or that the initial open call for vf failed.
indicates EOF
indicates actual number of bytes read. ov_read() will decode at most one vorbis packet per invocation, so the value returned will generally be less than length.


Typical usage:

bytes_read = ov_read(&vf, buffer, 4096,0,2,1,&current_section)
This reads up to 4096 bytes into a buffer, with signed 16-bit little-endian samples.

copyright © 2000-2010 Xiph.Org

Ogg Vorbis

Vorbisfile documentation

vorbisfile version 1.3.2 - 20101101