summaryrefslogtreecommitdiff
path: root/plugins.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-04-25 21:49:34 +0200
committerGravatar waker <wakeroid@gmail.com>2011-04-25 21:49:34 +0200
commit43a277e9d2dfaa2055184617495e1d3a48b8d9cc (patch)
tree6e98e5d4df0299825c6ec21ca51c37ca23ccf9d2 /plugins.c
parent3d8f7348c65f7b071ad488c6d09ecfa6e3baaee6 (diff)
new future-proof playlist API, potentially reducing locking, and allowing more flexibility
Diffstat (limited to 'plugins.c')
-rw-r--r--plugins.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/plugins.c b/plugins.c
index 399663bc..d589b518 100644
--- a/plugins.c
+++ b/plugins.c
@@ -105,28 +105,37 @@ static DB_functions_t deadbeef_api = {
.cond_signal = cond_signal,
.cond_broadcast = cond_broadcast,
// playlist management
+ .plt_ref = (void (*) (ddb_playlist_t *plt))plt_ref,
+ .plt_unref = (void (*) (ddb_playlist_t *plt))plt_unref,
.plt_get_count = plt_get_count,
.plt_get_head = (DB_playItem_t * (*) (int plt))plt_get_head,
.plt_get_sel_count = plt_get_sel_count,
.plt_add = plt_add,
.plt_remove = plt_remove,
- .plt_set_curr = plt_set_curr,
- .plt_get_curr = plt_get_curr,
+ .plt_clear = (void (*)(ddb_playlist_t *))plt_clear,
+ .plt_set_curr = (void (*) (ddb_playlist_t *plt))plt_set_curr,
+ .plt_get_curr = (ddb_playlist_t *(*) (void))plt_get_curr,
+ .plt_set_curr_idx = (void (*) (int plt))plt_set_curr_idx,
+ .plt_get_curr_idx = (int (*) (void))plt_get_curr_idx,
.plt_move = plt_move,
- .plt_get_handle = (void *(*)(int idx))plt_get,
- .plt_get_title = (int (*)(void *handle, char *buffer, int sz))plt_get_title,
- .plt_set_title = (int (*)(void *handle, const char *buffer))plt_set_title,
- .plt_modified = (void (*) (void *handle))plt_modified,
- .plt_get_modification_idx = (int (*) (void *handle))plt_get_modification_idx,
+ // playlist saving and loading
+ .plt_load = (DB_playItem_t * (*) (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data))plt_load,
+ .plt_save = (int (*)(ddb_playlist_t *plt, DB_playItem_t *first, DB_playItem_t *last, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data))plt_save,
+ // getting and working with a handle must be guarded using plt_lock/unlock
+ .plt_get_for_idx = (ddb_playlist_t *(*)(int idx))plt_get_for_idx,
+ .plt_get_title = (int (*)(ddb_playlist_t *handle, char *buffer, int sz))plt_get_title,
+ .plt_set_title = (int (*)(ddb_playlist_t *handle, const char *buffer))plt_set_title,
+ .plt_modified = (void (*) (ddb_playlist_t *handle))plt_modified,
+ .plt_get_modification_idx = (int (*) (ddb_playlist_t *handle))plt_get_modification_idx,
// playlist metadata
- .plt_add_meta = (void (*) (void *handle, const char *key, const char *value))plt_add_meta,
- .plt_replace_meta = (void (*) (void *handle, const char *key, const char *value))plt_replace_meta,
- .plt_append_meta = (void (*) (void *handle, const char *key, const char *value))plt_append_meta,
- .plt_set_meta_int = (void (*) (void *handle, const char *key, int value))plt_set_meta_int,
- .plt_set_meta_float = (void (*) (void *handle, const char *key, float value))plt_set_meta_float,
- .plt_find_meta = (const char *(*) (void *handle, const char *key))plt_find_meta,
- .plt_get_metadata_head = (DB_metaInfo_t * (*) (void *handle))plt_get_metadata_head,
+ .plt_add_meta = (void (*) (ddb_playlist_t *handle, const char *key, const char *value))plt_add_meta,
+ .plt_replace_meta = (void (*) (ddb_playlist_t *handle, const char *key, const char *value))plt_replace_meta,
+ .plt_append_meta = (void (*) (ddb_playlist_t *handle, const char *key, const char *value))plt_append_meta,
+ .plt_set_meta_int = (void (*) (ddb_playlist_t *handle, const char *key, int value))plt_set_meta_int,
+ .plt_set_meta_float = (void (*) (ddb_playlist_t *handle, const char *key, float value))plt_set_meta_float,
+ .plt_find_meta = (const char *(*) (ddb_playlist_t *handle, const char *key))plt_find_meta,
+ .plt_get_metadata_head = (DB_metaInfo_t * (*) (ddb_playlist_t *handle))plt_get_metadata_head,
// playlist access
.pl_lock = pl_lock,
@@ -140,7 +149,7 @@ static DB_functions_t deadbeef_api = {
.pl_item_copy = (void (*)(DB_playItem_t *, DB_playItem_t *))pl_item_copy,
.pl_add_file = (int (*) (const char *, int (*cb)(DB_playItem_t *it, void *data), void *))pl_add_file,
.pl_add_dir = (int (*) (const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data))pl_add_dir,
- .pl_add_files_begin = pl_add_files_begin,
+ .pl_add_files_begin = (int (*) (ddb_playlist_t *plt))pl_add_files_begin,
.pl_add_files_end = pl_add_files_end,
.pl_insert_item = (DB_playItem_t *(*) (DB_playItem_t *after, DB_playItem_t *it))pl_insert_item,
.pl_insert_dir = (DB_playItem_t *(*) (DB_playItem_t *after, const char *dirname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data))pl_insert_dir,
@@ -165,8 +174,6 @@ static DB_functions_t deadbeef_api = {
.pl_set_selected = (void (*) (DB_playItem_t *, int))pl_set_selected,
.pl_is_selected = (int (*) (DB_playItem_t *))pl_is_selected,
.pl_clear = pl_clear,
- .pl_load = pl_load,
- .pl_save = pl_save,
.pl_save_current = pl_save_current,
.pl_save_all = pl_save_all,
.pl_select_all = pl_select_all,