2 * Copyright (C) 2003-2010 The Music Player Daemon Project
3 * http://www.musicpd.org
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; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef MPD_ARCHIVE_PLUGIN_H
21 #define MPD_ARCHIVE_PLUGIN_H
30 struct archive_plugin
{
34 * optional, set this to NULL if the archive plugin doesn't
35 * have/need one this must false if there is an error and
41 * optional, set this to NULL if the archive plugin doesn't
47 * tryes to open archive file and associates handle with archive
48 * returns pointer to handle used is all operations with this archive
49 * or NULL when opening fails
51 struct archive_file
*(*open
)(const char *path_fs
, GError
**error_r
);
54 * reset routine will move current read index in archive to default
55 * position and then the filenames from archives can be read
56 * via scan_next routine
58 void (*scan_reset
)(struct archive_file
*);
61 * the read method will return corresponding files from archive
62 * (as pathnames) and move read index to next file. When there is no
63 * next file it return NULL.
65 char *(*scan_next
)(struct archive_file
*);
68 * Opens an input_stream of a file within the archive.
70 * @param path the path within the archive
71 * @param error_r location to store the error occuring, or
72 * NULL to ignore errors
74 bool (*open_stream
)(struct archive_file
*, struct input_stream
*is
,
75 const char *path
, GError
**error_r
);
78 * closes archive file.
80 void (*close
)(struct archive_file
*);
83 * suffixes handled by this plugin.
84 * last element in these arrays must always be a NULL
86 const char *const*suffixes
;
90 archive_file_open(const struct archive_plugin
*plugin
, const char *path
,
94 archive_file_close(struct archive_file
*file
);
97 archive_file_scan_reset(struct archive_file
*file
);
100 archive_file_scan_next(struct archive_file
*file
);
103 archive_file_open_stream(struct archive_file
*file
, struct input_stream
*is
,
104 const char *path
, GError
**error_r
);