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#include <audiofile.h>
32
33struct _AFvirtualfile
34{
35  ssize_t (*read) (AFvirtualfile *vfile, void *data, size_t nbytes);
36  long (*length) (AFvirtualfile *vfile);
37  ssize_t (*write) (AFvirtualfile *vfile, const void *data, size_t nbytes);
38  void (*destroy)(AFvirtualfile *vfile);
39  long (*seek)   (AFvirtualfile *vfile, long offset, int is_relative);
40  long (*tell)   (AFvirtualfile *vfile);
41
42  void *closure;
43};
44
45AFvirtualfile *af_virtual_file_new (void);
46AFvirtualfile *af_virtual_file_new_for_file (FILE *fh);
47void af_virtual_file_destroy (AFvirtualfile *vfile);
48
49size_t af_fread (void *data, size_t size, size_t nmemb, AFvirtualfile *vfile);
50size_t af_fwrite (const void *data, size_t size, size_t nmemb, AFvirtualfile *vfile);
51int af_fclose (AFvirtualfile *vfile);
52long af_flength (AFvirtualfile *vfile);
53int af_fseek (AFvirtualfile *vfile, long offset, int whence);
54long af_ftell (AFvirtualfile *vfile);
55
56#endif
57