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