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 struct input_stream
*(*open_stream
)(struct archive_file
*af
,
79 * closes archive file.
81 void (*close
)(struct archive_file
*);
84 * suffixes handled by this plugin.
85 * last element in these arrays must always be a NULL
87 const char *const*suffixes
;
91 archive_file_open(const struct archive_plugin
*plugin
, const char *path
,
95 archive_file_close(struct archive_file
*file
);
98 archive_file_scan_reset(struct archive_file
*file
);
101 archive_file_scan_next(struct archive_file
*file
);
103 struct input_stream
*
104 archive_file_open_stream(struct archive_file
*file
,
105 const char *path
, GError
**error_r
);