Add support for VFS caching.
[herrie-working.git] / herrie / src / vfs_modules.h
blobb3139bcc007c01c35cb2e77511639f0816e60f3c
1 /*
2 * Copyright (c) 2006-2011 Ed Schouten <ed@80386.nl>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
26 /**
27 * @file vfs_modules.h
28 * @brief Virtual filesystem access modules.
31 struct vfsent;
32 struct vfslist;
34 /**
35 * @brief Open a directory.
37 int vfs_dir_match(struct vfsent *ve, int isdir);
38 /**
39 * @brief Read the contents of a directory and add them to the
40 * population of the current node. This function honours the sort
41 * order each module has.
43 int vfs_dir_populate(struct vfsent *ve);
45 /**
46 * @brief A fallback module that matches all files on disk (possibly
47 * audio files?)
49 int vfs_file_match(struct vfsent *ve, int isdir);
50 /**
51 * @brief Create a file handle to the file
53 FILE *vfs_file_open(struct vfsent *ve);
55 #ifdef BUILD_HTTP
56 /**
57 * @brief Test whether the current node contains a HTTP address.
59 int vfs_http_match(struct vfsent *ve, int isdir);
60 /**
61 * @brief Return a filehandle to a HTTP audio stream.
63 FILE *vfs_http_open(struct vfsent *ve);
64 #endif /* BUILD_HTTP */
66 /**
67 * @brief Test whether the current node is an M3U file.
69 int vfs_m3u_match(struct vfsent *ve, int isdir);
70 /**
71 * @brief Add all items in the M3U file to the population of the current
72 * node.
74 int vfs_m3u_populate(struct vfsent *ve);
75 /**
76 * @brief Write the current list of VFS entries to a M3U formatted
77 * playlist.
79 int vfs_m3u_write(const struct vfslist *vl, const char *filename);
81 /**
82 * @brief Test whether the current node is an PLS file.
84 int vfs_pls_match(struct vfsent *ve, int isdir);
85 /**
86 * @brief Add all items in the PLS file to the population of the current
87 * node.
89 int vfs_pls_populate(struct vfsent *ve);
90 /**
91 * @brief Write the current list of VFS entries to a PLS formatted
92 * playlist.
94 int vfs_pls_write(const struct vfslist *vl, const char *filename);
96 #ifdef BUILD_XSPF
97 /**
98 * @brief Test whether the current node is an XSPF file.
100 int vfs_xspf_match(struct vfsent *ve, int isdir);
102 * @brief Add all items in the XSPF file to the population of the
103 * current node.
105 int vfs_xspf_populate(struct vfsent *ve);
107 * @brief Write the current list of VFS entries to a XSPF formatted
108 * playlist.
110 int vfs_xspf_write(const struct vfslist *vl, const char *filename);
111 #endif /* BUILD_XSPF */