|
Packit |
06404a |
<html>
|
|
Packit |
06404a |
|
|
Packit |
06404a |
<head>
|
|
Packit |
06404a |
<title>Vorbisfile - function - ov_open_callbacks</title>
|
|
Packit |
06404a |
<link rel=stylesheet href="style.css" type="text/css">
|
|
Packit |
06404a |
</head>
|
|
Packit |
06404a |
|
|
Packit |
06404a |
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
Vorbisfile documentation
|
|
Packit |
06404a |
vorbisfile version 1.3.2 - 20101101
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
ov_open_callbacks
|
|
Packit |
06404a |
|
|
Packit |
06404a |
declared in "vorbis/vorbisfile.h";
|
|
Packit |
06404a |
|
|
Packit |
06404a |
This is an alternative function used to open and initialize an
|
|
Packit |
06404a |
OggVorbis_File structure when using a data source other than a file,
|
|
Packit |
06404a |
when its necessary to modify default file access behavior, or to
|
|
Packit |
06404a |
initialize a Vorbis decode from a <tt>FILE *</tt> pointer under
|
|
Packit |
06404a |
Windows where ov_open() cannot be used. It
|
|
Packit |
06404a |
allows the application to specify custom file manipulation routines
|
|
Packit |
06404a |
and sets up all the related decoding structures.
|
|
Packit |
06404a |
|
|
Packit |
06404a |
Once ov_open_callbacks() has been called, the same
|
|
Packit |
06404a |
<tt>OggVorbis_File</tt> struct should be passed to all the
|
|
Packit |
06404a |
libvorbisfile functions. Unlike
|
|
Packit |
06404a |
href="ov_fopen.html">ov_fopen() and
|
|
Packit |
06404a |
href="ov_open.html">ov_open(), ov_open_callbacks() may be used to
|
|
Packit |
06404a |
instruct vorbisfile to either automatically close or not to close the
|
|
Packit |
06404a |
file/data access handle in ov_clear().
|
|
Packit |
06404a |
Automatic closure is disabled by passing NULL as the close callback,
|
|
Packit |
06404a |
or using one of the predefined callback sets that specify a NULL close
|
|
Packit |
06404a |
callback. The application is responsible for closing a file when a
|
|
Packit |
06404a |
call to ov_open_callbacks() is unsuccessful.
|
|
Packit |
06404a |
|
|
Packit |
06404a |
See also Callbacks and Non-stdio I/O for
|
|
Packit |
06404a |
information on designing and specifying custom callback functions.
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
int ov_open_callbacks(void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks);
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
Parameters
|
|
Packit |
06404a |
|
|
Packit |
06404a |
datasource
|
|
Packit |
06404a |
Pointer to a data structure allocated by the calling application, containing any state needed by the callbacks provided.
|
|
Packit |
06404a |
vf
|
|
Packit |
06404a |
A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile
|
|
Packit |
06404a |
functions. Once this has been called, the same <tt>OggVorbis_File</tt>
|
|
Packit |
06404a |
struct should be passed to all the libvorbisfile functions.
|
|
Packit |
06404a |
initial
|
|
Packit |
06404a |
Typically set to NULL. This parameter is useful if some data has already been
|
|
Packit |
06404a |
read from the stream and the stream is not seekable. It is used in conjunction with <tt>ibytes</tt>. In this case, <tt>initial</tt>
|
|
Packit |
06404a |
should be a pointer to a buffer containing the data read.
|
|
Packit |
06404a |
ibytes
|
|
Packit |
06404a |
Typically set to 0. This parameter is useful if some data has already been
|
|
Packit |
06404a |
read from the stream and the stream is not seekable. In this case, <tt>ibytes</tt>
|
|
Packit |
06404a |
should contain the length (in bytes) of the buffer. Used together with <tt>initial</tt>.
|
|
Packit |
06404a |
callbacks
|
|
Packit |
06404a |
A completed ov_callbacks struct which indicates desired custom file manipulation routines. vorbisfile.h defines several preprovided callback sets; see ov_callbacks for details.
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
Return Values
|
|
Packit |
06404a |
|
|
Packit |
06404a |
0 for success
|
|
Packit |
06404a |
less than zero for failure:
|
|
Packit |
06404a |
|
|
Packit |
06404a |
OV_EREAD - A read from media returned an error.
|
|
Packit |
06404a |
OV_ENOTVORBIS - Bitstream does not contain any Vorbis data.
|
|
Packit |
06404a |
OV_EVERSION - Vorbis version mismatch.
|
|
Packit |
06404a |
OV_EBADHEADER - Invalid Vorbis bitstream header.
|
|
Packit |
06404a |
OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
Notes
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
[a] Windows and use as an ov_open() substitute Windows
|
|
Packit |
06404a |
applications should not use ov_open() due
|
|
Packit |
06404a |
to the likelihood of CRT linking
|
|
Packit |
06404a |
mismatches and runtime protection faults
|
|
Packit |
06404a |
[ov_open:a]. ov_open_callbacks() is a safe substitute; specifically:
|
|
Packit |
06404a |
|
|
Packit |
06404a |
<tt>ov_open_callbacks(f, vf, initial, ibytes, OV_CALLBACKS_DEFAULT);</tt>
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
... provides exactly the same functionality as
|
|
Packit |
06404a |
href="ov_open.html">ov_open() but will always work correctly under
|
|
Packit |
06404a |
Windows, regardless of linking setup details.
|
|
Packit |
06404a |
|
|
Packit |
06404a |
[b] Threaded decode
|
|
Packit |
06404a |
If your decoder is threaded, it is recommended that you NOT call
|
|
Packit |
06404a |
<tt>ov_open_callbacks()</tt>
|
|
Packit |
06404a |
in the main control thread--instead, call <tt>ov_open_callbacks()</tt> in your decode/playback
|
|
Packit |
06404a |
thread. This is important because <tt>ov_open_callbacks()</tt> may be a fairly time-consuming
|
|
Packit |
06404a |
call, given that the full structure of the file is determined at this point,
|
|
Packit |
06404a |
which may require reading large parts of the file under certain circumstances
|
|
Packit |
06404a |
(determining all the logical bitstreams in one physical bitstream, for
|
|
Packit |
06404a |
example). See Thread Safety for other information on using libvorbisfile with threads.
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
[c] Mixed media streams
|
|
Packit |
06404a |
|
|
Packit |
06404a |
As of Vorbisfile release 1.2.0, Vorbisfile is able to access the
|
|
Packit |
06404a |
Vorbis content in mixed-media Ogg streams, not just Vorbis-only
|
|
Packit |
06404a |
streams. For example, Vorbisfile may be used to open and access the
|
|
Packit |
06404a |
audio from an Ogg stream consisting of Theora video and Vorbis audio.
|
|
Packit |
06404a |
Vorbisfile 1.2.0 decodes the first logical audio stream of each
|
|
Packit |
06404a |
physical stream section.
|
|
Packit |
06404a |
|
|
Packit |
06404a |
[d] Faster testing for Vorbis files
|
|
Packit |
06404a |
ov_test() and
|
|
Packit |
06404a |
href="ov_test_callbacks.html">ov_test_callbacks() provide less
|
|
Packit |
06404a |
computationally expensive ways to test a file for Vorbisness, but
|
|
Packit |
06404a |
require more setup code.
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
copyright © 2000-2010 Xiph.Org
|
|
Packit |
06404a |
Ogg Vorbis
|
|
Packit |
06404a |
|
|
Packit |
06404a |
Vorbisfile documentation
|
|
Packit |
06404a |
vorbisfile version 1.3.2 - 20101101
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
|
|
Packit |
06404a |
</body>
|
|
Packit |
06404a |
|
|
Packit |
06404a |
</html>
|