Mercurial > audlegacy
annotate src/audacious/vfs.h @ 3298:f985357757e0 trunk
audacious-core: convert to tuple-ng, remove titlestring API.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Fri, 10 Aug 2007 05:22:35 -0500 |
parents | e8f2b130e59e |
children | 694ce1a806f8 |
rev | line source |
---|---|
2313 | 1 /* |
2896
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
2 * Audacious |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
3 * Copyright (c) 2006-2007 Audacious team |
2313 | 4 * |
2896
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2896
diff
changeset
|
7 * the Free Software Foundation; under version 3 of the License. |
2313 | 8 * |
2896
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
12 * GNU General Public License for more details. |
2313 | 13 * |
2896
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2896
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
16 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
17 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
18 * Audacious or using our public API to be a derived work. |
2313 | 19 */ |
20 | |
21 #ifndef VFS_H | |
22 #define VFS_H | |
23 | |
24 #include <glib.h> | |
25 #include <stdio.h> | |
2688 | 26 #include <sys/types.h> |
2313 | 27 |
28 typedef struct _VFSFile VFSFile; | |
29 typedef struct _VFSConstructor VFSConstructor; | |
30 | |
31 /** | |
32 * VFSFile: | |
33 * @uri: The URI of the stream. | |
34 * @handle: Opaque data used by the transport plugins. | |
35 * @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
|
36 * @ref: The amount of references that the VFSFile object has. |
2313 | 37 * |
38 * #VFSFile objects describe a VFS stream. | |
39 **/ | |
40 struct _VFSFile { | |
41 gchar *uri; | |
42 gpointer handle; | |
43 VFSConstructor *base; | |
2562
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
44 gint ref; |
2313 | 45 }; |
46 | |
47 /** | |
48 * VFSConstructor: | |
49 * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams. | |
50 * @vfs_fopen_impl: A function pointer which points to a fopen implementation. | |
51 * @vfs_fclose_impl: A function pointer which points to a fclose implementation. | |
52 * @vfs_fread_impl: A function pointer which points to a fread implementation. | |
53 * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation. | |
54 * @vfs_getc_impl: A function pointer which points to a getc implementation. | |
55 * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation. | |
56 * @vfs_fseek_impl: A function pointer which points to a fseek implementation. | |
57 * @vfs_rewind_impl: A function pointer which points to a rewind implementation. | |
58 * @vfs_ftell_impl: A function pointer which points to a ftell implementation. | |
59 * @vfs_feof_impl: A function pointer which points to a feof implementation. | |
60 * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation. | |
61 * | |
62 * #VFSConstructor objects contain the base vtables used for extrapolating | |
63 * a VFS stream. #VFSConstructor objects should be considered %virtual in | |
64 * nature. VFS base vtables are registered via vfs_register_transport(). | |
65 **/ | |
66 struct _VFSConstructor { | |
67 gchar *uri_id; | |
68 VFSFile *(*vfs_fopen_impl)(const gchar *path, | |
69 const gchar *mode); | |
70 gint (*vfs_fclose_impl)(VFSFile * file); | |
71 size_t (*vfs_fread_impl)(gpointer ptr, size_t size, | |
72 size_t nmemb, VFSFile *file); | |
73 size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size, | |
74 size_t nmemb, VFSFile *file); | |
75 gint (*vfs_getc_impl)(VFSFile *stream); | |
76 gint (*vfs_ungetc_impl)(gint c, VFSFile *stream); | |
77 gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence); | |
78 void (*vfs_rewind_impl)(VFSFile *file); | |
79 glong (*vfs_ftell_impl)(VFSFile *file); | |
80 gboolean (*vfs_feof_impl)(VFSFile *file); | |
81 gboolean (*vfs_truncate_impl)(VFSFile *file, glong length); | |
2688 | 82 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
|
83 gchar *(*vfs_get_metadata_impl)(VFSFile *file, const gchar * field); |
2313 | 84 }; |
85 | |
86 G_BEGIN_DECLS | |
87 | |
88 extern VFSFile * vfs_fopen(const gchar * path, | |
89 const gchar * mode); | |
90 extern gint vfs_fclose(VFSFile * file); | |
91 | |
2562
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
92 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
|
93 |
2313 | 94 extern size_t vfs_fread(gpointer ptr, |
95 size_t size, | |
96 size_t nmemb, | |
97 VFSFile * file); | |
98 extern size_t vfs_fwrite(gconstpointer ptr, | |
99 size_t size, | |
100 size_t nmemb, | |
101 VFSFile *file); | |
102 | |
103 extern gint vfs_getc(VFSFile *stream); | |
104 extern gint vfs_ungetc(gint c, | |
105 VFSFile *stream); | |
106 extern gchar *vfs_fgets(gchar *s, | |
107 gint n, | |
108 VFSFile *stream); | |
109 | |
110 extern gint vfs_fseek(VFSFile * file, | |
111 glong offset, | |
112 gint whence); | |
113 extern void vfs_rewind(VFSFile * file); | |
114 extern glong vfs_ftell(VFSFile * file); | |
115 extern gboolean vfs_feof(VFSFile * file); | |
116 | |
117 extern gboolean vfs_file_test(const gchar * path, | |
118 GFileTest test); | |
119 | |
120 extern gboolean vfs_is_writeable(const gchar * path); | |
121 | |
122 extern gboolean vfs_truncate(VFSFile * file, glong length); | |
123 | |
2688 | 124 extern off_t vfs_fsize(VFSFile * file); |
125 | |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
126 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
|
127 |
2313 | 128 extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...) |
129 __attribute__ ((__format__ (__printf__, 2, 3))); | |
130 | |
131 extern gboolean vfs_register_transport(VFSConstructor *vtable); | |
132 | |
2424 | 133 extern void vfs_file_get_contents(const gchar *filename, gchar **buf, gsize *size); |
134 | |
3142
e8f2b130e59e
add vfs_is_remote() and vfs_is_streaming().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3123
diff
changeset
|
135 extern gboolean vfs_is_remote(const gchar * path); |
e8f2b130e59e
add vfs_is_remote() and vfs_is_streaming().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3123
diff
changeset
|
136 |
e8f2b130e59e
add vfs_is_remote() and vfs_is_streaming().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3123
diff
changeset
|
137 extern gboolean vfs_is_streaming(VFSFile *file); |
e8f2b130e59e
add vfs_is_remote() and vfs_is_streaming().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3123
diff
changeset
|
138 |
2313 | 139 G_END_DECLS |
140 | |
141 #endif /* VFS_H */ |