[xiph-cvs] cvs commit: Tremor/doc OggVorbis_File.html build.html callbacks.html datastructures.html decoding.html diff.html example.html fileinfo.html index.html initialization.html ov_bitrate.html ov_bitrate_instant.html ov_callbacks.html ov_clear.html ov_comment.html ov_info.html ov_open.html ov_open_callbacks.html ov_pcm_seek.html ov_pcm_seek_page.html ov_pcm_tell.html ov_pcm_total.html ov_raw_seek.html ov_raw_tell.html ov_raw_total.html ov_read.html ov_seekable.html ov_serialnumber.html ov_streams.html ov_test.html ov_test_callbacks.html ov_test_open.html ov_time_seek.html ov_time_seek_page.html ov_time_tell.html ov_time_total.html overview.html reference.html return.html seeking.html style.css threads.html vorbis_comment.html vorbis_info.html
Monty
xiphmont at xiph.org
Mon Sep 2 15:17:24 PDT 2002
xiphmont 02/09/02 18:17:24
Added: doc OggVorbis_File.html build.html callbacks.html
datastructures.html decoding.html diff.html
example.html fileinfo.html index.html
initialization.html ov_bitrate.html
ov_bitrate_instant.html ov_callbacks.html
ov_clear.html ov_comment.html ov_info.html
ov_open.html ov_open_callbacks.html
ov_pcm_seek.html ov_pcm_seek_page.html
ov_pcm_tell.html ov_pcm_total.html ov_raw_seek.html
ov_raw_tell.html ov_raw_total.html ov_read.html
ov_seekable.html ov_serialnumber.html
ov_streams.html ov_test.html ov_test_callbacks.html
ov_test_open.html ov_time_seek.html
ov_time_seek_page.html ov_time_tell.html
ov_time_total.html overview.html reference.html
return.html seeking.html style.css threads.html
vorbis_comment.html vorbis_info.html
Log:
Add Tremor docs to CVS
Revision Changes Path
1.1 Tremor/doc/OggVorbis_File.html
Index: OggVorbis_File.html
===================================================================
<html>
<head>
<title>Tremor - datatype - OggVorbis_File</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>OggVorbis_File</h1>
<p><i>declared in "ivorbisfile.h"</i></p>
<p>
The OggVorbis_File structure defines an Ogg Vorbis file.
<p>
This structure is used in all libvorbisidec routines. Before it can be used,
it must be initialized by ov_open() or <a
href="ov_open_callbacks.html">ov_open_callbacks()</a>.
<p>
After use, the OggVorbis_File structure must be deallocated with a
call to ov_clear().
<p>
Once a file or data source is opened successfully by libvorbisidec
(using ov_open() or <a
href="ov_open_callbacks.html">ov_open_callbacks()</a>), it is owned by
libvorbisidec. The file should not be used by any other applications or
functions outside of the libvorbisidec API. The file must not be closed
directly by the application at any time after a successful open;
libvorbisidec expects to close the file within <a
href="ov_clear.html">ov_clear()</a>.
<p>
If the call to ov_open() or <a
href="ov_open_callbacks.html">ov_open_callbacks()</a> <b>fails</b>,
libvorbisidec does <b>not</b> assume ownership of the file and the
application is expected to close it if necessary.
<br><br>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>typedef struct {
void *datasource; /* Pointer to a FILE *, etc. */
int seekable;
ogg_int64_t offset;
ogg_int64_t end;
ogg_sync_state oy;
/* If the FILE handle isn't seekable (eg, a pipe), only the current
stream appears */
int links;
ogg_int64_t *offsets;
ogg_int64_t *dataoffsets;
long *serialnos;
ogg_int64_t *pcmlengths;
vorbis_info *vi;
vorbis_comment *vc;
/* Decoding working state local storage */
ogg_int64_t pcm_offset;
int ready_state;
long current_serialno;
int current_link;
ogg_int64_t bittrack;
ogg_int64_t samptrack;
ogg_stream_state os; /* take physical pages, weld into a logical
stream of packets */
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
vorbis_block vb; /* local working space for packet->PCM decode */
<a href="ov_callbacks.html">ov_callbacks</a> callbacks;
} OggVorbis_File;</b></pre>
</td>
</tr>
</table>
<h3>Relevant Struct Members</h3>
<dl>
<dt><i>datasource</i></dt>
<dd>Pointer to file or other ogg source. When using stdio based
file/stream access, this field contains a <tt>FILE</tt> pointer. When using
custom IO via callbacks, libvorbisidec treats this void pointer as a
black box only to be passed to the callback routines provided by the
application.</dd>
<dt><i>seekable</i></dt>
<dd>Read-only int indicating whether file is seekable. E.g., a physical file is seekable, a pipe isn't.</dd>
<dt><i>links</i></dt>
<dd>Read-only int indicating the number of logical bitstreams within the physical bitstream.</dd>
<dt><i>ov_callbacks</i></dt>
<dd>Collection of file manipulation routines to be used on this data source. When using stdio/FILE access via ov_open(), the callbacks will be filled in with stdio calls or wrappers to stdio calls.</dd>
</dl>
<h3>Notes</h3>
<p>Tremor requires a native 64 bit integer type to compile and
function; The GNU build system will locate and typedef
<tt>ogg_int64_t</tt> to the appropriate native type. If not using the
GNU build tools, you will need to define <tt>ogg_int64_t</tt> as a
64-bit type inside your system's project file/Makefile, etc. On win32,
for example, this should be defined as <tt>__int64</tt>.
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/build.html
Index: build.html
===================================================================
<html>
<head>
<title>Tremor - Build</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Tremor: Building libvorbisidec</h1>
<p>
The C source in the Tremor package will build on any ANSI C compiler
and function completely and properly on any platform. The included
build system assumes GNU build system and make tools (m4, automake,
autoconf, libtool and gmake). GCC is not required, although GCC is
the most tested compiler. To build using GNU tools, type in the
source directory:
<p>
<pre><tt>
./autogen.sh
gmake
</tt></pre>
<p>
or if GNU make is the standard make on the build system:
<pre><tt>
./autogen.sh
make
</tt></pre>
<p>
Currently, the source implements playback in pure C on all platforms
except ARM, where a [currently] small amount of assembly (see the file
asm_arm.h) is used to implement 64 bit math operations and
fast LSP computation. If building on ARM without the benefit of GNU
build system tools, be sure that <tt>_ARM_ASSEM_</tt> is #defined by
the build system if this assembly is desired, else the resulting
library will use whatever 64 bit math builtins the compiler
implements.
<p>
No math library is required by this source. No floating point
operations are used at any point in either setup or decode. This
decoder library will properly decode any past, current or future
Vorbis I file or stream.
<p>
The GNU build system produces static and, when supported by the OS,
dynamic libraries named 'libvorbisidec'. This library exposes an API
nearly identical to the BSD reference library's 'libvorbisfile',
including all the features familiar to users of vorbisfile. This API
is similar enough that the proper header file to include is named
'ivorbisfile.h', included in the source build directory.
Lower level libvorbis-style headers and structures are
in 'ivorbiscodec.h', also included in the source build directory. A
simple example program, ivorbisfile_example.c, can be built with 'make
ivorbisfile_example'.
<p>
(We've summarized <a href="diff.html">differences between the free,
reference vorbisfile library and Tremor's libvorbisidec in a separate
document</a>.)
<h3>Notes</h3>
<p>Tremor requires a native 64 bit integer type to compile and
function; The GNU build system will locate and typedef
<tt>ogg_int64_t</tt> to the appropriate native type. If not using the
GNU build tools, you will need to define <tt>ogg_int64_t</tt> as a
64-bit type inside your system's project file/Makefile, etc. On win32,
for example, this should be defined as <tt>__int64</tt>.
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>1.1 Tremor/doc/callbacks.html
Index: callbacks.html
===================================================================
<html>
<head>
<title>Tremor - Callbacks and non-stdio I/O</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Callbacks and non-stdio I/O</h1>
Although stdio is convenient and nearly universally implemented as per
ANSI C, it is not suited to all or even most potential uses of Vorbis.
For additional flexibility, embedded applications may provide their
own I/O functions for use with Tremor when stdio is unavailable or not
suitable. One common example is decoding a Vorbis stream from a
memory buffer.<p>
Use custom I/O functions by populating an <a
href="ov_callbacks.html">ov_callbacks</a> structure and calling <a
href="ov_open_callbacks.html">ov_open_callbacks()</a> or <a
href="ov_test_callbacks.html">ov_test_callbacks()</a> rather than the
typical ov_open() or <a
href="ov_test.html">ov_test()</a>. Past the open call, use of
libvorbisidec is identical to using it with stdio.
<h2>Read function</h2>
The read-like function provided in the <tt>read_func</tt> field is
used to fetch the requested amount of data. It expects the fetch
operation to function similar to file-access, that is, a multiple read
operations will retrieve contiguous sequential pieces of data,
advancing a position cursor after each read.<p>
The following behaviors are also expected:<p>
<ul>
<li>a return of '0' indicates end-of-data (if the by-thread errno is unset)
<li>short reads mean nothing special (short reads are not treated as error conditions)
<li>a return of zero with the by-thread errno set to nonzero indicates a read error
</ul>
<p>
<h2>Seek function</h2>
The seek-like function provided in the <tt>seek_func</tt> field is
used to request non-sequential data access by libvorbisidec, moving
the access cursor to the requested position.<p>
libvorbisidec expects the following behavior:
<ul>
<li>The seek function must always return -1 (failure) if the given
data abstraction is not seekable. It may choose to always return -1
if the application desires libvorbisidec to treat the Vorbis data
strictly as a stream (which makes for a less expensive open
operation).<p>
<li>If the seek function initially indicates seekability, it must
always succeed upon being given a valid seek request.<p>
<li>The seek function must implement all of SEEK_SET, SEEK_CUR and
SEEK_END. The implementation of SEEK_END should set the access cursor
one past the last byte of accessible data, as would stdio
<tt>fseek()</tt><p>
</ul>
<h2>Close function</h2>
The close function should deallocate any access state used by the
passed in instance of the data access abstraction and invalidate the
instance handle. The close function is assumed to succeed.<p>
One common use of callbacks and the close function is to change the
behavior of libvorbisidec with respect to file closure for applications
that must</em> <tt>fclose</tt> data files themselves. By passing
the normal stdio calls as callback functions, but passing a
<tt>close_func</tt> that does nothing, an application may call <a
href="ov_clear.html">ov_clear()</a> and then <tt>fclose()</tt> the
file originally passed to libvorbisidec.
<h2>Tell function</h2>
The tell function is intended to mimic the
behavior of <tt>ftell()</tt> and must return the byte position of the
next data byte that would be read. If the data access cursor is at
the end of the 'file' (pointing to one past the last byte of data, as
it would be after calling <tt>fseek(file,SEEK_END,0)</tt>), the tell
function must return the data position (and thus the total file size),
not an error.<p>
The tell function need not be provided if the data IO abstraction is
not seekable.<p.
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/datastructures.html
Index: datastructures.html
===================================================================
<html>
<head>
<title>Tremor - Base Data Structures</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Base Data Structures</h1>
<p>There are several data structures used to hold file and bitstream information during libvorbisidec decoding. These structures are declared in "ivorbisfile.h" and "ivorbiscodec.h".
<p>
<p>When using libvorbisidec, it's not necessary to know about most of the contents of these data structures, but it may be helpful to understand what they contain.
<br><br>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>datatype</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td>OggVorbis_File</td>
<td>This structure represents the basic file information. It contains
a pointer to the physical file or bitstream and various information about that bitstream.</td>
</tr>
<tr valign=top>
<td>vorbis_comment</td>
<td>This structure contains the file comments. It contains
a pointer to unlimited user comments, information about the number of comments, and a vendor description.</td>
</tr>
<tr valign=top>
<td>vorbis_info</td>
<td>This structure contains encoder-related information about the bitstream. It includes encoder info, channel info, and bitrate limits.</td>
</tr>
<tr valign=top>
<td>ov_callbacks</td>
<td>This structure contains pointers to the application-specified file manipulation routines set for use by ov_open_callbacks(). See also the provided document on using application-provided callbacks instead of stdio.</td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/decoding.html
Index: decoding.html
===================================================================
<html>
<head>
<title>Tremor - Decoding</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Decoding</h1>
<p>
All libivorbisdec decoding routines are declared in "ivorbisfile.h".
<p>
After initialization, decoding audio
is as simple as calling ov_read(). This
function works similarly to reading from a normal file using
<tt>read()</tt>.<p>
However, a few differences are worth noting:
<h2>multiple stream links</h2>
A Vorbis stream may consist of multiple sections (called links) that
encode differing numbers of channels or sample rates. It is vitally
important to pay attention to the link numbers returned by <a
href="ov_read.html">ov_read</a> and handle audio changes that may
occur at link boundaries. Such multi-section files do exist in the
wild and are not merely a specification curiosity.
<h2>returned data amount</h2>
<a href="ov_read.html">ov_read</a> does not attempt to completely fill
a large, passed in data buffer; it merely guarantees that the passed
back data does not overflow the passed in buffer size. Large buffers
may be filled by iteratively looping over calls to <a
href="ov_read.html">ov_read</a> (incrementing the buffer pointer)
until the original buffer is filled.
<h2>file cursor position</h2>
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 seperate files.
<p>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>function</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td>ov_read</td>
<td>This function makes up the main chunk of a decode loop. It takes an
OggVorbis_File structure, which must have been initialized by a previous
call to <a href="ov_open.html"><tt>ov_open()</tt></a>.</td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/diff.html
Index: diff.html
===================================================================
<html>
<head>
<title>Tremor - Vorbisfile Differences</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Tremor / Vorbisfile API Differences</h1>
<p>
The Tremor libvorbisidec library exposes an API intended to be as
similar as possible to the familiar 'vorbisfile' library included with
the open source Vorbis reference libraries distributed for free by
Xiph.org. Differences are summarized below.<p>
<h2>OggVorbis_File structure</h2>
The <tt>bittrack</tt> and <tt>samptrack</tt> fields in the <a
href="OggVorbis_File.html">OggVorbis_File</a> structure are changed to
64 bit integers in Tremor, from doubles in vorbisfile.
<h2>Time-related seek and tell function calls</h2>
The ov_time_total() and <a
href="ov_time_tell.html">ov_time_tell()</a> functions return milliseconds as
64 bit integers in Tremor. In vorbisfile, these functions returned
seconds as doubles.<p>
In Tremor, the ov_time_seek() and <a
href="ov_time_seek_page.html">ov_time_seek_page()</a> calls take
seeking positions in milliseconds as 64 bit integers, rather than in
seconds as doubles as in Vorbisfile.<p>
<h2>Reading decoded data</h2>
Tremor ov_read() always returns data as
signed 16 bit interleaved PCM in host byte order. As such, it does not
take arguments to request specific signedness, byte order or bit depth
as in Vorbisfile.<p>
Tremor does not implement <tt>ov_read_float()</tt>.<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/example.html
Index: example.html
===================================================================
<html>
<head>
<title>Tremor - Example Code</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Example Code</h1>
<p>
The following is a run-through of the decoding example program supplied
with libvorbisidec, ivorbisfile_example.c.
This program takes a vorbis bitstream from stdin and writes raw pcm to stdout.
<p>
First, relevant headers, including vorbis-specific "ivorbiscodec.h" and "ivorbisfile.h" have to be included.
<br><br>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "ivorbiscodec.h"
#include "ivorbisfile.h"
</b></pre>
</td>
</tr>
</table>
<p>
We also have to make a concession to Windows users here. If we are using windows for decoding, we must declare these libraries so that we can set stdin/stdout to binary.
<br><br>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
#endif
</b></pre>
</td>
</tr>
</table>
<p>
Next, a buffer for the pcm audio output is declared.
<br><br>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
char pcmout[4096];
</b></pre>
</td>
</tr>
</table>
<p>Inside main(), we declare our primary OggVorbis_File structure. We also declare a few other helpful variables to track out progress within the file.
Also, we make our final concession to Windows users by setting the stdin and stdout to binary mode.
<br><br>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int main(int argc, char **argv){
OggVorbis_File vf;
int eof=0;
int current_section;
#ifdef _WIN32
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif
</b></pre>
</td>
</tr>
</table>
<p>ov_open() must be
called to initialize the <b>OggVorbis_File</b> structure with default values.
<a href="ov_open.html">ov_open()</a> also checks to ensure that we're reading Vorbis format and not something else.
<br><br>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
if(ov_open(stdin, &vf, NULL, 0) < 0) {
fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
exit(1);
}
</b></pre>
</td>
</tr>
</table>
<p>
We're going to pull the channel and bitrate info from the file using ov_info() and show them to the user.
We also want to pull out and show the user a comment attached to the file using ov_comment().
<br><br>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
{
char **ptr=ov_comment(&vf,-1)->user_comments;
vorbis_info *vi=ov_info(&vf,-1);
while(*ptr){
fprintf(stderr,"%s\n",*ptr);
++ptr;
}
fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
fprintf(stderr,"\nDecoded length: %ld samples\n",
(long)ov_pcm_total(&vf,-1));
fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
}
</b></pre>
</td>
</tr>
</table>
<p>
Here's the read loop:
<br><br>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
while(!eof){
long ret=ov_read(&vf,pcmout,sizeof(pcmout),¤t_section);
if (ret == 0) {
/* EOF */
eof=1;
} else if (ret < 0) {
/* error in the stream. Not a problem, just reporting it in
case we (the app) cares. In this case, we don't. */
} else {
/* we don't bother dealing with sample rate changes, etc, but
you'll have to*/
fwrite(pcmout,1,ret,stdout);
}
}
</b></pre>
</td>
</tr>
</table>
<p>
The code is reading blocks of data using ov_read().
Based on the value returned, we know if we're at the end of the file or have invalid data. If we have valid data, we write it to the pcm output.
<p>
Now that we've finished playing, we can pack up and go home. It's important to call ov_clear() when we're finished.
<br><br>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
ov_clear(&vf);
fprintf(stderr,"Done.\n");
return(0);
}
</b></pre>
</td>
</tr>
</table>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/fileinfo.html
Index: fileinfo.html
===================================================================
<html>
<head>
<title>Tremor - File Information</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>File Information</h1>
<p>Libvorbisidec contains many functions to get information about bitstream attributes and decoding status.
<p>
All libvorbisidec file information routines are declared in "ivorbisfile.h".
<p>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>function</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td>ov_bitrate</td>
<td>Returns the average bitrate of the current logical bitstream.</td>
</tr>
<tr valign=top>
<td>ov_bitrate_instant</td>
<td>Returns the exact bitrate since the last call of this function, or -1 if at the beginning of the bitream or no new information is available.</td>
</tr>
<tr valign=top>
<td>ov_streams</td>
<td>Gives the number of logical bitstreams within the current physical bitstream.</td>
</tr>
<tr valign=top>
<td>ov_seekable</td>
<td>Indicates whether the bitstream is seekable.</td>
</tr>
<tr valign=top>
<td>ov_serialnumber</td>
<td>Returns the unique serial number of the specified logical bitstream.</td>
</tr>
<tr valign=top>
<td>ov_raw_total</td>
<td>Returns the total (compressed) bytes in a physical or logical seekable bitstream.</td>
</tr>
<tr valign=top>
<td>ov_pcm_total</td>
<td>Returns the total number of samples in a physical or logical seekable bitstream.</td>
</tr>
<tr valign=top>
<td>ov_time_total</td>
<td>Returns the total time length in seconds of a physical or logical seekable bitstream.</td>
</tr>
<tr valign=top>
<td>ov_raw_tell</td>
<td>Returns the byte location of the next sample to be read, giving the approximate location in the stream that the decoding engine has reached.</td>
</tr>
<tr valign=top>
<td>ov_pcm_tell</td>
<td>Returns the sample location of the next sample to be read, giving the approximate location in the stream that the decoding engine has reached.</td>
</tr>
<tr valign=top>
<td>ov_time_tell</td>
<td>Returns the time location of the next sample to be read, giving the approximate location in the stream that the decoding engine has reached.</td>
</tr>
<tr valign=top>
<td>ov_info</td>
<td>Returns the vorbis_info struct for a specific bitstream section.</td>
</tr>
<tr valign=top>
<td>ov_comment</td>
<td>Returns attached comments for the current bitstream.</td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/index.html
Index: index.html
===================================================================
<html>
<head>
<title>Tremor - Documentation</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Tremor Documentation</h1>
<p>
The Tremor Vorbis I stream and file decoder provides an embeddable,
integer-only library [libvorbisidec] intended for decoding all current
and future Vorbis I compliant streams. The Tremor libvorbisidec
library exposes an API intended to be as similar as possible to the
familiar 'vorbisfile' library included with the open source Vorbis
reference libraries distributed for free by Xiph.org. <p>
Tremor can be used along with any ANSI compliant stdio implementation
for file/stream access, or use custom stream i/o routines provided by
the embedded environment. Both uses are described in detail in this
documentation.
<p>
<a href="build.html">Building libvorbisidec</a><br>
<a href="overview.html">API overview</a><br>
<a href="reference.html">API reference</a><br>
<a href="example.html">Example code</a><br>
<a href="diff.html">Tremor / vorbisfile API differences</a><br>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/initialization.html
Index: initialization.html
===================================================================
<html>
<head>
<title>Tremor - Setup/Teardown</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<H1>Setup/Teardown</h1> <p>In order to decode audio using
libvorbisidec, a bitstream containing Vorbis audio must be properly
initialized before decoding and cleared when decoding is finished.
The simplest possible case is to use <tt>fopen()</tt> to open a Vorbis
file and then pass the <tt>FILE *</tt> to an <a
href="ov_open.html">ov_open()</a> call. A successful <a
href="return.html">return code</a> from <a
href="ov_open.html">ov_open()</a> indicates the file is ready for use.
Once the file is no longer needed, <a
href="ov_clear.html">ov_clear()</a> is used to close the file and
deallocate decoding resources. </b>Do not</b> call <tt>fclose()</tt> on the
file; libvorbisidec does this in the <a
href="ov_clear.html">ov_clear()</a> call.
<p>
All libvorbisidec initialization and deallocation routines are declared in "ivorbisfile.h".
<p>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>function</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td>ov_open</td>
<td>Initializes the Ogg Vorbis bitstream with a pointer to a bitstream and default values. This must be called before other functions in the library may be
used.</td>
</tr>
<tr valign=top>
<td>ov_open_callbacks</td>
<td>Initializes the Ogg Vorbis bitstream with a pointer to a bitstream, default values, and custom file/bitstream manipulation routines. Used instead of ov_open() when working with other than stdio based I/O.</td>
</tr>
<tr valign=top>
<td>ov_test</td>
<td>Partially opens a file just far enough to determine if the file
is an Ogg Vorbis file or not. A successful return indicates that the
file appears to be an Ogg Vorbis file, but the <a
href="OggVorbis_File.html">OggVorbis_File</a> struct is not yet fully
initialized for actual decoding. After a successful return, the file
may be closed using ov_clear() or fully
opened for decoding using <a
href="ov_test_open.html">ov_test_open()</a>.<p> This call is intended to
be used as a less expensive file open test than a full <a
href="ov_open.html">ov_open()</a>.<p>
Note that libvorbisidec owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisidec.</td>
</tr>
<tr valign=top>
<td>ov_test_callbacks</td>
<td>As above but allowing application-define I/O callbacks.<p>
Note that libvorbisidec owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisidec.</td>
</tr>
<tr valign=top>
<td>ov_test_open<td>
Finish opening a file after a successful call to ov_test() or ov_test_callbacks().</td>
</tr>
<tr valign=top>
<td>ov_clear</td> <td>Closes the
bitstream and cleans up loose ends. Must be called when
finished with the bitstream. After return, the <a
href="OggVorbis_File.html">OggVorbis_File</a> struct is
invalid and may not be used before being initialized again
before begin reinitialized.
</td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_bitrate.html
Index: ov_bitrate.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_bitrate</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_bitrate</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>This function returns the average bitrate for the specified logical bitstream. This may be different from the <a href=ov_info.html>ov_info->nominal_bitrate</a> value, as it is based on the actual average for this bitstream if the file is seekable.
<p>Nonseekable files will return the nominal bitrate setting or the average of the upper and lower bounds, if any of these values are set.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
long ov_bitrate(OggVorbis_File *vf,int i);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>i</i></dt>
<dd>Link to the desired logical bitstream. For nonseekable files, this argument is ignored. To retrieve the bitrate for the entire bitstream, this parameter should be set to -1.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>OV_EINVAL indicates that an invalid argument value was submitted or that the stream represented by <tt>vf</tt> is not open.</li>
<li>OV_FALSE means the call returned a 'false' status, which in this case most likely indicates that the file is nonseekable and the upper, lower, and nominal bitrates were unset.
<li><i>n</i> indicates the bitrate for the given logical bitstream or the entire
physical bitstream. If the file is open for random (seekable) access, it will
find the *actual* average bitrate. If the file is streaming (nonseekable), it
returns the nominal bitrate (if set) or else the average of the
upper/lower bounds (if set).</li>
</blockquote>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_bitrate_instant.html
Index: ov_bitrate_instant.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_bitrate</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_bitrate_instant</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Used to find the most recent bitrate played back within the file. Will return 0 if the bitrate has not changed or it is the beginning of the file.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
long ov_bitrate_instant(OggVorbis_File *vf);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>0 indicates the beginning of the file or unchanged bitrate info.</li>
<li><i>n</i> indicates the actual bitrate since the last call.</li>
<li>OV_FALSE indicates that playback is not in progress, and thus there is no instantaneous bitrate information to report.</li>
<li>OV_EINVAL indicates that the stream represented by <tt>vf</tt> is not open.</li>
</blockquote>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_callbacks.html
Index: ov_callbacks.html
===================================================================
<html>
<head>
<title>Tremor - datatype - ov_callbacks</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_callbacks</h1>
<p><i>declared in "ivorbiscodec.h"</i></p>
<p>
The ov_callbacks structure contains file manipulation function prototypes necessary for opening, closing, seeking, and location.
<p>
The ov_callbacks structure does not need to be user-defined if you are
working with stdio-based file manipulation; the <a
href="ov_open.html">ov_open()</a> call provides default callbacks for
stdio. ov_callbacks are defined and passed to <a
href="ov_open_callbacks.html">ov_open_callbacks()</a> when
implementing non-stdio based stream manipulation (such as playback
from a memory buffer).
<p>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>typedef struct {
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
int (*close_func) (void *datasource);
long (*tell_func) (void *datasource);
} ov_callbacks;</b></pre>
</td>
</tr>
</table>
<h3>Relevant Struct Members</h3>
<dl>
<dt><i>read_func</i></dt>
<dd>Pointer to custom data reading function.</dd>
<dt><i>seek_func</i></dt>
<dd>Pointer to custom data seeking function. If the data source is not seekable (or the application wants the data source to be treated as unseekable at all times), the provided seek callback should always return -1 (failure).</dd>
<dt><i>close_func</i></dt>
<dd>Pointer to custom data source closure function.</dd>
<dt><i>tell_func</i></dt>
<dd>Pointer to custom data location function.</dd>
</dl>
<p>
See the callbacks and non-stdio I/O document for more
detailed information on required behavior of the various callback
functions.<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_clear.html
Index: ov_clear.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_clear</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_clear</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p> After a bitstream has been opened using ov_open()/ov_open_callbacks() and decoding is complete, the application must call <tt>ov_clear()</tt> to clear
the decoder's buffers and close the file.<p>
<tt>ov_clear()</tt> must also be called after a successful call to ov_test() or ov_test_callbacks().<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_clear(OggVorbis_File *vf);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions. After <tt>ov_clear</tt> has been called, the structure is deallocated and can no longer be used.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>0 for success</li>
</blockquote>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_comment.html
Index: ov_comment.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_bitrate</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<p><body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_comment</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Returns a pointer to the vorbis_comment struct for the specified bitstream. For nonseekable streams, returns the struct for the current bitstream.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>i</i></dt>
<dd>Link to the desired logical bitstream. For nonseekable files, this argument is ignored. To retrieve the vorbis_comment struct for the current bitstream, this parameter should be set to -1.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>Returns the vorbis_comment struct for the specified bitstream.</li>
<li>NULL if the specified bitstream does not exist or the file has been initialized improperly.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_info.html
Index: ov_info.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_info</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_info</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Returns the vorbis_info struct for the specified bitstream. For nonseekable files, always returns the current vorbis_info struct.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
vorbis_info *ov_info(OggVorbis_File *vf,int link);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions. </dd>
<dt><i>i</i></dt>
<dd>Link to the desired logical bitstream. For nonseekable files, this argument is ignored. To retrieve the vorbis_info struct for the current bitstream, this parameter should be set to -1.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>Returns the vorbis_info struct for the specified bitstream. Returns vorbis_info for current bitstream if the file is nonseekable or i=-1.</li>
<li>NULL if the specified bitstream does not exist or the file has been initialized improperly.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_open.html
Index: ov_open.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_open</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_open</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>This is the main function used to open and initialize an OggVorbis_File
structure. It sets up all the related decoding structure.
<p>The first argument must be a file pointer to an already opened file
or pipe (it need not be seekable--though this obviously restricts what
can be done with the bitstream). <tt>vf</tt> should be a pointer to the
OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions. Once this has been called, the same OggVorbis_File
struct should be passed to all the libvorbisidec functions.
<p>Also, you should be aware that ov_open(), once successful, takes complete possession of the file resource. After you have opened a file using ov_open(), you MUST close it using ov_clear(), not fclose() or any other function.
<p>
It is often useful to call <tt>ov_open()</tt>
simply to determine whether a given file is a vorbis bitstream. If the
<tt>ov_open()</tt>
call fails, then the file is not recognizable as such.
When you use <tt>ov_open()
</tt>for
this, you should <tt>fclose()</tt> the file pointer if, and only if, the
<tt>ov_open()</tt>
call fails. If it succeeds, you must call ov_clear() to clear
the decoder's buffers and close the file for you.<p>
(Note that ov_test() provides a less expensive way to test a file for Vorbisness.)<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>f</i></dt>
<dd>File pointer to an already opened file
or pipe (it need not be seekable--though this obviously restricts what
can be done with the bitstream).</dd>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions. Once this has been called, the same <tt>OggVorbis_File</tt>
struct should be passed to all the libvorbisidec functions.</dd>
<dt><i>initial</i></dt>
<dd>Typically set to NULL. This parameter is useful if some data has already been
read from the file and the stream is not seekable. It is used in conjunction with <tt>ibytes</tt>. In this case, <tt>initial</tt>
should be a pointer to a buffer containing the data read.</dd>
<dt><i>ibytes</i></dt>
<dd>Typically set to 0. This parameter is useful if some data has already been
read from the file and the stream is not seekable. In this case, <tt>ibytes</tt>
should contain the length (in bytes) of the buffer. Used together with <tt>initial</tt></dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>0 indicates success</li>
<li>less than zero for failure:</li>
<ul>
<li>OV_EREAD - A read from media returned an error.</li>
<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
<li>OV_EVERSION - Vorbis version mismatch.</li>
<li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
</ul>
</blockquote>
<p>
<h3>Notes</h3>
<p>If your decoder is threaded, it is recommended that you NOT call
<tt>ov_open()</tt>
in the main control thread--instead, call <tt>ov_open()</tt> IN your decode/playback
thread. This is important because <tt>ov_open()</tt> may be a fairly time-consuming
call, given that the full structure of the file is determined at this point,
which may require reading large parts of the file under certain circumstances
(determining all the logical bitstreams in one physical bitstream, for
example). See Thread Safety for other information on using libvorbisidec with threads.
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_open_callbacks.html
Index: ov_open_callbacks.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_open_callbacks</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_open_callbacks</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>This is an alternative function used to open and initialize an OggVorbis_File
structure when using a data source other than a file. It allows you to specify custom file manipulation routines and sets up all the related decoding structure.
<p>Once this has been called, the same <tt>OggVorbis_File</tt>
struct should be passed to all the libvorbisidec functions.
<p>
It is often useful to call <tt>ov_open_callbacks()</tt>
simply to determine whether a given file is a vorbis bitstream. If the
<tt>ov_open_callbacks()</tt>
call fails, then the file is not recognizable as such. When you use <tt>ov_open_callbacks()
</tt>for
this, you should <tt>fclose()</tt> the file pointer if, and only if, the
<tt>ov_open_callbacks()</tt>
call fails. If it succeeds, you must call <a href=ov_clear.html>ov_clear()</a> to clear
the decoder's buffers and close the file for you.<p>
See also Callbacks and Non-stdio I/O for information on designing and specifying the required callback functions.<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_open_callbacks(void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>f</i></dt>
<dd>File pointer to an already opened file
or pipe (it need not be seekable--though this obviously restricts what
can be done with the bitstream).</dd>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions. Once this has been called, the same <tt>OggVorbis_File</tt>
struct should be passed to all the libvorbisidec functions.</dd>
<dt><i>initial</i></dt>
<dd>Typically set to NULL. This parameter is useful if some data has already been
read from the file and the stream is not seekable. It is used in conjunction with <tt>ibytes</tt>. In this case, <tt>initial</tt>
should be a pointer to a buffer containing the data read.</dd>
<dt><i>ibytes</i></dt>
<dd>Typically set to 0. This parameter is useful if some data has already been
read from the file and the stream is not seekable. In this case, <tt>ibytes</tt>
should contain the length (in bytes) of the buffer. Used together with <tt>initial</tt>.</dd>
<dt><i>callbacks</i></dt>
<dd>Pointer to a completed ov_callbacks struct which indicates desired custom file manipulation routines.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>0 for success</li>
<li>less than zero for failure:</li>
<ul>
<li>OV_EREAD - A read from media returned an error.</li>
<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
<li>OV_EVERSION - Vorbis version mismatch.</li>
<li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
</ul>
</blockquote>
<p>
<h3>Notes</h3>
<p>If your decoder is threaded, it is recommended that you NOT call
<tt>ov_open_callbacks()</tt>
in the main control thread--instead, call <tt>ov_open_callbacks()</tt> IN your decode/playback
thread. This is important because <tt>ov_open_callbacks()</tt> may be a fairly time-consuming
call, given that the full structure of the file is determined at this point,
which may require reading large parts of the file under certain circumstances
(determining all the logical bitstreams in one physical bitstream, for
example).
See Thread Safety for other information on using libvorbisidec with threads.
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_pcm_seek.html
Index: ov_pcm_seek.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_pcm_seek</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_pcm_seek</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Seeks to the offset specified (in pcm samples) within the physical bitstream. This function only works for seekable streams.
<p>This also updates everything needed within the
decoder, so you can immediately call ov_read() and get data from
the newly seeked to position.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>pos</i></dt>
<dd>Position in pcm samples to seek to in the bitstream.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>0 for success</li>
<li>
nonzero indicates failure, described by several error codes:</li>
<ul>
<li>OV_ENOSEEK - Bitstream is not seekable.
</li>
<li>OV_EINVAL - Invalid argument value.
</li>
<li>OV_EREAD - A read from media returned an error.
</li>
<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack
corruption.
</li>
<li>OV_EBADLINK - Invalid stream section supplied to libvorbisidec, or the requested link is corrupt.
</li>
</ul></blockquote>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_pcm_seek_page.html
Index: ov_pcm_seek_page.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_pcm_seek_page</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_pcm_seek_page</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Seeks to the closest page preceding the specified location (in pcm samples) within the physical bitstream. This function only works for seekable streams.
<p>This function is faster than ov_pcm_seek 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.
<p>This also updates everything needed within the
decoder, so you can immediately call ov_read() and get data from
the newly seeked to position.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>pos</i></dt>
<dd>Position in pcm samples to seek to in the bitstream.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>
0 for success</li>
<li>
nonzero indicates failure, described by several error codes:</li>
<ul>
<li>OV_ENOSEEK - Bitstream is not seekable.
</li>
<li>OV_EINVAL - Invalid argument value.
</li>
<li>OV_EREAD - A read from media returned an error.
</li>
<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack
corruption.
</li>
<li>OV_EBADLINK - Invalid stream section supplied to libvorbisidec, or the requested link is corrupt.
</li>
</ul></blockquote>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_pcm_tell.html
Index: ov_pcm_tell.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_pcm_tell</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_pcm_tell</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Returns the current offset in samples.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li><i>n</i> indicates the current offset in samples.</li>
<li>OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist.</li>
</blockquote>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_pcm_total.html
Index: ov_pcm_total.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_pcm_total</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_pcm_total</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Returns the total pcm samples of the physical bitstream or a specified logical bitstream.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>i</i></dt>
<dd>Link to the desired logical bitstream. To retrieve the total pcm samples for the entire physical bitstream, this parameter should be set to -1.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist or the bitstream is unseekable.</li>
<li>
total length in pcm samples of content if i=-1.</li>
<li>length in pcm samples of logical bitstream if i=1 to n.</li>
</blockquote>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_raw_seek.html
Index: ov_raw_seek.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_raw_seek</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_raw_seek</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Seeks to the offset specified (in compressed raw bytes) within the physical bitstream. This function only works for seekable streams.
<p>This also updates everything needed within the
decoder, so you can immediately call ov_read() and get data from
the newly seeked to position.
<p>When seek speed is a priority, this is the best seek funtion to use.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_raw_seek(OggVorbis_File *vf,long pos);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>pos</i></dt>
<dd>Position in compressed bytes to seek to in the bitstream.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>0 indicates success</li>
<li>nonzero indicates failure, described by several error codes:</li>
<ul>
<li>OV_ENOSEEK - Bitstream is not seekable.
</li>
<li>OV_EINVAL - Invalid argument value.
</li>
<li>OV_EBADLINK - Invalid stream section supplied to libvorbisidec, or the requested link is corrupt.
</li>
</ul>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_raw_tell.html
Index: ov_raw_tell.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_raw_tell</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_raw_tell</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Returns the current offset in raw compressed bytes.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li><i>n</i> indicates the current offset in bytes.</li>
<li>OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist.</li>
</blockquote>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_raw_total.html
Index: ov_raw_total.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_raw_total</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_raw_total</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Returns the total (compressed) bytes of the physical bitstream or a specified logical bitstream.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>i</i></dt>
<dd>Link to the desired logical bitstream. To retrieve the total bytes for the entire physical bitstream, this parameter should be set to -1.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist or the bitstream is nonseekable</li>
<li><tt>n</tt>
total length in compressed bytes of content if i=-1.</li>
<li><tt>n</tt> length in compressed bytes of logical bitstream if i=1 to n.</li>
</blockquote>
<p>
<p><p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_read.html
Index: ov_read.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_read</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_read()</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>
This is the main function used to decode a Vorbis file within a
loop. It returns up to the specified number of bytes of decoded audio
in host-endian, signed 16 bit PCM format. If the audio is
multichannel, the channels are interleaved in the output buffer.
If the passed in buffer is large, <tt>ov_read()</tt> will not fill
it; the passed in buffer size is treated as a limit</em> and
not a request.
<p>
Note that up to this point, the Tremor API could more or less hide the
multiple logical bitstream nature of chaining from the toplevel
application if the toplevel application didn't particularly care.
However, when reading audio back, the application must be aware
that multiple bitstream sections do not necessarily use the same
number of channels or sampling rate. <p> <tt>ov_read()</tt> passes
back the index of the sequential logical bitstream currently being
decoded (in <tt>*bitstream</tt>) along with the PCM data in order
that the toplevel application can handle channel and/or sample
rate changes. This number will be incremented at chaining
boundaries even for non-seekable streams. For seekable streams, it
represents the actual chaining index within the physical bitstream.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
long ov_read(OggVorbis_File *vf, char *buffer, int length, int *bitstream);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>buffer</i></dt>
<dd>A pointer to an output buffer. The decoded output is inserted into this buffer.</dd>
<dt><i>length</i></dt>
<dd>Number of bytes to be read into the buffer. Should be the same size as the buffer. A typical value is 4096.</dd>
<dt><i>bitstream</i></dt>
<dd>A pointer to the number of the current logical bitstream.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<dl>
<dt>OV_HOLE</dt>
<dd>indicates there was an interruption in the data.
<br>(one of: garbage between pages, loss of sync followed by
recapture, or a corrupt page)</dd>
<dt>OV_EBADLINK</dt>
<dd>indicates that an invalid stream section was supplied to
libvorbisidec, or the requested link is corrupt.</dd>
<dt>0</dt>
<dd>indicates EOF</dd>
<dt><i>n</i></dt>
<dd>indicates actual number of bytes read. <tt>ov_read()</tt> will
decode at most one vorbis packet per invocation, so the value
returned will generally be less than <tt>length</tt>.
</dl>
</blockquote>
<h3>Notes</h3>
<p><b>Typical usage:</b>
<blockquote>
<tt>bytes_read = ov_read(&vf,
buffer, 4096,&current_section)</tt>
</blockquote>
This reads up to 4096 bytes into a buffer, with signed 16-bit
little-endian samples.
</p>
<p><p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_seekable.html
Index: ov_seekable.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_seekable</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_seekable</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>This indicates whether or not the bitstream is seekable.
<p><br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
long ov_seekable(OggVorbis_File *vf);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>0 indicates that the file is not seekable.</li>
<li>nonzero indicates that the file is seekable.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_serialnumber.html
Index: ov_serialnumber.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_serialnumber</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_serialnumber</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Returns the serialnumber of the specified logical bitstream link number within the overall physical bitstream.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
long ov_serialnumber(OggVorbis_File *vf,int i);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>i</i></dt>
<dd>Link to the desired logical bitstream. For nonseekable files, this argument is ignored. To retrieve the serial number of the current bitstream, this parameter should be set to -1.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>
-1 if the specified logical bitstream <i>i</i> does not exist.</li>
<li>Returns the serial number of the logical bitstream <i>i</i> or the serial number of the current bitstream if the file is nonseekable.</li>
</blockquote>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_streams.html
Index: ov_streams.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_streams</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_streams</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Returns the number of logical bitstreams within our physical bitstream.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
long ov_streams(OggVorbis_File *vf);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions. </dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>
1 indicates a single logical bitstream or an unseekable file.</li>
<li><i>n</i> indicates the number of logical bitstreams.</li>
</blockquote>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_test.html
Index: ov_test.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_test</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_test</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>
This partially opens a vorbis file to test for Vorbis-ness. It loads
the headers for the first chain, and tests for seekability (but does not seek).
Use ov_test_open() to finish opening the file
or ov_clear to close/free it.
<p>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>f</i></dt>
<dd>File pointer to an already opened file
or pipe (it need not be seekable--though this obviously restricts what
can be done with the bitstream).</dd>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions. Once this has been called, the same <tt>OggVorbis_File</tt>
struct should be passed to all the libvorbisidec functions.</dd>
<dt><i>initial</i></dt>
<dd>Typically set to NULL. This parameter is useful if some data has already been
read from the file and the stream is not seekable. It is used in conjunction with <tt>ibytes</tt>. In this case, <tt>initial</tt>
should be a pointer to a buffer containing the data read.</dd>
<dt><i>ibytes</i></dt>
<dd>Typically set to 0. This parameter is useful if some data has already been
read from the file and the stream is not seekable. In this case, <tt>ibytes</tt>
should contain the length (in bytes) of the buffer. Used together with <tt>initial</tt></dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>0 for success</li>
<li>less than zero for failure:</li>
<ul>
<li>OV_EREAD - A read from media returned an error.</li>
<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
<li>OV_EVERSION - Vorbis version mismatch.</li>
<li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
</ul>
</blockquote>
<p>
<p><p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_test_callbacks.html
Index: ov_test_callbacks.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_test_callbacks</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_test_callbacks</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>This is an alternative function used to open and test an OggVorbis_File
structure when using a data source other than a file. It allows you to specify custom file manipulation routines and sets up all the related decoding structures.
<p>Once this has been called, the same <tt>OggVorbis_File</tt>
struct should be passed to all the libvorbisidec functions.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_test_callbacks(void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>f</i></dt>
<dd>File pointer to an already opened file
or pipe (it need not be seekable--though this obviously restricts what
can be done with the bitstream).</dd>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions. Once this has been called, the same <tt>OggVorbis_File</tt>
struct should be passed to all the libvorbisidec functions.</dd>
<dt><i>initial</i></dt>
<dd>Typically set to NULL. This parameter is useful if some data has already been
read from the file and the stream is not seekable. It is used in conjunction with <tt>ibytes</tt>. In this case, <tt>initial</tt>
should be a pointer to a buffer containing the data read.</dd>
<dt><i>ibytes</i></dt>
<dd>Typically set to 0. This parameter is useful if some data has already been
read from the file and the stream is not seekable. In this case, <tt>ibytes</tt>
should contain the length (in bytes) of the buffer. Used together with <tt>initial</tt>.</dd>
<dt><i>callbacks</i></dt>
<dd>Pointer to a completed ov_callbacks struct which indicates desired custom file manipulation routines.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>0 for success</li>
<li>less than zero for failure:</li>
<ul>
<li>OV_EREAD - A read from media returned an error.</li>
<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
<li>OV_EVERSION - Vorbis version mismatch.</li>
<li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
</ul>
</blockquote>
<p>
<p><p><p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_test_open.html
Index: ov_test_open.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_test_open</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_test_open</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>
Finish opening a file partially opened with ov_test()
or ov_test_callbacks().
<p>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_test_open(OggVorbis_File *vf);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions. Once this has been called, the same <tt>OggVorbis_File</tt>
struct should be passed to all the libvorbisidec functions.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>
0 for success</li>
<li>less than zero for failure:</li>
<ul>
<li>OV_EREAD - A read from media returned an error.</li>
<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
<li>OV_EVERSION - Vorbis version mismatch.</li>
<li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
</ul>
</blockquote>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p><p><p><p><p><p><p><p>1.1 Tremor/doc/ov_time_seek.html
Index: ov_time_seek.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_time_seek</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_time_seek</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>For seekable
streams, this seeks to the given time. For implementing seeking in a player,
this is the only function generally needed. This also updates everything needed within the
decoder, so you can immediately call ov_read() and get data from
the newly seeked to position. This function does not work for unseekable streams.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_time_seek(OggVorbis_File *vf, ogg_int64_t ms);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>Pointer to our already opened and initialized OggVorbis_File structure.</dd>
<dt><i>ms</i></dt>
<dd>Location to seek to within the file, specified in milliseconds.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>
0 for success</li>
<li>
Nonzero for failure</li>
</blockquote>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_time_seek_page.html
Index: ov_time_seek_page.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_time_seek_page</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_time_seek_page</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>For seekable
streams, this seeks to closest full page preceding the given time. This function is faster than ov_time_seek because it doesn't seek through the last few samples to reach an exact time, but it is also less accurate. This should be used when speed is important.
<p>This function also updates everything needed within the
decoder, so you can immediately call ov_read() and get data from
the newly seeked to position.
<p>This function does not work for unseekable streams.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ov_time_seek_page(OggVorbis_File *vf, ogg_int64_t ms);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>Pointer to our already opened and initialized OggVorbis_File structure.</dd>
<dt><i>ms</i></dt>
<dd>Location to seek to within the file, specified in milliseconds.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>
0 for success</li>
<li>
nonzero indicates failure, described by several error codes:</li>
<ul>
<li>OV_ENOSEEK - Bitstream is not seekable.
</li>
<li>OV_EINVAL - Invalid argument value.
</li>
<li>OV_EREAD - A read from media returned an error.
</li>
<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack
corruption.
</li>
<li>OV_EBADLINK - Invalid stream section supplied to libvorbisidec, or the requested link is corrupt.
</li>
</ul></blockquote>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_time_tell.html
Index: ov_time_tell.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_bitrate</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_time_tell</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p>Returns the current decoding offset in milliseconds.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
ogg_int64_t ov_time_tell(OggVorbis_File *vf);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li><i>n</i> indicates the current decoding time offset in milliseconds.</li>
<li>OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist.</li>
</blockquote>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/ov_time_total.html
Index: ov_time_total.html
===================================================================
<html>
<head>
<title>Tremor - function - ov_time_total</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>ov_time_total</h1>
<p><i>declared in "ivorbisfile.h";</i></p>
<p><p>Returns the total time in seconds of the physical bitstream or a specified logical bitstream.
<p><br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>vf</i></dt>
<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
functions.</dd>
<dt><i>i</i></dt>
<dd>Link to the desired logical bitstream. To retrieve the time total for the entire physical bitstream, this parameter should be set to -1.</b></dd>
</dl>
<p><h3>Return Values</h3>
<blockquote>
<li>OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist or the bitstream is nonseekable.</li>
<li><tt>n</tt> total length in milliseconds of content if i=-1.</li>
<li><tt>n</tt> length in milliseconds of logical bitstream if i=1 to n.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/overview.html
Index: overview.html
===================================================================
<html>
<head>
<title>Tremor - API Overview</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Tremor API Overview</h1>
<p>The makeup of the Tremor libvorbisidec library API is relatively
simple. It revolves around a single file resource. This file resource is
passed to libvorbisidec, where it is opened, manipulated, and closed,
in the form of an OggVorbis_File
struct.
<p>
The Tremor API consists of the following functional categories:
<p>
<ul>
<li><p>Base data structures
<li><p>Setup/Teardown
<li><p>Decoding
<li><p>Seeking
<li><p>File Information
</ul>
<p>
In addition, the following subjects deserve attention additional to
the above general overview:
<p>
<ul>
<li><p>Threading and thread safety
<li><p><a href="callbacks.html">Using [non stdio] custom stream I/O
via callbacks</a>
<li>Tremor / vorbisfile API differences<br>
</ul>
<p>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p><p>1.1 Tremor/doc/reference.html
Index: reference.html
===================================================================
<html>
<head>
<title>Tremor API Reference</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Tremor API Reference</h1>
<p>
<b>Data Structures</b><br>
<a href="OggVorbis_File.html">OggVorbis_File</a><br>
<a href="vorbis_comment.html">vorbis_comment</a><br>
<a href="vorbis_info.html">vorbis_info</a><br>
<a href="ov_callbacks.html">ov_callbacks</a><br>
<br>
<b>Setup/Teardown</b><br>
<a href="ov_open.html">ov_open()</a><br>
<a href="ov_open_callbacks.html">ov_open_callbacks()</a><br>
<a href="ov_clear.html">ov_clear()</a><br>
<a href="ov_test.html">ov_test()</a><br>
<a href="ov_test_callbacks.html">ov_test_callbacks()</a><br>
<a href="ov_test_open.html">ov_test_open()</a><br>
<br>
<b>Decoding</b><br>
<a href="ov_read.html">ov_read()</a><br>
<br>
<b>Seeking</b><br>
<a href="ov_raw_seek.html">ov_raw_seek()</a><br>
<a href="ov_pcm_seek.html">ov_pcm_seek()</a><br>
<a href="ov_time_seek.html">ov_time_seek()</a><br>
<a href="ov_pcm_seek_page.html">ov_pcm_seek_page()</a><br>
<a href="ov_time_seek_page.html">ov_time_seek_page()</a><br>
<br>
<b>File Information</b><br>
<a href="ov_bitrate.html">ov_bitrate()</a><br>
<a href="ov_bitrate_instant.html">ov_bitrate_instant()</a><br>
<a href="ov_streams.html">ov_streams()</a><br>
<a href="ov_seekable.html">ov_seekable()</a><br>
<a href="ov_serialnumber.html">ov_serialnumber()</a><br>
<a href="ov_raw_total.html">ov_raw_total()</a><br>
<a href="ov_pcm_total.html">ov_pcm_total()</a><br>
<a href="ov_time_total.html">ov_time_total()</a><br>
<a href="ov_raw_tell.html">ov_raw_tell()</a><br>
<a href="ov_pcm_tell.html">ov_pcm_tell()</a><br>
<a href="ov_time_tell.html">ov_time_tell()</a><br>
<a href="ov_info.html">ov_info()</a><br>
<a href="ov_comment.html">ov_comment()</a><br>
<br>
<b>Return Codes</b><br>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/return.html
Index: return.html
===================================================================
<html>
<head>
<title>Tremor - Return Codes</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Return Codes</h1>
<p>
The following return codes are <tt>#define</tt>d in "ivorbiscodec.h"
may be returned by libvorbisidec. Descriptions of a code relevant to
a specific function are found in the reference description of that
function.
<dl>
<dt>OV_FALSE</dt>
<dd>Not true, or no data available</dd>
<dt>OV_HOLE</dt>
<dd>Tremor encoutered missing or corrupt data in the bitstream. Recovery
is normally automatic and this return code is for informational purposes only.</dd>
<dt>OV_EREAD</dt>
<dd>Read error while fetching compressed data for decode</dd>
<dt>OV_EFAULT</dt>
<dd>Internal inconsistency in decode state. Continuing is likely not possible.</dd>
<dt>OV_EIMPL</dt>
<dd>Feature not implemented</dd>
<dt>OV_EINVAL</dt>
<dd>Either an invalid argument, or incompletely initialized argument passed to libvorbisidec call</dd>
<dt>OV_ENOTVORBIS</dt>
<dd>The given file/data was not recognized as Ogg Vorbis data.</dd>
<dt>OV_EBADHEADER</dt>
<dd>The file/data is apparently an Ogg Vorbis stream, but contains a corrupted or undecipherable header.</dd>
<dt>OV_EVERSION</dt>
<dd>The bitstream format revision of the given stream is not supported.</dd>
<dt>OV_EBADLINK</dt>
<dd>The given link exists in the Vorbis data stream, but is not decipherable due to garbacge or corruption.</dd>
<dt>OV_ENOSEEK</dt>
<dd>The given stream is not seekable</dd>
</dl>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/seeking.html
Index: seeking.html
===================================================================
<html>
<head>
<title>Tremor - Seeking</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Seeking</h1>
<p>Seeking functions allow you to specify a specific point in the stream to begin or continue decoding.
<p>
All libvorbisidec seeking routines are declared in "ivorbisfile.h".
<p>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.<p>
</ul>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>function</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td>ov_raw_seek</td>
<td>This function seeks to a position specified in the compressed bitstream, specified in bytes.</td>
</tr>
<tr valign=top>
<td>ov_pcm_seek</td>
<td>This function seeks to a specific audio sample number, specified in pcm samples.</td>
</tr>
<tr valign=top>
<td>ov_pcm_seek_page</td>
<td>This function seeks to the closest page preceding the specified audio sample number, specified in pcm samples.</td>
</tr>
<tr valign=top>
<td>ov_time_seek</td>
<td>This function seeks to the specific time location in the bitstream, specified in integer milliseconds. Note that this differs from the reference vorbisfile implementation, which takes seconds as a float. </td>
</tr>
<tr valign=top>
<td>ov_time_seek_page</td>
<td>This function seeks to the closest page preceding the specified time position in the bitstream, specified in integer milliseconds.</td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/style.css
Index: style.css
===================================================================
BODY { font-family: Helvetica, sans-serif }
TD { font-family: Helvetica, sans-serif }
P { font-family: Helvetica, sans-serif }
H1 { font-family: Helvetica, sans-serif }
H2 { font-family: Helvetica, sans-serif }
H4 { font-family: Helvetica, sans-serif }
P.tiny { font-size: 8pt }
<p><p>1.1 Tremor/doc/threads.html
Index: threads.html
===================================================================
<html>
<head>
<title>Tremor - Thread Safety</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>Thread Safety</h1>
Tremor's libvorbisidec may be used safely in a threading environment
so long as thread access to individual <a
href="OggVorbis_File.html">OggVorbis_File</a> instances is serialized.
<ul>
<li>Only one thread at a time may enter a function that takes a given <a
href="OggVorbis_File.html">OggVorbis_File</a> instance, even if the
functions involved appear to be read-only.<p>
<li>Multiple threads may enter
libvorbisidec at a given time, so long as each thread's function calls
are using different OggVorbis_File
instances. <p>
<li>Any one <a
href="OggVorbis_File.html">OggVorbis_File</a> instance may be used safely from multiple threads so long as only one thread at a time is making calls using that instance.<p>
</ul>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/vorbis_comment.html
Index: vorbis_comment.html
===================================================================
<html>
<head>
<title>Tremor - datatype - vorbis_comment</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>vorbis_comment</h1>
<p><i>declared in "ivorbiscodec.h"</i></p>
<p>
The vorbis_comment structure defines an Ogg Vorbis comment.
<p>
Only the fields the program needs must be defined. If a field isn't
defined by the application, it will either be blank (if it's a string value)
or set to some reasonable default (usually 0).
<p>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>typedef struct vorbis_comment{
/* unlimited user comment fields. */
char **user_comments;
int *comment_lengths;
int comments;
char *vendor;
} vorbis_comment;</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>user_comments</i></dt>
<dd>Unlimited user comment array. The individual strings in the array are 8 bit clean, by the Vorbis specification, and as such the <tt>comment_lengths</tt> array should be consulted to determine string length. For convenience, each string is also NULL-terminated by the decode library (although Vorbis comments are not NULL terminated within the bitstream itself).</dd>
<dt><i>comment_lengths</i></dt>
<dd>An int array that stores the length of each comment string</dd>
<dt><i>comments</i></dt>
<dd>Int signifying number of user comments in user_comments field.</dd>
<dt><i>vendor</i></dt>
<dd>Information about the creator of the file. Stored in a standard C 0-terminated string.</dd>
</dl>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>1.1 Tremor/doc/vorbis_info.html
Index: vorbis_info.html
===================================================================
<html>
<head>
<title>Tremor - datatype - vorbis_info</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
<h1>vorbis_info</h1>
<p><i>declared in "ivorbiscodec.h"</i></p>
<p>
The vorbis_info structure contains basic information about the audio in a vorbis bitstream.
<p>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>typedef struct vorbis_info{
int version;
int channels;
long rate;
long bitrate_upper;
long bitrate_nominal;
long bitrate_lower;
long bitrate_window;
void *codec_setup;
} vorbis_info;</b></pre>
</td>
</tr>
</table>
<h3>Relevant Struct Members</h3>
<dl>
<dt><i>version</i></dt>
<dd>Vorbis encoder version used to create this bitstream.</dd>
<dt><i>channels</i></dt>
<dd>Int signifying number of channels in bitstream.</dd>
<dt><i>rate</i></dt>
<dd>Sampling rate of the bitstream.</dd>
<dt><i>bitrate_upper</i></dt>
<dd>Specifies the upper limit in a VBR bitstream. If the value matches the bitrate_nominal and bitrate_lower parameters, the stream is fixed bitrate. May be unset if no limit exists.</dd>
<dt><i>bitrate_nominal</i></dt>
<dd>Specifies the average bitrate for a VBR bitstream. May be unset. If the bitrate_upper and bitrate_lower parameters match, the stream is fixed bitrate.</dd>
<dt><i>bitrate_lower</i></dt>
<dd>Specifies the lower limit in a VBR bitstream. If the value matches the bitrate_nominal and bitrate_upper parameters, the stream is fixed bitrate. May be unset if no limit exists.</dd>
<dt><i>bitrate_window</i></dt>
<dd>Currently unset.</dd>
<dt><i>codec_setup</i></dt>
<dd>Internal structure that contains the detailed/unpacked configuration for decoding the current Vorbis bitstream.</dd>
</dl>
<p><br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2002 Xiph.org</p></td>
<td align=right><p class=tiny>Ogg Vorbis</p></td>
</tr><tr>
<td><p class=tiny>Tremor documentation</p></td>
<td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
</tr>
</table>
</body>
</html>
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list