annotate src/audacious/vfs.h @ 4755:c6f352d25d27

makeing possible to reinitialize the output plugin from outher plugins
author Paula Stanciu <paula.stanciu@gmail.com>
date Thu, 07 Aug 2008 12:16:46 +0300
parents 2eee464379dc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
19 */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
20
4557
2eee464379dc Clean up header multiple inclusion guards (e.g. #ifndef FOO_H/#define FOO_H)
Matti Hamalainen <ccr@tnsp.org>
parents: 4407
diff changeset
21 #ifndef AUDACIOUS_VFS_H
2eee464379dc Clean up header multiple inclusion guards (e.g. #ifndef FOO_H/#define FOO_H)
Matti Hamalainen <ccr@tnsp.org>
parents: 4407
diff changeset
22 #define AUDACIOUS_VFS_H
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
23
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
24 #include <glib.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
25 #include <stdio.h>
2688
ertzing
parents: 2562
diff changeset
26 #include <sys/types.h>
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
27
4407
5a0f5ef1de61 Some stupid header cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 4392
diff changeset
28 G_BEGIN_DECLS
5a0f5ef1de61 Some stupid header cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 4392
diff changeset
29
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
30 typedef struct _VFSFile VFSFile;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
31 typedef struct _VFSConstructor VFSConstructor;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
32
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
33 /**
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
34 * VFSFile:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
35 * @uri: The URI of the stream.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
36 * @handle: Opaque data used by the transport plugins.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
37 * @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
38 * @ref: The amount of references that the VFSFile object has.
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
39 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
40 * #VFSFile objects describe a VFS stream.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
41 **/
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
42 struct _VFSFile {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
43 gchar *uri;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
44 gpointer handle;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
45 VFSConstructor *base;
2562
07b990906823 [svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents: 2424
diff changeset
46 gint ref;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
47 };
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
48
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
49 /**
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
50 * VFSConstructor:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
51 * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
52 * @vfs_fopen_impl: A function pointer which points to a fopen implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
53 * @vfs_fclose_impl: A function pointer which points to a fclose implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
54 * @vfs_fread_impl: A function pointer which points to a fread implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
55 * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
56 * @vfs_getc_impl: A function pointer which points to a getc implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
57 * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
58 * @vfs_fseek_impl: A function pointer which points to a fseek implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
59 * @vfs_rewind_impl: A function pointer which points to a rewind implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
60 * @vfs_ftell_impl: A function pointer which points to a ftell implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
61 * @vfs_feof_impl: A function pointer which points to a feof implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
62 * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
63 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
64 * #VFSConstructor objects contain the base vtables used for extrapolating
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
65 * a VFS stream. #VFSConstructor objects should be considered %virtual in
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
66 * nature. VFS base vtables are registered via vfs_register_transport().
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
67 **/
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
68 struct _VFSConstructor {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
69 gchar *uri_id;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
70 VFSFile *(*vfs_fopen_impl)(const gchar *path,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
71 const gchar *mode);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
72 gint (*vfs_fclose_impl)(VFSFile * file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
73 size_t (*vfs_fread_impl)(gpointer ptr, size_t size,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
74 size_t nmemb, VFSFile *file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
75 size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
76 size_t nmemb, VFSFile *file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
77 gint (*vfs_getc_impl)(VFSFile *stream);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
78 gint (*vfs_ungetc_impl)(gint c, VFSFile *stream);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
79 gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
80 void (*vfs_rewind_impl)(VFSFile *file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
81 glong (*vfs_ftell_impl)(VFSFile *file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
82 gboolean (*vfs_feof_impl)(VFSFile *file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
83 gboolean (*vfs_truncate_impl)(VFSFile *file, glong length);
2688
ertzing
parents: 2562
diff changeset
84 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
85 gchar *(*vfs_get_metadata_impl)(VFSFile *file, const gchar * field);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
86 };
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
87
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
88
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
89 extern VFSFile * vfs_fopen(const gchar * path,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
90 const gchar * mode);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
91 extern gint vfs_fclose(VFSFile * file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
92
2562
07b990906823 [svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents: 2424
diff changeset
93 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
94
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
95 extern size_t vfs_fread(gpointer ptr,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
96 size_t size,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
97 size_t nmemb,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
98 VFSFile * file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
99 extern size_t vfs_fwrite(gconstpointer ptr,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
100 size_t size,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
101 size_t nmemb,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
102 VFSFile *file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
103
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
104 extern gint vfs_getc(VFSFile *stream);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
105 extern gint vfs_ungetc(gint c,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
106 VFSFile *stream);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
107 extern gchar *vfs_fgets(gchar *s,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
108 gint n,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
109 VFSFile *stream);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
110
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
111 extern gint vfs_fseek(VFSFile * file,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
112 glong offset,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
113 gint whence);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
114 extern void vfs_rewind(VFSFile * file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
115 extern glong vfs_ftell(VFSFile * file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
116 extern gboolean vfs_feof(VFSFile * file);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
117
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
118 extern gboolean vfs_file_test(const gchar * path,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
119 GFileTest test);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
120
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
121 extern gboolean vfs_is_writeable(const gchar * path);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
122
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
123 extern gboolean vfs_truncate(VFSFile * file, glong length);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
124
2688
ertzing
parents: 2562
diff changeset
125 extern off_t vfs_fsize(VFSFile * file);
ertzing
parents: 2562
diff changeset
126
2376
e1513290ee3c [svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents: 2313
diff changeset
127 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
128
4390
694ce1a806f8 int -> gint for uniformity.
Matti Hamalainen <ccr@tnsp.org>
parents: 3142
diff changeset
129 extern gint vfs_fprintf(VFSFile *stream, gchar const *format, ...)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
130 __attribute__ ((__format__ (__printf__, 2, 3)));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
131
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
132 extern gboolean vfs_register_transport(VFSConstructor *vtable);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
133
2424
3e3d34173207 [svn] - vfs_get_file_contents() implementation.
nenolod
parents: 2376
diff changeset
134 extern void vfs_file_get_contents(const gchar *filename, gchar **buf, gsize *size);
3e3d34173207 [svn] - vfs_get_file_contents() implementation.
nenolod
parents: 2376
diff changeset
135
3142
e8f2b130e59e add vfs_is_remote() and vfs_is_streaming().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3123
diff changeset
136 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
137
e8f2b130e59e add vfs_is_remote() and vfs_is_streaming().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3123
diff changeset
138 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
139
4392
9d5e6bfca672 Added new VFS helper functions for reading big/little endian data (16-, 32- and 64-bit integer formats)
Matti Hamalainen <ccr@tnsp.org>
parents: 4390
diff changeset
140 extern gboolean vfs_fget_le16(guint16 *value, VFSFile *stream);
9d5e6bfca672 Added new VFS helper functions for reading big/little endian data (16-, 32- and 64-bit integer formats)
Matti Hamalainen <ccr@tnsp.org>
parents: 4390
diff changeset
141 extern gboolean vfs_fget_le32(guint32 *value, VFSFile *stream);
9d5e6bfca672 Added new VFS helper functions for reading big/little endian data (16-, 32- and 64-bit integer formats)
Matti Hamalainen <ccr@tnsp.org>
parents: 4390
diff changeset
142 extern gboolean vfs_fget_le64(guint64 *value, VFSFile *stream);
9d5e6bfca672 Added new VFS helper functions for reading big/little endian data (16-, 32- and 64-bit integer formats)
Matti Hamalainen <ccr@tnsp.org>
parents: 4390
diff changeset
143 extern gboolean vfs_fget_be16(guint16 *value, VFSFile *stream);
9d5e6bfca672 Added new VFS helper functions for reading big/little endian data (16-, 32- and 64-bit integer formats)
Matti Hamalainen <ccr@tnsp.org>
parents: 4390
diff changeset
144 extern gboolean vfs_fget_be32(guint32 *value, VFSFile *stream);
9d5e6bfca672 Added new VFS helper functions for reading big/little endian data (16-, 32- and 64-bit integer formats)
Matti Hamalainen <ccr@tnsp.org>
parents: 4390
diff changeset
145 extern gboolean vfs_fget_be64(guint64 *value, VFSFile *stream);
9d5e6bfca672 Added new VFS helper functions for reading big/little endian data (16-, 32- and 64-bit integer formats)
Matti Hamalainen <ccr@tnsp.org>
parents: 4390
diff changeset
146
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
147 G_END_DECLS
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
148
4557
2eee464379dc Clean up header multiple inclusion guards (e.g. #ifndef FOO_H/#define FOO_H)
Matti Hamalainen <ccr@tnsp.org>
parents: 4407
diff changeset
149 #endif /* AUDACIOUS_VFS_H */