Vorbisfile documentation | vorbisfile version 1.2.0 - 20070723

# Seeking

Seeking functions allow you to specify a specific point in the stream to begin or continue decoding.

All libvorbisfile seeking routines are declared in "vorbis/vorbisfile.h".

Certain seeking functions are best suited to different situations. When speed is important and exact positioning isn't required, page-level seeking should be used. Note also that Vorbis files do not necessarily start at a sample number or time offset of zero. Do not be surprised if a file begins at a positive offset of several minutes or hours, such as would happen if a large stream (such as a concert recording) is chopped into multiple separate files. Requesting to seek to a position before the beginning of such a file will seek to the position where audio begins.

As of vorbisfile version 1.68, seeking also optionally provides automatic crosslapping to eliminate clicks and other discontinuity artifacts at seeking boundaries. This fetaure is of particular interest to player and game developers implementing dynamic music and audio engines, or others looking for smooth transitions within a single sample or across multiple samples.

Naturally, seeking is available only within a seekable file or stream. Seeking functions will return `OV_ENOSEEK` on nonseekable files and streams.

function | purpose
ov_raw_seek | This function seeks to a position specified in the compressed bitstream, specified in bytes.
ov_pcm_seek | This function seeks to a specific audio sample number, specified in pcm samples.
ov_pcm_seek_page | This function seeks to the closest page preceding the specified audio sample number, specified in pcm samples.
ov_time_seek | This function seeks to the specific time location in the bitstream, specified in seconds
ov_time_seek_page | This function seeks to the closest page preceding the specified time position in the bitstream
ov_raw_seek_lap | This function seeks to a position specified in the compressed bitstream, specified in bytes. The boundary between the old and new playback positions is crosslapped to eliminate discontinuities.
ov_pcm_seek_lap | This function seeks to a specific audio sample number, specified in pcm samples. The boundary between the old and new playback positions is crosslapped to eliminate discontinuities.
ov_pcm_seek_page_lap | This function seeks to the closest page preceding the specified audio sample number, specified in pcm samples. The boundary between the old and new playback positions is crosslapped to eliminate discontinuities.
ov_time_seek_lap | This function seeks to the specific time location in the bitstream, specified in seconds. The boundary between the old and new playback positions is crosslapped to eliminate discontinuities.
ov_time_seek_page_lap | This function seeks to the closest page preceding the specified time position in the bitstream. The boundary between the old and new playback positions is crosslapped to eliminate discontinuities.

copyright © 2007 Xiph.org | Ogg Vorbis
Vorbisfile documentation | vorbisfile version 1.2.0 - 20070723