1 | /* |
---|
2 | Audio File Library |
---|
3 | Copyright (C) 1999, Elliot Lee <sopwith@redhat.com> |
---|
4 | |
---|
5 | This library is free software; you can redistribute it and/or |
---|
6 | modify it under the terms of the GNU Library General Public |
---|
7 | License as published by the Free Software Foundation; either |
---|
8 | version 2 of the License, or (at your option) any later version. |
---|
9 | |
---|
10 | This library is distributed in the hope that it will be useful, |
---|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | Library General Public License for more details. |
---|
14 | |
---|
15 | You should have received a copy of the GNU Library General Public |
---|
16 | License along with this library; if not, write to the |
---|
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
18 | Boston, MA 02111-1307 USA. |
---|
19 | */ |
---|
20 | |
---|
21 | /* |
---|
22 | af_vfs.h |
---|
23 | |
---|
24 | Virtual file operations for the Audio File Library. |
---|
25 | */ |
---|
26 | |
---|
27 | #ifndef AUDIOFILE_VFS_H |
---|
28 | #define AUDIOFILE_VFS_H 1 |
---|
29 | |
---|
30 | #include <stdio.h> |
---|
31 | |
---|
32 | struct _AFvirtualfile |
---|
33 | { |
---|
34 | ssize_t (*read) (AFvirtualfile *vfile, void *data, size_t nbytes); |
---|
35 | long (*length) (AFvirtualfile *vfile); |
---|
36 | ssize_t (*write) (AFvirtualfile *vfile, const void *data, size_t nbytes); |
---|
37 | void (*destroy)(AFvirtualfile *vfile); |
---|
38 | long (*seek) (AFvirtualfile *vfile, long offset, int is_relative); |
---|
39 | long (*tell) (AFvirtualfile *vfile); |
---|
40 | |
---|
41 | void *closure; |
---|
42 | }; |
---|
43 | |
---|
44 | AFvirtualfile *af_virtual_file_new (void); |
---|
45 | AFvirtualfile *af_virtual_file_new_for_file (FILE *fh); |
---|
46 | void af_virtual_file_destroy (AFvirtualfile *vfile); |
---|
47 | |
---|
48 | size_t af_fread (void *data, size_t size, size_t nmemb, AFvirtualfile *vfile); |
---|
49 | size_t af_fwrite (const void *data, size_t size, size_t nmemb, AFvirtualfile *vfile); |
---|
50 | int af_fclose (AFvirtualfile *vfile); |
---|
51 | long af_flength (AFvirtualfile *vfile); |
---|
52 | int af_fseek (AFvirtualfile *vfile, long offset, int whence); |
---|
53 | long af_ftell (AFvirtualfile *vfile); |
---|
54 | |
---|
55 | #endif |
---|