configure.ac: Move the encoders before the audio outputs.
[mpd-mk.git] / src / archive_plugin.c
blob60da4d2834e39d5117c9523187a7fc448302f13b
1 /*
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 #include "archive_plugin.h"
21 #include "archive_internal.h"
23 #include <assert.h>
25 struct archive_file *
26 archive_file_open(const struct archive_plugin *plugin, const char *path,
27 GError **error_r)
29 struct archive_file *file;
31 assert(plugin != NULL);
32 assert(plugin->open != NULL);
33 assert(path != NULL);
34 assert(error_r == NULL || *error_r == NULL);
36 file = plugin->open(path, error_r);
38 if (file != NULL) {
39 assert(file->plugin != NULL);
40 assert(file->plugin->close != NULL);
41 assert(file->plugin->scan_reset != NULL);
42 assert(file->plugin->scan_next != NULL);
43 assert(file->plugin->open_stream != NULL);
44 assert(error_r == NULL || *error_r == NULL);
45 } else {
46 assert(error_r == NULL || *error_r != NULL);
49 return file;
52 void
53 archive_file_close(struct archive_file *file)
55 assert(file != NULL);
56 assert(file->plugin != NULL);
57 assert(file->plugin->close != NULL);
59 file->plugin->close(file);
62 void
63 archive_file_scan_reset(struct archive_file *file)
65 assert(file != NULL);
66 assert(file->plugin != NULL);
67 assert(file->plugin->scan_reset != NULL);
68 assert(file->plugin->scan_next != NULL);
70 file->plugin->scan_reset(file);
73 char *
74 archive_file_scan_next(struct archive_file *file)
76 assert(file != NULL);
77 assert(file->plugin != NULL);
78 assert(file->plugin->scan_next != NULL);
80 return file->plugin->scan_next(file);
83 struct input_stream *
84 archive_file_open_stream(struct archive_file *file,
85 const char *path, GError **error_r)
87 assert(file != NULL);
88 assert(file->plugin != NULL);
89 assert(file->plugin->open_stream != NULL);
91 return file->plugin->open_stream(file, path, error_r);