This is the simplest function used to open and initialize an OggVorbis_File
Chris@1: structure. It sets up all the related decoding structure.
Chris@1:
The first argument is a file path suitable
Chris@1: for passing to fopen(). vf should be a pointer to an empty
Chris@1: OggVorbis_File structure -- this is used for ALL the externally visible
Chris@1: libvorbisfile functions. Once this has been called, the same OggVorbis_File struct should be passed
Chris@1: to all the libvorbisfile functions.
Chris@1:
The vf structure initialized using ov_fopen() must
Chris@1: eventually be cleaned using ov_clear().
Chris@1:
Chris@1:
Chris@1: It is often useful to call ov_fopen() simply to determine
Chris@1: whether a given file is a Vorbis bitstream. If the ov_fopen()
Chris@1: call fails, then the file is either inaccessable (errno is set) or not
Chris@1: recognizable as Vorbis (errno unchanged). If the call succeeds but
Chris@1: the initialized vf structure will not be used, the
Chris@1: application is responsible for calling ov_clear() to clear the decoder's buffers and
Chris@1: close the file.
Chris@1:
Chris@1:
Chris@1:
Chris@1:
Chris@1:
Chris@1:
Chris@1: int ov_fopen(char *path,OggVorbis_File *vf);
Chris@1:
Chris@1:
Chris@1:
Chris@1:
Chris@1:
Chris@1:
Parameters
Chris@1:
Chris@1:
path
Chris@1:
Null terminated string containing a file path suitable for passing to fopen().
Chris@1:
Chris@1:
vf
Chris@1:
A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile
Chris@1: functions. Once this has been called, the same OggVorbis_File
Chris@1: struct should be passed to all the libvorbisfile functions.
Chris@1:
Chris@1:
Chris@1:
Chris@1:
Return Values
Chris@1:
Chris@1:
0 indicates success
Chris@1:
Chris@1:
less than zero for failure:
Chris@1:
Chris@1:
OV_EREAD - A read from media returned an error.
Chris@1:
OV_ENOTVORBIS - Bitstream does not contain any Vorbis data.
Chris@1:
OV_EVERSION - Vorbis version mismatch.
Chris@1:
OV_EBADHEADER - Invalid Vorbis bitstream header.
Chris@1:
OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.
Chris@1:
Chris@1:
Chris@1:
Chris@1:
Chris@1:
Notes
Chris@1:
Chris@1:
Chris@1:
[a] Threaded decode
Chris@1:
If your decoder is threaded, it is recommended that you NOT call
Chris@1: ov_open_callbacks()
Chris@1: in the main control thread--instead, call ov_open_callbacks() in your decode/playback
Chris@1: thread. This is important because ov_open_callbacks() may be a fairly time-consuming
Chris@1: call, given that the full structure of the file is determined at this point,
Chris@1: which may require reading large parts of the file under certain circumstances
Chris@1: (determining all the logical bitstreams in one physical bitstream, for
Chris@1: example). See Thread Safety for other information on using libvorbisfile with threads.
Chris@1:
Chris@1:
Chris@1:
[b] Mixed media streams
Chris@1:
Chris@1: As of Vorbisfile release 1.2.0, Vorbisfile is able to access the
Chris@1: Vorbis content in mixed-media Ogg streams, not just Vorbis-only
Chris@1: streams. For example, Vorbisfile may be used to open and access the
Chris@1: audio from an Ogg stream consisting of Theora video and Vorbis audio.
Chris@1: Vorbisfile 1.2.0 decodes the first logical audio stream of each
Chris@1: physical stream section.
Chris@1:
Chris@1:
[c] Faster testing for Vorbis files
Chris@1:
ov_test() and ov_test_callbacks() provide less
Chris@1: computationally expensive ways to test a file for Vorbisness, but
Chris@1: require more setup code.