annotate audacious/vfs.h @ 2224:4446a9e7bdee trunk

[svn] - memory_pool_alloc_object() - memory_pool_strdup() - controlsocket now uses a memory pool for packet data
author nenolod
date Fri, 29 Dec 2006 21:01:49 -0800
parents e0e50e151bab
children 329fb2453c87
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1974
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
1 /*
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
2 * Audacious
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
3 * Copyright (c) 2006 Audacious team
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
4 *
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
5 * This program is free software; you can redistribute it and/or modify
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
6 * it under the terms of the GNU General Public License as published by
2105
f18a5b617c34 [svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents: 2060
diff changeset
7 * the Free Software Foundation; under version 2 of the License.
1974
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
8 *
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
9 * This program is distributed in the hope that it will be useful,
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
12 * GNU General Public License for more details.
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
13 *
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
14 * You should have received a copy of the GNU General Public License
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
15 * along with this program; if not, write to the Free Software
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
17 */
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
18
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 #ifndef VFS_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 #define VFS_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 #include <stdio.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 typedef struct _VFSFile VFSFile;
1975
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
26 typedef struct _VFSConstructor VFSConstructor;
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
27
2060
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
28 /**
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
29 * VFSFile:
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
30 * @uri: The URI of the stream.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
31 * @handle: Opaque data used by the transport plugins.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
32 * @base: The base vtable used for VFS functions.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
33 *
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
34 * #VFSFile objects describe a VFS stream.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
35 **/
1975
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
36 struct _VFSFile {
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
37 gchar *uri;
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
38 gpointer handle;
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
39 VFSConstructor *base;
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
40 };
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41
2060
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
42 /**
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
43 * VFSConstructor:
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
44 * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
45 * @vfs_fopen_impl: A function pointer which points to a fopen implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
46 * @vfs_fclose_impl: A function pointer which points to a fclose implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
47 * @vfs_fread_impl: A function pointer which points to a fread implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
48 * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
49 * @vfs_getc_impl: A function pointer which points to a getc implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
50 * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
51 * @vfs_fseek_impl: A function pointer which points to a fseek implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
52 * @vfs_rewind_impl: A function pointer which points to a rewind implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
53 * @vfs_ftell_impl: A function pointer which points to a ftell implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
54 * @vfs_feof_impl: A function pointer which points to a feof implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
55 * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation.
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
56 *
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
57 * #VFSConstructor objects contain the base vtables used for extrapolating
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
58 * a VFS stream. #VFSConstructor objects should be considered %virtual in
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
59 * nature. VFS base vtables are registered via vfs_register_transport().
53a3d5db6b58 [svn] - finish documenting the libaudacious API
nenolod
parents: 1997
diff changeset
60 **/
1974
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
61 struct _VFSConstructor {
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
62 gchar *uri_id;
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
63 VFSFile *(*vfs_fopen_impl)(const gchar *path,
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
64 const gchar *mode);
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
65 gint (*vfs_fclose_impl)(VFSFile * file);
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
66 size_t (*vfs_fread_impl)(gpointer ptr, size_t size,
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
67 size_t nmemb, VFSFile *file);
1975
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
68 size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size,
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
69 size_t nmemb, VFSFile *file);
976da06332df [svn] - newvfs code, part 1
nenolod
parents: 1974
diff changeset
70 gint (*vfs_getc_impl)(VFSFile *stream);
1974
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
71 gint (*vfs_ungetc_impl)(gint c, VFSFile *stream);
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
72 gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence);
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
73 void (*vfs_rewind_impl)(VFSFile *file);
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
74 glong (*vfs_ftell_impl)(VFSFile *file);
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
75 gboolean (*vfs_feof_impl)(VFSFile *file);
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
76 gboolean (*vfs_truncate_impl)(VFSFile *file, glong length);
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
77 };
9f6c17f1cc93 [svn] - define VFSConstructor
nenolod
parents: 1683
diff changeset
78
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 G_BEGIN_DECLS
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80
830
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
81 extern VFSFile * vfs_fopen(const gchar * path,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 const gchar * mode);
830
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
83 extern gint vfs_fclose(VFSFile * file);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84
830
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
85 extern size_t vfs_fread(gpointer ptr,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 size_t size,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 size_t nmemb,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 VFSFile * file);
830
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
89 extern size_t vfs_fwrite(gconstpointer ptr,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 size_t size,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 size_t nmemb,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 VFSFile *file);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93
1683
e9c24e35bd76 [svn] - File stream API for audacious vfs; uses real getc/ungetc functions for vfs_stdio and emulated functions for vfs_gnome
giacomo
parents: 1669
diff changeset
94 extern gint vfs_getc(VFSFile *stream);
e9c24e35bd76 [svn] - File stream API for audacious vfs; uses real getc/ungetc functions for vfs_stdio and emulated functions for vfs_gnome
giacomo
parents: 1669
diff changeset
95 extern gint vfs_ungetc(gint c,
e9c24e35bd76 [svn] - File stream API for audacious vfs; uses real getc/ungetc functions for vfs_stdio and emulated functions for vfs_gnome
giacomo
parents: 1669
diff changeset
96 VFSFile *stream);
1617
3de4bd38fe4f [svn] generic vfs_gets and m3u updated to use vfs
lu_zero
parents: 830
diff changeset
97 extern gchar *vfs_fgets(gchar *s,
3de4bd38fe4f [svn] generic vfs_gets and m3u updated to use vfs
lu_zero
parents: 830
diff changeset
98 gint n,
3de4bd38fe4f [svn] generic vfs_gets and m3u updated to use vfs
lu_zero
parents: 830
diff changeset
99 VFSFile *stream);
3de4bd38fe4f [svn] generic vfs_gets and m3u updated to use vfs
lu_zero
parents: 830
diff changeset
100
830
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
101 extern gint vfs_fseek(VFSFile * file,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 glong offset,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 gint whence);
830
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
104 extern void vfs_rewind(VFSFile * file);
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
105 extern glong vfs_ftell(VFSFile * file);
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
106 extern gboolean vfs_feof(VFSFile * file);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107
830
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
108 extern gboolean vfs_file_test(const gchar * path,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 GFileTest test);
811
86ca43d8a845 [svn] - implement vfs_feof() and vfs_ftell() and update the scrobbler plugin to reflect that,
nenolod
parents: 0
diff changeset
110
830
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
111 extern gboolean vfs_is_writeable(const gchar * path);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112
830
4d60baab67a0 [svn] - use extern here (grr)
nenolod
parents: 811
diff changeset
113 extern gboolean vfs_truncate(VFSFile * file, glong length);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114
1669
07143b97314d [svn] fprintf implementation in the VFS common layer by Luca Barbato. Use it in the Container plugins.
chainsaw
parents: 1617
diff changeset
115 extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...)
07143b97314d [svn] fprintf implementation in the VFS common layer by Luca Barbato. Use it in the Container plugins.
chainsaw
parents: 1617
diff changeset
116 __attribute__ ((__format__ (__printf__, 2, 3)));
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117
1997
93c59698f5fd [svn] - NewVFS lives ;)
nenolod
parents: 1975
diff changeset
118 extern gboolean vfs_register_transport(VFSConstructor *vtable);
93c59698f5fd [svn] - NewVFS lives ;)
nenolod
parents: 1975
diff changeset
119
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 G_END_DECLS
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 #endif /* VFS_H */