Chris@1
|
1 <html>
|
Chris@1
|
2
|
Chris@1
|
3 <head>
|
Chris@1
|
4 <title>Vorbisfile - function - ov_open_callbacks</title>
|
Chris@1
|
5 <link rel=stylesheet href="style.css" type="text/css">
|
Chris@1
|
6 </head>
|
Chris@1
|
7
|
Chris@1
|
8 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
|
Chris@1
|
9 <table border=0 width=100%>
|
Chris@1
|
10 <tr>
|
Chris@1
|
11 <td><p class=tiny>Vorbisfile documentation</p></td>
|
Chris@1
|
12 <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
|
Chris@1
|
13 </tr>
|
Chris@1
|
14 </table>
|
Chris@1
|
15
|
Chris@1
|
16 <h1>ov_open_callbacks</h1>
|
Chris@1
|
17
|
Chris@1
|
18 <p><i>declared in "vorbis/vorbisfile.h";</i></p>
|
Chris@1
|
19
|
Chris@1
|
20 <p>This is an alternative function used to open and initialize an
|
Chris@1
|
21 OggVorbis_File structure when using a data source other than a file,
|
Chris@1
|
22 when its necessary to modify default file access behavior, or to
|
Chris@1
|
23 initialize a Vorbis decode from a <tt>FILE *</tt> pointer under
|
Chris@1
|
24 Windows where <a href="ov_open.html">ov_open()</a> cannot be used. It
|
Chris@1
|
25 allows the application to specify custom file manipulation routines
|
Chris@1
|
26 and sets up all the related decoding structures.
|
Chris@1
|
27
|
Chris@1
|
28 <p>Once ov_open_callbacks() has been called, the same
|
Chris@1
|
29 <tt>OggVorbis_File</tt> struct should be passed to all the
|
Chris@1
|
30 libvorbisfile functions. Unlike <a
|
Chris@1
|
31 href="ov_fopen.html">ov_fopen()</a> and <a
|
Chris@1
|
32 href="ov_open.html">ov_open()</a>, ov_open_callbacks() may be used to
|
Chris@1
|
33 instruct vorbisfile to either automatically close or not to close the
|
Chris@1
|
34 file/data access handle in <a href="ov_clear.html">ov_clear()</a>.
|
Chris@1
|
35 Automatic closure is disabled by passing NULL as the close callback,
|
Chris@1
|
36 or using one of the predefined callback sets that specify a NULL close
|
Chris@1
|
37 callback. The application is responsible for closing a file when a
|
Chris@1
|
38 call to ov_open_callbacks() is unsuccessful.<p>
|
Chris@1
|
39
|
Chris@1
|
40 See also <a href="callbacks.html">Callbacks and Non-stdio I/O</a> for
|
Chris@1
|
41 information on designing and specifying custom callback functions.<p>
|
Chris@1
|
42
|
Chris@1
|
43 <br><br>
|
Chris@1
|
44 <table border=0 color=black cellspacing=0 cellpadding=7>
|
Chris@1
|
45 <tr bgcolor=#cccccc>
|
Chris@1
|
46 <td>
|
Chris@1
|
47 <pre><b>
|
Chris@1
|
48 int ov_open_callbacks(void *datasource, <a href="OggVorbis_File.html">OggVorbis_File</a> *vf, char *initial, long ibytes, <a href="ov_callbacks.html">ov_callbacks</a> callbacks);
|
Chris@1
|
49 </b></pre>
|
Chris@1
|
50 </td>
|
Chris@1
|
51 </tr>
|
Chris@1
|
52 </table>
|
Chris@1
|
53
|
Chris@1
|
54 <h3>Parameters</h3>
|
Chris@1
|
55 <dl>
|
Chris@1
|
56 <dt><i>datasource</i></dt>
|
Chris@1
|
57 <dd>Pointer to a data structure allocated by the calling application, containing any state needed by the callbacks provided.</dd>
|
Chris@1
|
58 <dt><i>vf</i></dt>
|
Chris@1
|
59 <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile
|
Chris@1
|
60 functions. Once this has been called, the same <tt>OggVorbis_File</tt>
|
Chris@1
|
61 struct should be passed to all the libvorbisfile functions.</dd>
|
Chris@1
|
62 <dt><i>initial</i></dt>
|
Chris@1
|
63 <dd>Typically set to NULL. This parameter is useful if some data has already been
|
Chris@1
|
64 read from the stream and the stream is not seekable. It is used in conjunction with <tt>ibytes</tt>. In this case, <tt>initial</tt>
|
Chris@1
|
65 should be a pointer to a buffer containing the data read.</dd>
|
Chris@1
|
66 <dt><i>ibytes</i></dt>
|
Chris@1
|
67 <dd>Typically set to 0. This parameter is useful if some data has already been
|
Chris@1
|
68 read from the stream and the stream is not seekable. In this case, <tt>ibytes</tt>
|
Chris@1
|
69 should contain the length (in bytes) of the buffer. Used together with <tt>initial</tt>.</dd>
|
Chris@1
|
70 <dt><i>callbacks</i></dt>
|
Chris@1
|
71 <dd>A completed <a href="ov_callbacks.html">ov_callbacks</a> struct which indicates desired custom file manipulation routines. vorbisfile.h defines several preprovided callback sets; see <a href="ov_callbacks.html">ov_callbacks</a> for details.</dd>
|
Chris@1
|
72 </dl>
|
Chris@1
|
73
|
Chris@1
|
74
|
Chris@1
|
75 <h3>Return Values</h3>
|
Chris@1
|
76 <blockquote>
|
Chris@1
|
77 <li>0 for success</li>
|
Chris@1
|
78 <li>less than zero for failure:</li>
|
Chris@1
|
79 <ul>
|
Chris@1
|
80 <li>OV_EREAD - A read from media returned an error.</li>
|
Chris@1
|
81 <li>OV_ENOTVORBIS - Bitstream does not contain any Vorbis data.</li>
|
Chris@1
|
82 <li>OV_EVERSION - Vorbis version mismatch.</li>
|
Chris@1
|
83 <li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
|
Chris@1
|
84 <li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
|
Chris@1
|
85 </ul>
|
Chris@1
|
86 </blockquote>
|
Chris@1
|
87 <p>
|
Chris@1
|
88
|
Chris@1
|
89 <h3>Notes</h3>
|
Chris@1
|
90 <dl>
|
Chris@1
|
91
|
Chris@1
|
92 <dt><b>[a] Windows and use as an ov_open() substitute</b><p> Windows
|
Chris@1
|
93 applications should not use <a href="ov_open.html">ov_open()</a> due
|
Chris@1
|
94 to the likelihood of <a href="ov_open.html#winfoot">CRT linking
|
Chris@1
|
95 mismatches and runtime protection faults
|
Chris@1
|
96 [ov_open:a]</a>. ov_open_callbacks() is a safe substitute; specifically:
|
Chris@1
|
97
|
Chris@1
|
98 <pre><tt>ov_open_callbacks(f, vf, initial, ibytes, OV_CALLBACKS_DEFAULT);</tt>
|
Chris@1
|
99 </pre>
|
Chris@1
|
100
|
Chris@1
|
101 ... provides exactly the same functionality as <a
|
Chris@1
|
102 href="ov_open.html">ov_open()</a> but will always work correctly under
|
Chris@1
|
103 Windows, regardless of linking setup details.<p>
|
Chris@1
|
104
|
Chris@1
|
105 <dt><b>[b] Threaded decode</b><p>
|
Chris@1
|
106 <dd>If your decoder is threaded, it is recommended that you NOT call
|
Chris@1
|
107 <tt>ov_open_callbacks()</tt>
|
Chris@1
|
108 in the main control thread--instead, call <tt>ov_open_callbacks()</tt> in your decode/playback
|
Chris@1
|
109 thread. This is important because <tt>ov_open_callbacks()</tt> may be a fairly time-consuming
|
Chris@1
|
110 call, given that the full structure of the file is determined at this point,
|
Chris@1
|
111 which may require reading large parts of the file under certain circumstances
|
Chris@1
|
112 (determining all the logical bitstreams in one physical bitstream, for
|
Chris@1
|
113 example). See <a href="threads.html">Thread Safety</a> for other information on using libvorbisfile with threads.
|
Chris@1
|
114 <p>
|
Chris@1
|
115
|
Chris@1
|
116 <dt><b>[c] Mixed media streams</b><p>
|
Chris@1
|
117 <dd>
|
Chris@1
|
118 As of Vorbisfile release 1.2.0, Vorbisfile is able to access the
|
Chris@1
|
119 Vorbis content in mixed-media Ogg streams, not just Vorbis-only
|
Chris@1
|
120 streams. For example, Vorbisfile may be used to open and access the
|
Chris@1
|
121 audio from an Ogg stream consisting of Theora video and Vorbis audio.
|
Chris@1
|
122 Vorbisfile 1.2.0 decodes the first logical audio stream of each
|
Chris@1
|
123 physical stream section.<p>
|
Chris@1
|
124
|
Chris@1
|
125 <dt><b>[d] Faster testing for Vorbis files</b><p>
|
Chris@1
|
126 <dd><a href="ov_test.html">ov_test()</a> and <a
|
Chris@1
|
127 href="ov_test_callbacks.html">ov_test_callbacks()</a> provide less
|
Chris@1
|
128 computationally expensive ways to test a file for Vorbisness, but
|
Chris@1
|
129 require more setup code.<p>
|
Chris@1
|
130
|
Chris@1
|
131 </dl>
|
Chris@1
|
132
|
Chris@1
|
133 <br><br>
|
Chris@1
|
134 <hr noshade>
|
Chris@1
|
135 <table border=0 width=100%>
|
Chris@1
|
136 <tr valign=top>
|
Chris@1
|
137 <td><p class=tiny>copyright © 2000-2010 Xiph.Org</p></td>
|
Chris@1
|
138 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
|
Chris@1
|
139 </tr><tr>
|
Chris@1
|
140 <td><p class=tiny>Vorbisfile documentation</p></td>
|
Chris@1
|
141 <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
|
Chris@1
|
142 </tr>
|
Chris@1
|
143 </table>
|
Chris@1
|
144
|
Chris@1
|
145 </body>
|
Chris@1
|
146
|
Chris@1
|
147 </html>
|