00001
00110 #ifndef _LIGHTMEDIASCANNER_H_
00111 #define _LIGHTMEDIASCANNER_H_ 1
00112
00113 #ifdef API
00114 #undef API
00115 #endif
00116
00117 #ifdef __GNUC__
00118 # if __GNUC__ >= 4
00119 # define API __attribute__ ((visibility("default")))
00120 # define GNUC_NULL_TERMINATED __attribute__((__sentinel__))
00121 # else
00122 # define API
00123 # define GNUC_NULL_TERMINATED
00124 # endif
00125 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
00126 # define GNUC_PURE __attribute__((__pure__))
00127 # define GNUC_MALLOC __attribute__((__malloc__))
00128 # define GNUC_CONST __attribute__((__const__))
00129 # define GNUC_UNUSED __attribute__((__unused__))
00130 # else
00131 # define GNUC_PURE
00132 # define GNUC_MALLOC
00133 # define GNUC_NORETURN
00134 # define GNUC_CONST
00135 # define GNUC_UNUSED
00136 # endif
00137 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
00138 # define GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
00139 # define GNUC_NON_NULL(...) __attribute__((nonnull(__VA_ARGS__)))
00140 # else
00141 # define GNUC_WARN_UNUSED_RESULT
00142 # define GNUC_NON_NULL(...)
00143 # endif
00144 #else
00145 # define API
00146 # define GNUC_NULL_TERMINATED
00147 # define GNUC_PURE
00148 # define GNUC_MALLOC
00149 # define GNUC_CONST
00150 # define GNUC_UNUSED
00151 # define GNUC_WARN_UNUSED_RESULT
00152 # define GNUC_NON_NULL(...)
00153 #endif
00154
00155 #ifdef __cplusplus
00156 extern "C" {
00157 #endif
00158
00164 typedef struct lms lms_t;
00165 typedef struct lms_plugin lms_plugin_t;
00166
00167 typedef enum {
00168 LMS_PROGRESS_STATUS_UP_TO_DATE,
00169 LMS_PROGRESS_STATUS_PROCESSED,
00170 LMS_PROGRESS_STATUS_DELETED,
00171 LMS_PROGRESS_STATUS_KILLED,
00172 LMS_PROGRESS_STATUS_ERROR_PARSE,
00173 LMS_PROGRESS_STATUS_ERROR_COMM,
00174 LMS_PROGRESS_STATUS_SKIPPED
00175 } lms_progress_status_t;
00176
00177 typedef void (*lms_free_callback_t)(void *data);
00178 typedef void (*lms_progress_callback_t)(lms_t *lms, const char *path, int path_len, lms_progress_status_t status, void *data);
00179
00180 API lms_t *lms_new(const char *db_path) GNUC_MALLOC GNUC_WARN_UNUSED_RESULT;
00181 API int lms_free(lms_t *lms) GNUC_NON_NULL(1);
00182 API int lms_process(lms_t *lms, const char *top_path) GNUC_NON_NULL(1, 2);
00183 API int lms_process_single_process(lms_t *lms, const char *top_path) GNUC_NON_NULL(1, 2);
00184 API int lms_check(lms_t *lms, const char *top_path) GNUC_NON_NULL(1, 2);
00185 API int lms_check_single_process(lms_t *lms, const char *top_path) GNUC_NON_NULL(1, 2);
00186 API void lms_stop_processing(lms_t *lms) GNUC_NON_NULL(1);
00187 API const char *lms_get_db_path(const lms_t *lms) GNUC_NON_NULL(1);
00188 API int lms_is_processing(const lms_t *lms) GNUC_PURE GNUC_NON_NULL(1);
00189 API int lms_get_slave_timeout(const lms_t *lms) GNUC_NON_NULL(1);
00190 API void lms_set_slave_timeout(lms_t *lms, int ms) GNUC_NON_NULL(1);
00191 API unsigned int lms_get_commit_interval(const lms_t *lms) GNUC_NON_NULL(1);
00192 API void lms_set_commit_interval(lms_t *lms, unsigned int transactions) GNUC_NON_NULL(1);
00193 API void lms_set_progress_callback(lms_t *lms, lms_progress_callback_t cb, const void *data, lms_free_callback_t free_data) GNUC_NON_NULL(1);
00194
00195
00196 API void lms_parsers_list(int (*cb)(void *data, const char *path), const void *data);
00197
00198 struct lms_parser_info {
00199 const char *path;
00200 const char *name;
00201 const char * const *categories;
00202 const char *description;
00203 const char *version;
00204 const char *const *authors;
00205 const char *uri;
00206 };
00207
00208 API struct lms_parser_info *lms_parser_info(const char *so_path);
00209 API struct lms_parser_info *lms_parser_info_find(const char *name);
00210 API void lms_parser_info_free(struct lms_parser_info *info);
00211
00212 API void lms_parsers_list_by_category(const char *category, int (*cb)(void *data, const char *path, const struct lms_parser_info *info), const void *data);
00213
00214 API lms_plugin_t *lms_parser_add(lms_t *lms, const char *so_path) GNUC_NON_NULL(1, 2);
00215 API lms_plugin_t *lms_parser_find_and_add(lms_t *lms, const char *name) GNUC_NON_NULL(1, 2);
00216 API int lms_parser_del(lms_t *lms, lms_plugin_t *handle) GNUC_NON_NULL(1, 2);
00217
00218 API int lms_charset_add(lms_t *lms, const char *charset) GNUC_NON_NULL(1, 2);
00219 API int lms_charset_del(lms_t *lms, const char *charset) GNUC_NON_NULL(1, 2);
00220
00221 #ifdef __cplusplus
00222 }
00223 #endif
00224 #endif