Chris@1: All libvorbisfile decoding routines are declared in "vorbis/vorbisfile.h".
Chris@1:
Chris@1:
Chris@1: After initialization, decoding audio
Chris@1: is as simple as calling ov_read() (or the
Chris@1: similar functions ov_read_float() and
Chris@1: ov_read_filter). This function works
Chris@1: similarly to reading from a normal file using read().
Chris@1:
Chris@1: However, a few differences are worth noting:
Chris@1:
Chris@1:
multiple stream links
Chris@1:
Chris@1: A Vorbis stream may consist of multiple sections (called links) that
Chris@1: encode differing numbers of channels or sample rates. It is vitally
Chris@1: important to pay attention to the link numbers returned by ov_read and handle audio changes that may
Chris@1: occur at link boundaries. Such multi-section files do exist in the
Chris@1: wild and are not merely a specification curiosity.
Chris@1:
Chris@1:
returned data amount
Chris@1:
Chris@1: ov_read does not attempt to completely fill
Chris@1: a large, passed in data buffer; it merely guarantees that the passed
Chris@1: back data does not overflow the passed in buffer size. Large buffers
Chris@1: may be filled by iteratively looping over calls to ov_read (incrementing the buffer pointer)
Chris@1: until the original buffer is filled.
Chris@1:
Chris@1:
file cursor position
Chris@1:
Chris@1: Vorbis files do not necessarily start at a sample number or time offset
Chris@1: of zero. Do not be surprised if a file begins at a positive offset of
Chris@1: several minutes or hours, such as would happen if a large stream (such
Chris@1: as a concert recording) is chopped into multiple seperate files.
Chris@1:
Chris@1:
This function makes up the main chunk of a decode loop. It takes an
Chris@1: OggVorbis_File structure, which must have been initialized by a previous
Chris@1: call to ov_open(), ov_fopen(),
Chris@1: or ov_open_callbacks().