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"
26 archive_file_open(const struct archive_plugin
*plugin
, const char *path
,
29 struct archive_file
*file
;
31 assert(plugin
!= NULL
);
32 assert(plugin
->open
!= NULL
);
34 assert(error_r
== NULL
|| *error_r
== NULL
);
36 file
= plugin
->open(path
, error_r
);
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
);
46 assert(error_r
== NULL
|| *error_r
!= NULL
);
53 archive_file_close(struct archive_file
*file
)
56 assert(file
->plugin
!= NULL
);
57 assert(file
->plugin
->close
!= NULL
);
59 file
->plugin
->close(file
);
63 archive_file_scan_reset(struct archive_file
*file
)
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
);
74 archive_file_scan_next(struct archive_file
*file
)
77 assert(file
->plugin
!= NULL
);
78 assert(file
->plugin
->scan_next
!= NULL
);
80 return file
->plugin
->scan_next(file
);
84 archive_file_open_stream(struct archive_file
*file
, struct input_stream
*is
,
85 const char *path
, GError
**error_r
)
88 assert(file
->plugin
!= NULL
);
89 assert(file
->plugin
->open_stream
!= NULL
);
91 return file
->plugin
->open_stream(file
, is
, path
, error_r
);