Charset conversion support.
[platform/upstream/lightmediascanner.git] / src / lib / lightmediascanner_plugin.h
1 /**
2  * Copyright (C) 2007 by INdT
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  * @author Gustavo Sverzut Barbieri <gustavo.barbieri@openbossa.org>
19  */
20
21 #ifndef _LIGHTMEDIASCANNER_PLUGIN_H_
22 #define _LIGHTMEDIASCANNER_PLUGIN_H_ 1
23
24 #include <lightmediascanner.h>
25 #include <lightmediascanner_charset_conv.h>
26 #include <sqlite3.h>
27 #include <sys/types.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33     struct lms_file_info {
34         const char *path; /**< file path */
35         int path_len; /**< path length */
36         int base; /**< index of basename inside path */
37         int64_t id; /**< database id */
38         time_t mtime; /**< in-disk modification time */
39         time_t dtime; /**< deletion time */
40         size_t size; /**< file size in bytes */
41     };
42
43     struct lms_context {
44         sqlite3 *db;
45         lms_charset_conv_t *cs_conv;
46     };
47
48     typedef void *(*lms_plugin_match_fn_t)(lms_plugin_t *p, const char *path, int len, int base);
49     typedef int (*lms_plugin_parse_fn_t)(lms_plugin_t *p, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match);
50     typedef int (*lms_plugin_close_fn_t)(lms_plugin_t *p);
51     typedef int (*lms_plugin_setup_fn_t)(lms_plugin_t *p, struct lms_context *ctxt);
52     typedef int (*lms_plugin_start_fn_t)(lms_plugin_t *p, struct lms_context *ctxt);
53     typedef int (*lms_plugin_finish_fn_t)(lms_plugin_t *p, struct lms_context *ctxt);
54
55     struct lms_plugin {
56         const char *name;
57         lms_plugin_match_fn_t match;
58         lms_plugin_parse_fn_t parse;
59         lms_plugin_close_fn_t close;
60         lms_plugin_setup_fn_t setup;
61         lms_plugin_start_fn_t start;
62         lms_plugin_finish_fn_t finish;
63     };
64
65 #ifdef __cplusplus
66 }
67 #endif
68 #endif /* _LIGHTMEDIASCANNER_PLUGIN_H_ */