summaryrefslogtreecommitdiffhomepage
path: root/doc/vorbisfile/initialization.html
blob: da83957452f633db7018c60db05421988ed299dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<html>

<head>
<title>Vorbisfile - 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>Vorbisfile documentation</p></td>
<td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
</tr>
</table>

<H1>Setup/Teardown</h1> <p>In order to decode audio using
libvorbisfile, a bitstream containing Vorbis audio must be properly
initialized before decoding and cleared when decoding is finished.
The simplest possible case is to use <a
href="ov_fopen.html">ov_fopen()</a> to open the file for access, check
it for Vorbis content, and prepare it for playback.  A successful <a
href="../libvorbis/return.html">return code</a> from <a
href="ov_fopen.html">ov_fopen()</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.<p>

On systems other than Windows<a href="ov_open.html#winfoot">[a]</a>, an
application may also open a file itself using <tt>fopen()</tt>, then pass the
<tt>FILE *</tt> to libvorbisfile using <a
href="ov_open.html">ov_open()</a>. </b>Do not</b> call
<tt>fclose()</tt> on a file handle successfully submitted to <a
href="ov_open.html">ov_open()</a>; libvorbisfile does this in the <a
href="ov_clear.html">ov_clear()</a> call.<p>

An application that requires more setup flexibility may open a data
stream using <a href="ov_open_callbacks.html">ov_open_callbacks()</a>
to change default libvorbis behavior or specify non-stdio data access
mechanisms.<p>

<p>
All libvorbisfile initialization and deallocation routines are declared in "vorbis/vorbisfile.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><a href="ov_fopen.html">ov_fopen</a></td>
	<td>Opens a file and initializes the Ogg Vorbis bitstream with default values.  This must be called before other functions in the library may be
	used.</td>
</tr>
<tr valign=top>
	<td><a href="ov_open.html">ov_open</a></td>
	<td>Initializes the Ogg Vorbis bitstream with default values from a passed in file handle.  This must be called before other functions in the library may be
	used.  <a href="#winfoot"><em>Do not use this call under Windows [a];</em></a> Use <a href="ov_fopen.html">ov_fopen()</a> or <a href="ov_open_callbacks.html">ov_open_callbacks()</a> instead.</td>
</tr>
<tr valign=top>
	<td><a href="ov_open_callbacks.html">ov_open_callbacks</a></td>
	<td>Initializes the Ogg Vorbis bitstream from a file handle and custom file/bitstream manipulation routines.  Used instead of <a href="ov_open.html">ov_open()</a> or <a href="ov_fopen.html">ov_fopen()</a> when altering or replacing libvorbis's default stdio I/O behavior, or when a bitstream must be initialized from a <tt>FILE *</tt> under Windows.</td>
</tr>

<tr valign=top>
<td><a href="ov_test.html">ov_test</a></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 <a href="../libvorbis/return.html">successful return</a>, the file
may be closed using <a href="ov_clear.html">ov_clear()</a> 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 libvorbisfile owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisfile.</td>

</tr>
<tr valign=top>
<td><a href="ov_test_callbacks.html">ov_test_callbacks</a></td>
<td>As above but allowing application-define I/O callbacks.<p>
Note that libvorbisfile owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisfile.</td>

</tr>
<tr valign=top>
<td><a href="ov_test_open.html">ov_test_open</a><td>
Finish opening a file after a successful call to <a href="ov_test.html">ov_test()</a> or <a href="ov_test_callbacks.html">ov_test_callbacks()</a>.</td>
</tr>
<tr valign=top>
	<td><a href="ov_clear.html">ov_clear</a></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 &copy; 2000-2010 Xiph.Org</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
</tr><tr>
<td><p class=tiny>Vorbisfile documentation</p></td>
<td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
</tr>
</table>

</body>

</html>