Vorbisfile documentation | vorbisfile version 1.68 - 20030307

# ov_pcm_seek_page_lap

declared in "vorbis/vorbisfile.h";

Seeks to the closest page preceding the specified location (in pcm samples) within the physical bitstream. This variant of ov_pcm_seek_page also automatically crosslaps the transition from the previous playback position into the new playback position in order to eliminate clicking and boundary discontinuities. Otherwise, usage and behavior is identical to ov_pcm_seek_page.

This function is faster than ov_pcm_seek_lap because the function can begin decoding at a page boundary rather than seeking through any remaining samples before the specified location. However, it is less accurate.

ov_pcm_seek_page_lap also updates everything needed within the decoder, so you can immediately call ov_read() and get data from the newly seeked to position.

ov_pcm_seek_page_lap will lap between logical stream links of differing numbers of channels. Any extra channels from the origin of the seek are ignored; playback of these channels simply ends. Extra channels at the destination are lapped from silence. ov_pcm_seek_page_lap will also lap between logical stream links of differing sample rates. In this case, the sample rates are ignored (no implicit resampling is done to match playback). It is up to the application developer to decide if this behavior makes any sense in a given context; in practical use, these default behaviors perform sensibly.

This function only works for seekable streams.

    int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos);

### Parameters

vf
  A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile functions.
pos
  Position in pcm samples to seek to in the bitstream.

### Return Values

> - 0 for success
> - nonzero indicates failure, described by several error codes:
>   - OV_ENOSEEK - Bitstream is not seekable.
>   - OV_EINVAL - Invalid argument value; possibly called with an OggVorbis_File structure that isn't open.
>   - OV_EREAD - A read from media returned an error.
>   - OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.
>   - OV_EOF - Indicates stream is at end of file immediately after a seek (making crosslap impossible as there's no preceeding decode state to crosslap).
>   - OV_EBADLINK - Invalid stream section supplied to libvorbisfile, or the requested link is corrupt.

copyright © 2003 Xiph.org | Ogg Vorbis
Vorbisfile documentation | vorbisfile version 1.68 - 20030307