Mercurial > audlegacy
annotate src/audacious/vfs.h @ 2488:c5075a79f1aa trunk
[svn] make input->set_info overwrite tuple->track_name. it allows input
plugins to update fileinfopopup along with meta data in a stream. it
may incur side effects, please let me know if you find any problem.
author | yaz |
---|---|
date | Thu, 08 Feb 2007 07:00:02 -0800 |
parents | 3e3d34173207 |
children | 07b990906823 |
rev | line source |
---|---|
2313 | 1 /* |
2 * Audacious | |
3 * Copyright (c) 2006-2007 Audacious team | |
4 * | |
5 * This program is free software; you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License as published by | |
7 * the Free Software Foundation; under version 2 of the License. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 */ | |
18 | |
19 #ifndef VFS_H | |
20 #define VFS_H | |
21 | |
22 #include <glib.h> | |
23 #include <stdio.h> | |
24 | |
25 typedef struct _VFSFile VFSFile; | |
26 typedef struct _VFSConstructor VFSConstructor; | |
27 | |
28 /** | |
29 * VFSFile: | |
30 * @uri: The URI of the stream. | |
31 * @handle: Opaque data used by the transport plugins. | |
32 * @base: The base vtable used for VFS functions. | |
33 * | |
34 * #VFSFile objects describe a VFS stream. | |
35 **/ | |
36 struct _VFSFile { | |
37 gchar *uri; | |
38 gpointer handle; | |
39 VFSConstructor *base; | |
40 }; | |
41 | |
42 /** | |
43 * VFSConstructor: | |
44 * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams. | |
45 * @vfs_fopen_impl: A function pointer which points to a fopen implementation. | |
46 * @vfs_fclose_impl: A function pointer which points to a fclose implementation. | |
47 * @vfs_fread_impl: A function pointer which points to a fread implementation. | |
48 * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation. | |
49 * @vfs_getc_impl: A function pointer which points to a getc implementation. | |
50 * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation. | |
51 * @vfs_fseek_impl: A function pointer which points to a fseek implementation. | |
52 * @vfs_rewind_impl: A function pointer which points to a rewind implementation. | |
53 * @vfs_ftell_impl: A function pointer which points to a ftell implementation. | |
54 * @vfs_feof_impl: A function pointer which points to a feof implementation. | |
55 * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation. | |
56 * | |
57 * #VFSConstructor objects contain the base vtables used for extrapolating | |
58 * a VFS stream. #VFSConstructor objects should be considered %virtual in | |
59 * nature. VFS base vtables are registered via vfs_register_transport(). | |
60 **/ | |
61 struct _VFSConstructor { | |
62 gchar *uri_id; | |
63 VFSFile *(*vfs_fopen_impl)(const gchar *path, | |
64 const gchar *mode); | |
65 gint (*vfs_fclose_impl)(VFSFile * file); | |
66 size_t (*vfs_fread_impl)(gpointer ptr, size_t size, | |
67 size_t nmemb, VFSFile *file); | |
68 size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size, | |
69 size_t nmemb, VFSFile *file); | |
70 gint (*vfs_getc_impl)(VFSFile *stream); | |
71 gint (*vfs_ungetc_impl)(gint c, VFSFile *stream); | |
72 gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence); | |
73 void (*vfs_rewind_impl)(VFSFile *file); | |
74 glong (*vfs_ftell_impl)(VFSFile *file); | |
75 gboolean (*vfs_feof_impl)(VFSFile *file); | |
76 gboolean (*vfs_truncate_impl)(VFSFile *file, glong length); | |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
77 gchar *(*vfs_get_metadata_impl)(VFSFile *file, const gchar * field); |
2313 | 78 }; |
79 | |
80 G_BEGIN_DECLS | |
81 | |
82 extern VFSFile * vfs_fopen(const gchar * path, | |
83 const gchar * mode); | |
84 extern gint vfs_fclose(VFSFile * file); | |
85 | |
86 extern size_t vfs_fread(gpointer ptr, | |
87 size_t size, | |
88 size_t nmemb, | |
89 VFSFile * file); | |
90 extern size_t vfs_fwrite(gconstpointer ptr, | |
91 size_t size, | |
92 size_t nmemb, | |
93 VFSFile *file); | |
94 | |
95 extern gint vfs_getc(VFSFile *stream); | |
96 extern gint vfs_ungetc(gint c, | |
97 VFSFile *stream); | |
98 extern gchar *vfs_fgets(gchar *s, | |
99 gint n, | |
100 VFSFile *stream); | |
101 | |
102 extern gint vfs_fseek(VFSFile * file, | |
103 glong offset, | |
104 gint whence); | |
105 extern void vfs_rewind(VFSFile * file); | |
106 extern glong vfs_ftell(VFSFile * file); | |
107 extern gboolean vfs_feof(VFSFile * file); | |
108 | |
109 extern gboolean vfs_file_test(const gchar * path, | |
110 GFileTest test); | |
111 | |
112 extern gboolean vfs_is_writeable(const gchar * path); | |
113 | |
114 extern gboolean vfs_truncate(VFSFile * file, glong length); | |
115 | |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
116 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
|
117 |
2313 | 118 extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...) |
119 __attribute__ ((__format__ (__printf__, 2, 3))); | |
120 | |
121 extern gboolean vfs_register_transport(VFSConstructor *vtable); | |
122 | |
2424 | 123 extern void vfs_file_get_contents(const gchar *filename, gchar **buf, gsize *size); |
124 | |
2313 | 125 G_END_DECLS |
126 | |
127 #endif /* VFS_H */ |