1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv=
"Content-Type" content=
"text/html;charset=iso-8859-1">
3 <title>FLAC: FLAC/callback.h: I/O callback structures
</title>
4 <link href=
"doxygen.css" rel=
"stylesheet" type=
"text/css">
6 <!-- Generated by Doxygen 1.4.2 -->
7 <div class=
"qindex"><a class=
"qindex" href=
"index.html">Main
Page
</a> |
<a class=
"qindex" href=
"modules.html">Modules
</a> |
<a class=
"qindex" href=
"hierarchy.html">Class
Hierarchy
</a> |
<a class=
"qindex" href=
"classes.html">Alphabetical
List
</a> |
<a class=
"qindex" href=
"annotated.html">Class
List
</a> |
<a class=
"qindex" href=
"dirs.html">Directories
</a> |
<a class=
"qindex" href=
"files.html">File
List
</a> |
<a class=
"qindex" href=
"functions.html">Class
Members
</a> |
<a class=
"qindex" href=
"globals.html">File
Members
</a></div>
8 <h1>FLAC/callback.h: I/O callback structures
<br>
10 [
<a class=
"el" href=
"group__flac.html">FLAC C API
</a>]
</small>
11 </h1><hr><a name=
"_details"></a><h2>Detailed Description
</h2>
12 This module defines the structures for describing I/O callbacks to the other FLAC interfaces.
14 The purpose of the I/O callback functions is to create a common way for the metadata interfaces to handle I/O.
<p>
15 Originally the metadata interfaces required filenames as the way of specifying FLAC files to operate on. This is problematic in some environments so there is an additional option to specify a set of callbacks for doing I/O on the FLAC file, instead of the filename.
<p>
16 In addition to the callbacks, a FLAC__IOHandle type is defined as an opaque structure for a data source.
<p>
17 The callback function prototypes are similar (but not identical) to the stdio functions fread, fwrite, fseek, ftell, feof, and fclose. If you use stdio streams to implement the callbacks, you can pass fread, fwrite, and fclose anywhere a FLAC__IOCallback_Read, FLAC__IOCallback_Write, or FLAC__IOCallback_Close is required, and a FILE* anywhere a FLAC__IOHandle is required.
<dl compact
><dt><b>Warning:
</b></dt><dd>You generally CANNOT directly use fseek or ftell for FLAC__IOCallback_Seek or FLAC__IOCallback_Tell since on most systems these use
32-bit offsets and FLAC requires
64-bit offsets to deal with large files. You will have to find an equivalent function (e.g. ftello), or write a wrapper. The same is true for feof() since this is usually implemented as a macro, not as a function whose address can be taken.
</dd></dl>
20 <table border=
"0" cellpadding=
"0" cellspacing=
"0">
22 <tr><td colspan=
"2"><br><h2>Classes
</h2></td></tr>
23 <tr><td class=
"memItemLeft" nowrap
align=
"right" valign=
"top">struct
</td><td class=
"memItemRight" valign=
"bottom"><a class=
"el" href=
"structFLAC____IOCallbacks.html">FLAC__IOCallbacks
</a></td></tr>
25 <tr><td colspan=
"2"><br><h2>Typedefs
</h2></td></tr>
26 <tr><td class=
"memItemLeft" nowrap
align=
"right" valign=
"top">typedef void *
</td><td class=
"memItemRight" valign=
"bottom"><a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a></td></tr>
28 <tr><td class=
"memItemLeft" nowrap
align=
"right" valign=
"top">typedef size_t(*
</td><td class=
"memItemRight" valign=
"bottom"><a class=
"el" href=
"group__flac__callbacks.html#ga1">FLAC__IOCallback_Read
</a> )(void *ptr, size_t size, size_t nmemb,
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td></tr>
30 <tr><td class=
"memItemLeft" nowrap
align=
"right" valign=
"top">typedef size_t(*
</td><td class=
"memItemRight" valign=
"bottom"><a class=
"el" href=
"group__flac__callbacks.html#ga2">FLAC__IOCallback_Write
</a> )(const void *ptr, size_t size, size_t nmemb,
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td></tr>
32 <tr><td class=
"memItemLeft" nowrap
align=
"right" valign=
"top">typedef int(*
</td><td class=
"memItemRight" valign=
"bottom"><a class=
"el" href=
"group__flac__callbacks.html#ga3">FLAC__IOCallback_Seek
</a> )(
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle, FLAC__int64 offset, int whence)
</td></tr>
34 <tr><td class=
"memItemLeft" nowrap
align=
"right" valign=
"top">typedef FLAC__int64(*
</td><td class=
"memItemRight" valign=
"bottom"><a class=
"el" href=
"group__flac__callbacks.html#ga4">FLAC__IOCallback_Tell
</a> )(
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td></tr>
36 <tr><td class=
"memItemLeft" nowrap
align=
"right" valign=
"top">typedef int(*
</td><td class=
"memItemRight" valign=
"bottom"><a class=
"el" href=
"group__flac__callbacks.html#ga5">FLAC__IOCallback_Eof
</a> )(
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td></tr>
38 <tr><td class=
"memItemLeft" nowrap
align=
"right" valign=
"top">typedef int(*
</td><td class=
"memItemRight" valign=
"bottom"><a class=
"el" href=
"group__flac__callbacks.html#ga6">FLAC__IOCallback_Close
</a> )(
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td></tr>
41 <hr><h2>Typedef Documentation
</h2>
42 <a class=
"anchor" name=
"ga0" doxytag=
"callback.h::FLAC__IOHandle"></a><p>
43 <table class=
"mdTable" cellpadding=
"2" cellspacing=
"0">
46 <table cellpadding=
"0" cellspacing=
"0" border=
"0">
48 <td class=
"md" nowrap
valign=
"top">typedef void*
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> </td>
54 <table cellspacing=
"5" cellpadding=
"0" border=
"0">
62 This is the opaque handle type used by the callbacks. Typically this is a
<code>FILE*
</code> or address of a file descriptor.
</td>
65 <a class=
"anchor" name=
"ga1" doxytag=
"callback.h::FLAC__IOCallback_Read"></a><p>
66 <table class=
"mdTable" cellpadding=
"2" cellspacing=
"0">
69 <table cellpadding=
"0" cellspacing=
"0" border=
"0">
71 <td class=
"md" nowrap
valign=
"top">typedef size_t(*
<a class=
"el" href=
"group__flac__callbacks.html#ga1">FLAC__IOCallback_Read
</a>)(void *ptr, size_t size, size_t nmemb,
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td>
77 <table cellspacing=
"5" cellpadding=
"0" border=
"0">
85 Signature for the read callback. The signature and semantics match POSIX fread() implementations and can generally be used interchangeably.
<p>
86 <dl compact
><dt><b>Parameters:
</b></dt><dd>
87 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
88 <tr><td valign=
"top"></td><td valign=
"top"><em>ptr
</em> </td><td>The address of the read buffer.
</td></tr>
89 <tr><td valign=
"top"></td><td valign=
"top"><em>size
</em> </td><td>The size of the records to be read.
</td></tr>
90 <tr><td valign=
"top"></td><td valign=
"top"><em>nmemb
</em> </td><td>The number of records to be read.
</td></tr>
91 <tr><td valign=
"top"></td><td valign=
"top"><em>handle
</em> </td><td>The handle to the data source.
</td></tr>
94 <dl compact
><dt><b>Return values:
</b></dt><dd>
95 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
96 <tr><td valign=
"top"></td><td valign=
"top"><em>size_t
</em> </td><td>The number of records read.
</td></tr>
102 <a class=
"anchor" name=
"ga2" doxytag=
"callback.h::FLAC__IOCallback_Write"></a><p>
103 <table class=
"mdTable" cellpadding=
"2" cellspacing=
"0">
106 <table cellpadding=
"0" cellspacing=
"0" border=
"0">
108 <td class=
"md" nowrap
valign=
"top">typedef size_t(*
<a class=
"el" href=
"group__flac__callbacks.html#ga2">FLAC__IOCallback_Write
</a>)(const void *ptr, size_t size, size_t nmemb,
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td>
114 <table cellspacing=
"5" cellpadding=
"0" border=
"0">
122 Signature for the write callback. The signature and semantics match POSIX fwrite() implementations and can generally be used interchangeably.
<p>
123 <dl compact
><dt><b>Parameters:
</b></dt><dd>
124 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
125 <tr><td valign=
"top"></td><td valign=
"top"><em>ptr
</em> </td><td>The address of the write buffer.
</td></tr>
126 <tr><td valign=
"top"></td><td valign=
"top"><em>size
</em> </td><td>The size of the records to be written.
</td></tr>
127 <tr><td valign=
"top"></td><td valign=
"top"><em>nmemb
</em> </td><td>The number of records to be written.
</td></tr>
128 <tr><td valign=
"top"></td><td valign=
"top"><em>handle
</em> </td><td>The handle to the data source.
</td></tr>
131 <dl compact
><dt><b>Return values:
</b></dt><dd>
132 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
133 <tr><td valign=
"top"></td><td valign=
"top"><em>size_t
</em> </td><td>The number of records written.
</td></tr>
139 <a class=
"anchor" name=
"ga3" doxytag=
"callback.h::FLAC__IOCallback_Seek"></a><p>
140 <table class=
"mdTable" cellpadding=
"2" cellspacing=
"0">
143 <table cellpadding=
"0" cellspacing=
"0" border=
"0">
145 <td class=
"md" nowrap
valign=
"top">typedef int(*
<a class=
"el" href=
"group__flac__callbacks.html#ga3">FLAC__IOCallback_Seek
</a>)(
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle, FLAC__int64 offset, int whence)
</td>
151 <table cellspacing=
"5" cellpadding=
"0" border=
"0">
159 Signature for the seek callback. The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT EXCEPTION: the offset is a
64-bit type whereas fseek() is generally 'long' and
32-bits wide.
<p>
160 <dl compact
><dt><b>Parameters:
</b></dt><dd>
161 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
162 <tr><td valign=
"top"></td><td valign=
"top"><em>handle
</em> </td><td>The handle to the data source.
</td></tr>
163 <tr><td valign=
"top"></td><td valign=
"top"><em>offset
</em> </td><td>The new position, relative to
<em>whence
</em> </td></tr>
164 <tr><td valign=
"top"></td><td valign=
"top"><em>whence
</em> </td><td><code>SEEK_SET
</code>,
<code>SEEK_CUR
</code>, or
<code>SEEK_END
</code> </td></tr>
167 <dl compact
><dt><b>Return values:
</b></dt><dd>
168 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
169 <tr><td valign=
"top"></td><td valign=
"top"><em>int
</em> </td><td><code>0</code> on success,
<code>-
1</code> on error.
</td></tr>
175 <a class=
"anchor" name=
"ga4" doxytag=
"callback.h::FLAC__IOCallback_Tell"></a><p>
176 <table class=
"mdTable" cellpadding=
"2" cellspacing=
"0">
179 <table cellpadding=
"0" cellspacing=
"0" border=
"0">
181 <td class=
"md" nowrap
valign=
"top">typedef FLAC__int64(*
<a class=
"el" href=
"group__flac__callbacks.html#ga4">FLAC__IOCallback_Tell
</a>)(
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td>
187 <table cellspacing=
"5" cellpadding=
"0" border=
"0">
195 Signature for the tell callback. The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT EXCEPTION: the offset is a
64-bit type whereas ftell() is generally 'long' and
32-bits wide.
<p>
196 <dl compact
><dt><b>Parameters:
</b></dt><dd>
197 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
198 <tr><td valign=
"top"></td><td valign=
"top"><em>handle
</em> </td><td>The handle to the data source.
</td></tr>
201 <dl compact
><dt><b>Return values:
</b></dt><dd>
202 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
203 <tr><td valign=
"top"></td><td valign=
"top"><em>FLAC__int64
</em> </td><td>The current position on success,
<code>-
1</code> on error.
</td></tr>
209 <a class=
"anchor" name=
"ga5" doxytag=
"callback.h::FLAC__IOCallback_Eof"></a><p>
210 <table class=
"mdTable" cellpadding=
"2" cellspacing=
"0">
213 <table cellpadding=
"0" cellspacing=
"0" border=
"0">
215 <td class=
"md" nowrap
valign=
"top">typedef int(*
<a class=
"el" href=
"group__flac__callbacks.html#ga5">FLAC__IOCallback_Eof
</a>)(
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td>
221 <table cellspacing=
"5" cellpadding=
"0" border=
"0">
229 Signature for the EOF callback. The signature and semantics mostly match POSIX feof() but WATCHOUT: on many systems, feof() is a macro, so in this case a wrapper function must be provided instead.
<p>
230 <dl compact
><dt><b>Parameters:
</b></dt><dd>
231 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
232 <tr><td valign=
"top"></td><td valign=
"top"><em>handle
</em> </td><td>The handle to the data source.
</td></tr>
235 <dl compact
><dt><b>Return values:
</b></dt><dd>
236 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
237 <tr><td valign=
"top"></td><td valign=
"top"><em>int
</em> </td><td><code>0</code> if not at end of file, nonzero if at end of file.
</td></tr>
243 <a class=
"anchor" name=
"ga6" doxytag=
"callback.h::FLAC__IOCallback_Close"></a><p>
244 <table class=
"mdTable" cellpadding=
"2" cellspacing=
"0">
247 <table cellpadding=
"0" cellspacing=
"0" border=
"0">
249 <td class=
"md" nowrap
valign=
"top">typedef int(*
<a class=
"el" href=
"group__flac__callbacks.html#ga6">FLAC__IOCallback_Close
</a>)(
<a class=
"el" href=
"group__flac__callbacks.html#ga0">FLAC__IOHandle
</a> handle)
</td>
255 <table cellspacing=
"5" cellpadding=
"0" border=
"0">
263 Signature for the close callback. The signature and semantics match POSIX fclose() implementations and can generally be used interchangeably.
<p>
264 <dl compact
><dt><b>Parameters:
</b></dt><dd>
265 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
266 <tr><td valign=
"top"></td><td valign=
"top"><em>handle
</em> </td><td>The handle to the data source.
</td></tr>
269 <dl compact
><dt><b>Return values:
</b></dt><dd>
270 <table border=
"0" cellspacing=
"2" cellpadding=
"0">
271 <tr><td valign=
"top"></td><td valign=
"top"><em>int
</em> </td><td><code>0</code> on success,
<code>EOF
</code> on error.
</td></tr>
279 <div class=
"copyright">
280 <!-- @@@ oh so hacky -->
284 Copyright (c)
2000,
2001,
2002,
2003,
2004,
2005,
2006,
2007 Josh Coalson
286 <td width=
"1%" align=
"right">
287 <a href=
"http://sourceforge.net"><img src=
"http://sflogo.sourceforge.net/sflogo.php?group_id=13478&type=1" width=
"88" height=
"31" border=
"0" alt=
"SourceForge.net Logo" /></a>
292 <!-- Copyright (c) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -->
293 <!-- Permission is granted to copy, distribute and/or modify this document -->
294 <!-- under the terms of the GNU Free Documentation License, Version 1.1 -->
295 <!-- or any later version published by the Free Software Foundation; -->
296 <!-- with no invariant sections. -->
297 <!-- A copy of the license can be found at http://www.gnu.org/copyleft/fdl.html -->