Mercurial > audlegacy
annotate src/audacious/vfs.h @ 2861:7d3beedf1db8 trunk
BSD relicensing (pass 2).
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sat, 23 Jun 2007 22:31:46 -0500 |
parents | ac22b2cb6013 |
children | 51dda959be4d |
rev | line source |
---|---|
2313 | 1 /* |
2861
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
2 * audacious: Cross-platform multimedia player. |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
3 * vfs.h: VFS subsystem core commands. |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
4 * |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
5 * Copyright (c) 2005-2007 Audacious development team. |
2313 | 6 * |
2861
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
7 * Redistribution and use in source and binary forms, with or without |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
8 * modification, are permitted provided that the following conditions are |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
9 * met: |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
10 * |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
11 * 1. Redistributions of source code must retain the above copyright notice, |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
12 * this list of conditions and the following disclaimer. |
2313 | 13 * |
2861
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
14 * 2. Redistributions in binary form must reproduce the above copyright |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
15 * notice, this list of conditions and the following disclaimer in the |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
16 * documentation and/or other materials provided with the distribution. |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
17 * |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
18 * 3. The name of the author may not be used to endorse or promote products |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
19 * derived from this software without specific prior written permission. |
2313 | 20 * |
2861
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
24 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
7d3beedf1db8
BSD relicensing (pass 2).
William Pitcock <nenolod@atheme.org>
parents:
2688
diff
changeset
|
31 * POSSIBILITY OF SUCH DAMAGE. |
2313 | 32 */ |
33 | |
34 #ifndef VFS_H | |
35 #define VFS_H | |
36 | |
37 #include <glib.h> | |
38 #include <stdio.h> | |
2688 | 39 #include <sys/types.h> |
2313 | 40 |
41 typedef struct _VFSFile VFSFile; | |
42 typedef struct _VFSConstructor VFSConstructor; | |
43 | |
44 /** | |
45 * VFSFile: | |
46 * @uri: The URI of the stream. | |
47 * @handle: Opaque data used by the transport plugins. | |
48 * @base: The base vtable used for VFS functions. | |
2562
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
49 * @ref: The amount of references that the VFSFile object has. |
2313 | 50 * |
51 * #VFSFile objects describe a VFS stream. | |
52 **/ | |
53 struct _VFSFile { | |
54 gchar *uri; | |
55 gpointer handle; | |
56 VFSConstructor *base; | |
2562
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
57 gint ref; |
2313 | 58 }; |
59 | |
60 /** | |
61 * VFSConstructor: | |
62 * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams. | |
63 * @vfs_fopen_impl: A function pointer which points to a fopen implementation. | |
64 * @vfs_fclose_impl: A function pointer which points to a fclose implementation. | |
65 * @vfs_fread_impl: A function pointer which points to a fread implementation. | |
66 * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation. | |
67 * @vfs_getc_impl: A function pointer which points to a getc implementation. | |
68 * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation. | |
69 * @vfs_fseek_impl: A function pointer which points to a fseek implementation. | |
70 * @vfs_rewind_impl: A function pointer which points to a rewind implementation. | |
71 * @vfs_ftell_impl: A function pointer which points to a ftell implementation. | |
72 * @vfs_feof_impl: A function pointer which points to a feof implementation. | |
73 * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation. | |
74 * | |
75 * #VFSConstructor objects contain the base vtables used for extrapolating | |
76 * a VFS stream. #VFSConstructor objects should be considered %virtual in | |
77 * nature. VFS base vtables are registered via vfs_register_transport(). | |
78 **/ | |
79 struct _VFSConstructor { | |
80 gchar *uri_id; | |
81 VFSFile *(*vfs_fopen_impl)(const gchar *path, | |
82 const gchar *mode); | |
83 gint (*vfs_fclose_impl)(VFSFile * file); | |
84 size_t (*vfs_fread_impl)(gpointer ptr, size_t size, | |
85 size_t nmemb, VFSFile *file); | |
86 size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size, | |
87 size_t nmemb, VFSFile *file); | |
88 gint (*vfs_getc_impl)(VFSFile *stream); | |
89 gint (*vfs_ungetc_impl)(gint c, VFSFile *stream); | |
90 gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence); | |
91 void (*vfs_rewind_impl)(VFSFile *file); | |
92 glong (*vfs_ftell_impl)(VFSFile *file); | |
93 gboolean (*vfs_feof_impl)(VFSFile *file); | |
94 gboolean (*vfs_truncate_impl)(VFSFile *file, glong length); | |
2688 | 95 off_t (*vfs_fsize_impl)(VFSFile *file); |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
96 gchar *(*vfs_get_metadata_impl)(VFSFile *file, const gchar * field); |
2313 | 97 }; |
98 | |
99 G_BEGIN_DECLS | |
100 | |
101 extern VFSFile * vfs_fopen(const gchar * path, | |
102 const gchar * mode); | |
103 extern gint vfs_fclose(VFSFile * file); | |
104 | |
2562
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
105 extern VFSFile * vfs_dup(VFSFile *in); |
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
106 |
2313 | 107 extern size_t vfs_fread(gpointer ptr, |
108 size_t size, | |
109 size_t nmemb, | |
110 VFSFile * file); | |
111 extern size_t vfs_fwrite(gconstpointer ptr, | |
112 size_t size, | |
113 size_t nmemb, | |
114 VFSFile *file); | |
115 | |
116 extern gint vfs_getc(VFSFile *stream); | |
117 extern gint vfs_ungetc(gint c, | |
118 VFSFile *stream); | |
119 extern gchar *vfs_fgets(gchar *s, | |
120 gint n, | |
121 VFSFile *stream); | |
122 | |
123 extern gint vfs_fseek(VFSFile * file, | |
124 glong offset, | |
125 gint whence); | |
126 extern void vfs_rewind(VFSFile * file); | |
127 extern glong vfs_ftell(VFSFile * file); | |
128 extern gboolean vfs_feof(VFSFile * file); | |
129 | |
130 extern gboolean vfs_file_test(const gchar * path, | |
131 GFileTest test); | |
132 | |
133 extern gboolean vfs_is_writeable(const gchar * path); | |
134 | |
135 extern gboolean vfs_truncate(VFSFile * file, glong length); | |
136 | |
2688 | 137 extern off_t vfs_fsize(VFSFile * file); |
138 | |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
139 extern gchar *vfs_get_metadata(VFSFile * file, const gchar * field); |
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
140 |
2313 | 141 extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...) |
142 __attribute__ ((__format__ (__printf__, 2, 3))); | |
143 | |
144 extern gboolean vfs_register_transport(VFSConstructor *vtable); | |
145 | |
2424 | 146 extern void vfs_file_get_contents(const gchar *filename, gchar **buf, gsize *size); |
147 | |
2313 | 148 G_END_DECLS |
149 | |
150 #endif /* VFS_H */ |