diff options
author | waker <wakeroid@gmail.com> | 2011-04-29 22:38:31 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-04-29 22:38:31 +0200 |
commit | 20627955d1184b5f07b8f7910a59f15cdc4802c8 (patch) | |
tree | afc2111b9d3be287d3e82dcc54b23f84c88e4183 | |
parent | cec677f6022983afbc144a52eff8a719a1086577 (diff) |
changed some API entry points to make it possible working with specific playlists, and not just the current one
-rw-r--r-- | deadbeef.h | 26 | ||||
-rw-r--r-- | playlist.c | 49 | ||||
-rw-r--r-- | playlist.h | 10 | ||||
-rw-r--r-- | pltmeta.c | 25 | ||||
-rw-r--r-- | pltmeta.h | 3 | ||||
-rw-r--r-- | plugins.c | 15 | ||||
-rw-r--r-- | plugins/aac/aac.c | 8 | ||||
-rw-r--r-- | plugins/adplug/adplug-db.cpp | 4 | ||||
-rw-r--r-- | plugins/adplug/plugin.c | 2 | ||||
-rw-r--r-- | plugins/ao/plugin.c | 4 | ||||
-rw-r--r-- | plugins/cdda/cdda.c | 10 | ||||
-rw-r--r-- | plugins/dca/dcaplug.c | 6 | ||||
-rw-r--r-- | plugins/dumb/cdumb.c | 4 | ||||
-rw-r--r-- | plugins/ffap/ffap.c | 8 | ||||
-rw-r--r-- | plugins/ffmpeg/ffmpeg.c | 6 | ||||
-rw-r--r-- | plugins/flac/flac.c | 8 | ||||
-rw-r--r-- | plugins/gme/cgme.c | 4 | ||||
-rw-r--r-- | plugins/m3u/m3u.c | 28 | ||||
-rw-r--r-- | plugins/mpgmad/mpgmad.c | 10 | ||||
-rw-r--r-- | plugins/musepack/musepack.c | 10 | ||||
-rw-r--r-- | plugins/shn/shn.c | 4 | ||||
-rw-r--r-- | plugins/sid/csid.cpp | 4 | ||||
-rw-r--r-- | plugins/sid/csid.h | 2 | ||||
-rw-r--r-- | plugins/sndfile/sndfile.c | 6 | ||||
-rw-r--r-- | plugins/tta/ttaplug.c | 8 | ||||
-rw-r--r-- | plugins/vorbis/vorbis.c | 10 | ||||
-rw-r--r-- | plugins/vtx/vtx.c | 4 | ||||
-rw-r--r-- | plugins/wavpack/wavpack.c | 8 | ||||
-rw-r--r-- | plugins/wildmidi/wildmidiplug.c | 4 |
29 files changed, 184 insertions, 106 deletions
@@ -445,6 +445,11 @@ typedef struct { float (*plt_find_meta_float) (ddb_playlist_t *handle, const char *key, float def); void (*plt_delete_all_meta) (ddb_playlist_t *handle); + // operating on playlist items + DB_playItem_t * (*plt_insert_item) (ddb_playlist_t *playlist, DB_playItem_t *after, DB_playItem_t *it); + DB_playItem_t * (*plt_insert_file) (ddb_playlist_t *playlist, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data); + void (*plt_set_item_duration) (ddb_playlist_t *plt, DB_playItem_t *it, float duration); + // playlist locking void (*pl_lock) (void); void (*pl_unlock) (void); @@ -455,6 +460,8 @@ typedef struct { void (*pl_item_ref) (DB_playItem_t *it); void (*pl_item_unref) (DB_playItem_t *it); void (*pl_item_copy) (DB_playItem_t *out, DB_playItem_t *in); + + // add files and folders to current playlist int (*pl_add_file) (const char *fname, int (*cb)(DB_playItem_t *it, void *data), void *user_data); int (*pl_add_dir) (const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data); @@ -462,8 +469,15 @@ typedef struct { // caller must cancel operation in this case, or wait until previous add // finishes int (*pl_add_files_begin) (ddb_playlist_t *plt); + + // end must be called when add files operation is finished void (*pl_add_files_end) (void); - DB_playItem_t *(*pl_insert_item) (DB_playItem_t *after, DB_playItem_t *it); + + // most of this functions are self explanatory + // if you don't get what they do -- look in the code + // NOTE: many of pl_* functions, especially the ones that operate on current + // playlist, are going to be nuked somewhere around 0.6 release, in favor of + // more explicit plt_* family DB_playItem_t *(*pl_insert_dir) (DB_playItem_t *after, const char *dirname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data); DB_playItem_t *(*pl_insert_file) (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data); int (*pl_get_idx_of) (DB_playItem_t *it); @@ -561,8 +575,8 @@ typedef struct { int (*pl_playqueue_test) (DB_playItem_t *it); // cuesheet support - DB_playItem_t *(*pl_insert_cue_from_buffer) (DB_playItem_t *after, DB_playItem_t *origin, const uint8_t *buffer, int buffersize, int numsamples, int samplerate); - DB_playItem_t * (*pl_insert_cue) (DB_playItem_t *after, DB_playItem_t *origin, int numsamples, int samplerate); + DB_playItem_t *(*plt_insert_cue_from_buffer) (ddb_playlist_t *plt, DB_playItem_t *after, DB_playItem_t *origin, const uint8_t *buffer, int buffersize, int numsamples, int samplerate); + DB_playItem_t * (*plt_insert_cue) (ddb_playlist_t *plt, DB_playItem_t *after, DB_playItem_t *origin, int numsamples, int samplerate); // volume control void (*volume_set_db) (float dB); @@ -837,7 +851,7 @@ typedef struct DB_decoder_s { // 'insert' is called to insert new item to playlist // decoder is responsible to calculate duration, split it into subsongs, load cuesheet, etc // after==NULL means "prepend before 1st item in playlist" - DB_playItem_t * (*insert) (DB_playItem_t *after, const char *fname); + DB_playItem_t * (*insert) (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname); int (*numvoices) (DB_fileinfo_t *info); void (*mutevoice) (DB_fileinfo_t *info, int voice, int mute); @@ -1012,12 +1026,12 @@ typedef struct DB_gui_s { typedef struct DB_playlist_s { DB_plugin_t plugin; - DB_playItem_t * (*load) (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data); + DB_playItem_t * (*load) (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data); // will save items from first to last (inclusive) // format is determined by extension // playlist is protected from changes during the call - int (*save) (const char *fname, DB_playItem_t *first, DB_playItem_t *last); + int (*save) (ddb_playlist_t *plt, const char *fname, DB_playItem_t *first, DB_playItem_t *last); const char **extensions; // NULL-terminated list of supported file extensions, e.g. {"m3u", "pls", NULL} } DB_playlist_t; @@ -961,10 +961,10 @@ pl_process_cue_track (playItem_t *after, const char *fname, playItem_t **prev, c } playItem_t * -pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t *buffer, int buffersize, int numsamples, int samplerate) { +plt_insert_cue_from_buffer (playlist_t *playlist, playItem_t *after, playItem_t *origin, const uint8_t *buffer, int buffersize, int numsamples, int samplerate) { LOCK; playItem_t *ins = after; - trace ("pl_insert_cue_from_buffer numsamples=%d, samplerate=%d\n", numsamples, samplerate); + trace ("plt_insert_cue_from_buffer numsamples=%d, samplerate=%d\n", numsamples, samplerate); char albumperformer[256] = ""; char performer[256] = ""; char albumtitle[256] = ""; @@ -1101,7 +1101,7 @@ pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t } playItem_t * -pl_insert_cue (playItem_t *after, playItem_t *origin, int numsamples, int samplerate) { +plt_insert_cue (playlist_t *plt, playItem_t *after, playItem_t *origin, int numsamples, int samplerate) { trace ("pl_insert_cue numsamples=%d, samplerate=%d\n", numsamples, samplerate); const char *fname = pl_find_meta (origin, ":URI"); int len = strlen (fname); @@ -1133,7 +1133,7 @@ pl_insert_cue (playItem_t *after, playItem_t *origin, int numsamples, int sample return NULL; } fclose (fp); - return pl_insert_cue_from_buffer (after, origin, buf, sz, numsamples, samplerate); + return plt_insert_cue_from_buffer (plt, after, origin, buf, sz, numsamples, samplerate); } playItem_t * @@ -1405,10 +1405,13 @@ static int follow_symlinks = 0; static int ignore_archives = 0; playItem_t * +plt_insert_dir_int (playlist_t *playlist, DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data); + +playItem_t * pl_insert_dir_int (DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data); playItem_t * -pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) { +plt_insert_file (playlist_t *playlist, playItem_t *after, const char *fname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) { trace ("count: %d\n", playlist->count[PL_MAIN]); trace ("pl_insert_file %s\n", fname); if (!fname || !(*fname)) { @@ -1530,7 +1533,7 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla const char **exts = decoders[i]->exts; for (int e = 0; exts[e]; e++) { if (!strcasecmp (exts[e], eol)) { - playItem_t *inserted = (playItem_t *)decoders[i]->insert (DB_PLAYITEM (after), fname); + playItem_t *inserted = (playItem_t *)decoders[i]->insert ((ddb_playlist_t *)playlist, DB_PLAYITEM (after), fname); if (inserted != NULL) { if (cb && cb (inserted, user_data) < 0) { *pabort = 1; @@ -1544,7 +1547,7 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla const char **prefixes = decoders[i]->prefixes; for (int e = 0; prefixes[e]; e++) { if (!strncasecmp (prefixes[e], fn, strlen(prefixes[e])) && *(fn + strlen (prefixes[e])) == '.') { - playItem_t *inserted = (playItem_t *)decoders[i]->insert (DB_PLAYITEM (after), fname); + playItem_t *inserted = (playItem_t *)decoders[i]->insert ((ddb_playlist_t *)playlist, DB_PLAYITEM (after), fname); if (inserted != NULL) { if (cb && cb (inserted, user_data) < 0) { *pabort = 1; @@ -1559,12 +1562,17 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla return NULL; } +playItem_t * +pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) { + return plt_insert_file (playlist, after, fname, pabort, cb, user_data); +} + static int dirent_alphasort (const struct dirent **a, const struct dirent **b) { return strcmp ((*a)->d_name, (*b)->d_name); } playItem_t * -pl_insert_dir_int (DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) { +plt_insert_dir_int (playlist_t *playlist, DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) { if (!strncmp (dirname, "file://", 7)) { dirname += 7; } @@ -1602,13 +1610,13 @@ pl_insert_dir_int (DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *p if (!vfs) { char fullname[PATH_MAX]; snprintf (fullname, sizeof (fullname), "%s/%s", dirname, namelist[i]->d_name); - inserted = pl_insert_dir_int (vfs, after, fullname, pabort, cb, user_data); + inserted = plt_insert_dir_int (playlist, vfs, after, fullname, pabort, cb, user_data); if (!inserted) { - inserted = pl_insert_file (after, fullname, pabort, cb, user_data); + inserted = plt_insert_file (playlist, after, fullname, pabort, cb, user_data); } } else { - inserted = pl_insert_file (after, namelist[i]->d_name, pabort, cb, user_data); + inserted = plt_insert_file (playlist, after, namelist[i]->d_name, pabort, cb, user_data); } if (inserted) { after = inserted; @@ -1624,6 +1632,12 @@ pl_insert_dir_int (DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *p return after; } + +playItem_t * +pl_insert_dir_int (DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) { + return plt_insert_dir_int (playlist, vfs, after, dirname, pabort, cb, user_data); +} + playItem_t * pl_insert_dir (playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) { follow_symlinks = conf_get_int ("add_folders_follow_symlinks", 0); @@ -1998,7 +2012,7 @@ plt_save (playlist_t *plt, playItem_t *first, playItem_t *last, const char *fnam if (exts && plug[i]->save) { for (int e = 0; exts[e]; e++) { if (!strcasecmp (exts[e], ext+1)) { - int res = plug[i]->save (fname, (DB_playItem_t *)playlist->head[PL_MAIN], NULL); + int res = plug[i]->save ((ddb_playlist_t *)plt, fname, (DB_playItem_t *)playlist->head[PL_MAIN], NULL); UNLOCK; return res; } @@ -2272,7 +2286,7 @@ plt_load (playlist_t *plt, playItem_t *after, const char *fname, int *pabort, in for (p = 0; plug[p]; p++) { for (e = 0; plug[p]->extensions[e]; e++) { if (plug[p]->load && !strcasecmp (ext, plug[p]->extensions[e])) { - DB_playItem_t *it = plug[p]->load ((DB_playItem_t *)after, fname, pabort, (int (*)(DB_playItem_t *, void *))cb, user_data); + DB_playItem_t *it = plug[p]->load ((ddb_playlist_t *)plt, (DB_playItem_t *)after, fname, pabort, (int (*)(DB_playItem_t *, void *))cb, user_data); return (playItem_t *)it; } } @@ -2647,7 +2661,7 @@ pl_reshuffle (playItem_t **ppmin, playItem_t **ppmax) { } void -pl_set_item_duration (playItem_t *it, float duration) { +plt_set_item_duration (playlist_t *playlist, playItem_t *it, float duration) { LOCK; if (it->in_playlist) { if (it->_duration > 0) { @@ -2667,6 +2681,13 @@ pl_set_item_duration (playItem_t *it, float duration) { UNLOCK; } +void +pl_set_item_duration (playItem_t *it, float duration) { + LOCK; + plt_set_item_duration (playlist, it, duration); + UNLOCK; +} + float pl_get_item_duration (playItem_t *it) { return it->_duration; @@ -175,6 +175,9 @@ playItem_t * pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data); playItem_t * +plt_insert_file (playlist_t *playlist, playItem_t *after, const char *fname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data); + +playItem_t * pl_insert_item (playItem_t *after, playItem_t *it); playItem_t * @@ -217,10 +220,10 @@ int pl_get_idx_of_iter (playItem_t *it, int iter); playItem_t * -pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t *buffer, int buffersize, int numsamples, int samplerate); +plt_insert_cue_from_buffer (playlist_t *plt, playItem_t *after, playItem_t *origin, const uint8_t *buffer, int buffersize, int numsamples, int samplerate); playItem_t * -pl_insert_cue (playItem_t *after, playItem_t *origin, int numsamples, int samplerate); +plt_insert_cue (playlist_t *plt, playItem_t *after, playItem_t *origin, int numsamples, int samplerate); void pl_add_meta (playItem_t *it, const char *key, const char *value); @@ -290,6 +293,9 @@ pl_reshuffle (playItem_t **ppmin, playItem_t **ppmax); // required to calculate total playtime void +plt_set_item_duration (playlist_t *playlist, playItem_t *it, float duration); + +void pl_set_item_duration (playItem_t *it, float duration); float @@ -208,4 +208,29 @@ plt_delete_metadata (playlist_t *it, DB_metaInfo_t *meta) { } +void +plt_delete_all_meta (playlist_t *it) { + LOCK; + DB_metaInfo_t *m = it->meta; + DB_metaInfo_t *prev = NULL; + while (m) { + DB_metaInfo_t *next = m->next; + if (m->key[0] == ':') { + prev = m; + } + else { + if (prev) { + prev->next = next; + } + else { + it->meta = next; + } + metacache_remove_string (m->key); + metacache_remove_string (m->value); + free (m); + } + m = next; + } + UNLOCK; +} @@ -52,4 +52,7 @@ plt_get_metadata_head (playlist_t *it); void plt_delete_metadata (playlist_t *it, DB_metaInfo_t *meta); +void +plt_delete_all_meta (playlist_t *it); + #endif @@ -136,6 +136,15 @@ static DB_functions_t deadbeef_api = { .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, + .plt_delete_metadata = (void (*) (ddb_playlist_t *handle, DB_metaInfo_t *meta))plt_delete_metadata, + .plt_find_meta_int = (int (*) (ddb_playlist_t *handle, const char *key, int def))plt_find_meta_int, + .plt_find_meta_float = (float (*) (ddb_playlist_t *handle, const char *key, float def))plt_find_meta_float, + .plt_delete_all_meta = (void (*) (ddb_playlist_t *handle))plt_delete_all_meta, + + // operating on playlist items + .plt_insert_item = (DB_playItem_t *(*) (ddb_playlist_t *playlist, DB_playItem_t *after, DB_playItem_t *it))plt_insert_item, + .plt_insert_file = (DB_playItem_t *(*) (ddb_playlist_t *playlist, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data))plt_insert_file, + .plt_set_item_duration = (void (*) (ddb_playlist_t *plt, DB_playItem_t *it, float duration))plt_set_item_duration, // playlist access .pl_lock = pl_lock, @@ -151,7 +160,7 @@ static DB_functions_t deadbeef_api = { .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 = (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_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, .pl_insert_file = (DB_playItem_t *(*) (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data))pl_insert_file, .pl_get_idx_of = (int (*) (DB_playItem_t *it))pl_get_idx_of, @@ -204,8 +213,8 @@ static DB_functions_t deadbeef_api = { .pl_get_metadata_head = (DB_metaInfo_t *(*)(DB_playItem_t *it))pl_get_metadata_head, .pl_delete_metadata = (void (*)(DB_playItem_t *, DB_metaInfo_t *))pl_delete_metadata, // cuesheet support - .pl_insert_cue_from_buffer = (DB_playItem_t *(*) (DB_playItem_t *after, DB_playItem_t *origin, const uint8_t *buffer, int buffersize, int numsamples, int samplerate))pl_insert_cue_from_buffer, - .pl_insert_cue = (DB_playItem_t *(*)(DB_playItem_t *after, DB_playItem_t *origin, int numsamples, int samplerate))pl_insert_cue, + .plt_insert_cue_from_buffer = (DB_playItem_t *(*) (ddb_playlist_t *plt, DB_playItem_t *after, DB_playItem_t *origin, const uint8_t *buffer, int buffersize, int numsamples, int samplerate))plt_insert_cue_from_buffer, + .plt_insert_cue = (DB_playItem_t *(*)(ddb_playlist_t *plt, DB_playItem_t *after, DB_playItem_t *origin, int numsamples, int samplerate))plt_insert_cue, // playqueue support .pl_playqueue_push = (int (*) (DB_playItem_t *))pl_playqueue_push, .pl_playqueue_clear = pl_playqueue_clear, diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c index 95563f51..8027c612 100644 --- a/plugins/aac/aac.c +++ b/plugins/aac/aac.c @@ -1156,7 +1156,7 @@ aac_write_metadata (DB_playItem_t *it) { #endif static DB_playItem_t * -aac_insert (DB_playItem_t *after, const char *fname) { +aac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { trace ("adding %s\n", fname); DB_FILE *fp = deadbeef->fopen (fname); if (!fp) { @@ -1284,7 +1284,7 @@ aac_insert (DB_playItem_t *after, const char *fname) { DB_playItem_t *cue = NULL; if (cuesheet) { - cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate); + cue = deadbeef->plt_insert_cue_from_buffer (plt, after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -1294,7 +1294,7 @@ aac_insert (DB_playItem_t *after, const char *fname) { } deadbeef->pl_unlock (); - cue = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); + cue = deadbeef->plt_insert_cue (plt, after, it, totalsamples, samplerate); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -1304,7 +1304,7 @@ aac_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_add_meta (it, "title", NULL); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; } diff --git a/plugins/adplug/adplug-db.cpp b/plugins/adplug/adplug-db.cpp index a25f3ffe..4b461ff1 100644 --- a/plugins/adplug/adplug-db.cpp +++ b/plugins/adplug/adplug-db.cpp @@ -241,7 +241,7 @@ adplug_add_meta (DB_playItem_t *it, const char *key, const char *value) { } DB_playItem_t * -adplug_insert (DB_playItem_t *after, const char *fname) { +adplug_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { // read information from the track // load/process cuesheet if exists // insert track into playlist @@ -285,7 +285,7 @@ adplug_insert (DB_playItem_t *after, const char *fname) { #endif deadbeef->pl_add_meta (it, "title", NULL); // insert - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); } diff --git a/plugins/adplug/plugin.c b/plugins/adplug/plugin.c index 4f2bb551..a89365f3 100644 --- a/plugins/adplug/plugin.c +++ b/plugins/adplug/plugin.c @@ -37,7 +37,7 @@ adplug_seek_sample (DB_fileinfo_t *, int sample); int adplug_seek (DB_fileinfo_t *, float time); DB_playItem_t * -adplug_insert (DB_playItem_t *after, const char *fname); +adplug_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname); int adplug_start (void); int diff --git a/plugins/ao/plugin.c b/plugins/ao/plugin.c index 6b489f45..8d5e6acb 100644 --- a/plugins/ao/plugin.c +++ b/plugins/ao/plugin.c @@ -205,7 +205,7 @@ aoplug_add_meta (DB_playItem_t *it, const char *key, const char *value, const ch } static DB_playItem_t * -aoplug_insert (DB_playItem_t *after, const char *fname) { +aoplug_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { DB_FILE *fp = deadbeef->fopen (fname); if (!fp) { trace ("psf: failed to fopen %s\n", fname); @@ -327,7 +327,7 @@ aoplug_insert (DB_playItem_t *after, const char *fname) { } deadbeef->pl_set_item_duration (it, duration+fade); deadbeef->pl_add_meta (it, "title", NULL); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; } diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c index 8bd8f296..6c4d6af7 100644 --- a/plugins/cdda/cdda.c +++ b/plugins/cdda/cdda.c @@ -303,7 +303,7 @@ resolve_disc (CdIo_t *cdio) } static DB_playItem_t * -insert_single_track (CdIo_t* cdio, DB_playItem_t *after, const char* file, int track_nr, int discid) +insert_single_track (CdIo_t* cdio, ddb_playlist_t *plt, DB_playItem_t *after, const char* file, int track_nr, int discid) { char tmp[file ? strlen (file) + 20 : 20]; if (file) @@ -330,7 +330,7 @@ insert_single_track (CdIo_t* cdio, DB_playItem_t *after, const char* file, int t deadbeef->pl_set_meta_int (it, ":CDIO_DISCID", discid); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); return after; } @@ -483,7 +483,7 @@ read_disc_cdtext (struct cddb_thread_params *params) } static DB_playItem_t * -cda_insert (DB_playItem_t *after, const char *fname) { +cda_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { trace ("CDA insert: %s\n", fname); CdIo_t* cdio = NULL; int track_nr; @@ -553,7 +553,7 @@ cda_insert (DB_playItem_t *after, const char *fname) { for (i = 0; i < tracks; i++) { trace ("inserting track %d\n", i); - res = insert_single_track (cdio, res, is_image ? fname : NULL, i+first_track, discid); + res = insert_single_track (cdio, plt, res, is_image ? fname : NULL, i+first_track, discid); if (res) { p->items[i] = res; } @@ -574,7 +574,7 @@ cda_insert (DB_playItem_t *after, const char *fname) { else { track_nr = atoi (shortname); - res = insert_single_track (cdio, after, NULL, track_nr, discid); + res = insert_single_track (cdio, plt, after, NULL, track_nr, discid); if (res) { read_track_cdtext (cdio, track_nr, res); deadbeef->pl_item_unref (res); diff --git a/plugins/dca/dcaplug.c b/plugins/dca/dcaplug.c index 6262d763..29f572e3 100644 --- a/plugins/dca/dcaplug.c +++ b/plugins/dca/dcaplug.c @@ -622,7 +622,7 @@ dts_seek (DB_fileinfo_t *_info, float time) { } static DB_playItem_t * -dts_insert (DB_playItem_t *after, const char *fname) { +dts_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { DB_FILE *fp = deadbeef->fopen (fname); if (!fp) { trace ("dca: failed to open %s\n", fname); @@ -690,7 +690,7 @@ dts_insert (DB_playItem_t *after, const char *fname) { // embedded cue DB_playItem_t *cue = NULL; - cue = deadbeef->pl_insert_cue (after, it, totalsamples, state.sample_rate); + cue = deadbeef->plt_insert_cue (plt, after, it, totalsamples, state.sample_rate); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -698,7 +698,7 @@ dts_insert (DB_playItem_t *after, const char *fname) { } deadbeef->pl_add_meta (it, "title", NULL); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; diff --git a/plugins/dumb/cdumb.c b/plugins/dumb/cdumb.c index 03c9db94..dae92e77 100644 --- a/plugins/dumb/cdumb.c +++ b/plugins/dumb/cdumb.c @@ -791,7 +791,7 @@ cdumb_read_metadata (DB_playItem_t *it) { } static DB_playItem_t * -cdumb_insert (DB_playItem_t *after, const char *fname) { +cdumb_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { const char *ext = strrchr (fname, '.'); if (ext) { ext++; @@ -816,7 +816,7 @@ cdumb_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_set_item_duration (it, duh_get_length (duh)/65536.0f); deadbeef->pl_add_meta (it, ":FILETYPE", ftype); // printf ("duration: %f\n", _info->duration); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); unload_duh (duh); diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c index 1dc98d72..99d965e2 100644 --- a/plugins/ffap/ffap.c +++ b/plugins/ffap/ffap.c @@ -1735,7 +1735,7 @@ error: } static DB_playItem_t * -ffap_insert (DB_playItem_t *after, const char *fname) { +ffap_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { APEContext ape_ctx; memset (&ape_ctx, 0, sizeof (ape_ctx)); DB_FILE *fp = deadbeef->fopen (fname); @@ -1786,7 +1786,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) { const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); DB_playItem_t *cue = NULL; if (cuesheet) { - cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), ape_ctx.totalsamples, ape_ctx.samplerate); + cue = deadbeef->plt_insert_cue_from_buffer (plt, after, it, cuesheet, strlen (cuesheet), ape_ctx.totalsamples, ape_ctx.samplerate); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -1809,7 +1809,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) { snprintf (s, sizeof (s), "%d", br); deadbeef->pl_add_meta (it, ":BITRATE", s); - cue = deadbeef->pl_insert_cue (after, it, ape_ctx.totalsamples, ape_ctx.samplerate); + cue = deadbeef->plt_insert_cue (plt, after, it, ape_ctx.totalsamples, ape_ctx.samplerate); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -1818,7 +1818,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_add_meta (it, "title", NULL); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c index b212b3a3..e79a06d7 100644 --- a/plugins/ffmpeg/ffmpeg.c +++ b/plugins/ffmpeg/ffmpeg.c @@ -457,7 +457,7 @@ ffmpeg_read_metadata_internal (DB_playItem_t *it, AVFormatContext *fctx) { } static DB_playItem_t * -ffmpeg_insert (DB_playItem_t *after, const char *fname) { +ffmpeg_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { trace ("ffmpeg_insert %s\n", fname); // read information from the track // load/process cuesheet if exists @@ -569,14 +569,14 @@ ffmpeg_insert (DB_playItem_t *after, const char *fname) { av_close_input_file(fctx); // external cuesheet - DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); + DB_playItem_t *cue = deadbeef->plt_insert_cue (plt, after, it, totalsamples, samplerate); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); return cue; } // now the track is ready, insert into playlist - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; } diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 678837b9..4e52cee2 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -605,7 +605,7 @@ cflac_init_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__Str } static DB_playItem_t * -cflac_insert (DB_playItem_t *after, const char *fname) { +cflac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { trace ("flac: inserting %s\n", fname); DB_playItem_t *it = NULL; FLAC__StreamDecoder *decoder = NULL; @@ -712,7 +712,7 @@ cflac_insert (DB_playItem_t *after, const char *fname) { // try embedded cue const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); if (cuesheet) { - DB_playItem_t *last = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), info.totalsamples, info.info.fmt.samplerate); + DB_playItem_t *last = deadbeef->plt_insert_cue_from_buffer (plt, after, it, cuesheet, strlen (cuesheet), info.totalsamples, info.info.fmt.samplerate); if (last) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (last); @@ -721,7 +721,7 @@ cflac_insert (DB_playItem_t *after, const char *fname) { } // try external cue - DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, it, info.totalsamples, info.info.fmt.samplerate); + DB_playItem_t *cue_after = deadbeef->plt_insert_cue (plt, after, it, info.totalsamples, info.info.fmt.samplerate); if (cue_after) { if (info.file) { deadbeef->fclose (info.file); @@ -731,7 +731,7 @@ cflac_insert (DB_playItem_t *after, const char *fname) { trace ("flac: loaded external cuesheet\n"); return cue_after; } - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); if (info.file) { deadbeef->fclose (info.file); diff --git a/plugins/gme/cgme.c b/plugins/gme/cgme.c index dee03081..35070d7c 100644 --- a/plugins/gme/cgme.c +++ b/plugins/gme/cgme.c @@ -245,7 +245,7 @@ cgme_add_meta (DB_playItem_t *it, const char *key, const char *value) { } static DB_playItem_t * -cgme_insert (DB_playItem_t *after, const char *fname) { +cgme_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { Music_Emu *emu; trace ("gme_open_file %s\n", fname); @@ -351,7 +351,7 @@ cgme_insert (DB_playItem_t *after, const char *fname) { } } } - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); } else { diff --git a/plugins/m3u/m3u.c b/plugins/m3u/m3u.c index 18ed73c2..fae1f6c6 100644 --- a/plugins/m3u/m3u.c +++ b/plugins/m3u/m3u.c @@ -39,7 +39,7 @@ skipspaces (const uint8_t *p, const uint8_t *end) { } static DB_playItem_t * -load_m3u (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data) { +load_m3u (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data) { printf ("load_m3u: cb=%p\n", cb); const char *slash = strrchr (fname, '/'); trace ("enter pl_insert_m3u\n"); @@ -121,13 +121,13 @@ load_m3u (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_pla } static DB_playItem_t * -pls_insert_file (DB_playItem_t *after, const char *fname, const char *uri, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data, const char *title, const char *length) { +pls_insert_file (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, const char *uri, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data, const char *title, const char *length) { trace ("pls_insert_file uri: %s\n", uri); DB_playItem_t *it = NULL; const char *slash = NULL; if (strrchr (uri, '/')) { - it = deadbeef->pl_insert_file (after, uri, pabort, cb, user_data); + it = deadbeef->plt_insert_file (plt, after, uri, pabort, cb, user_data); } else if (slash = strrchr (fname, '/')) { int l = strlen (uri); @@ -135,10 +135,10 @@ pls_insert_file (DB_playItem_t *after, const char *fname, const char *uri, int * memcpy (fullpath, fname, slash - fname + 1); strcpy (fullpath + (slash - fname + 1), uri); trace ("pls_insert_file: adding file %s\n", fullpath); - it = deadbeef->pl_insert_file (after, fullpath, pabort, cb, user_data); + it = deadbeef->plt_insert_file (plt, after, fullpath, pabort, cb, user_data); } if (length[0]) { - deadbeef->pl_set_item_duration (it, atoi (length)); + deadbeef->plt_set_item_duration (plt, it, atoi (length)); } if (title[0]) { deadbeef->pl_replace_meta (it, "title", title); @@ -147,7 +147,7 @@ pls_insert_file (DB_playItem_t *after, const char *fname, const char *uri, int * } static DB_playItem_t * -load_pls (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data) { +load_pls (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data) { const char *slash = strrchr (fname, '/'); DB_FILE *fp = deadbeef->fopen (fname); if (!fp) { @@ -204,7 +204,7 @@ load_pls (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_pla int idx = atoi (p + 4); if (uri[0] && idx != lastidx && lastidx != -1) { trace ("uri%d\n", idx); - DB_playItem_t *it = pls_insert_file (after, fname, uri, pabort, cb, user_data, title, length); + DB_playItem_t *it = pls_insert_file (plt, after, fname, uri, pabort, cb, user_data, title, length); if (it) { after = it; } @@ -244,7 +244,7 @@ load_pls (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_pla int idx = atoi (p + 5); if (uri[0] && idx != lastidx && lastidx != -1) { trace ("title%d\n", idx); - DB_playItem_t *it = pls_insert_file (after, fname, uri, pabort, cb, user_data, title, length); + DB_playItem_t *it = pls_insert_file (plt, after, fname, uri, pabort, cb, user_data, title, length); if (it) { after = it; } @@ -283,7 +283,7 @@ load_pls (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_pla int idx = atoi (p + 6); if (uri[0] && idx != lastidx && lastidx != -1) { trace ("length%d\n", idx); - DB_playItem_t *it = pls_insert_file (after, fname, uri, pabort, cb, user_data, title, length); + DB_playItem_t *it = pls_insert_file (plt, after, fname, uri, pabort, cb, user_data, title, length); if (it) { after = it; } @@ -327,7 +327,7 @@ load_pls (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_pla p = e; } if (uri[0]) { - DB_playItem_t *it = pls_insert_file (after, fname, uri, pabort, cb, user_data, title, length); + DB_playItem_t *it = pls_insert_file (plt, after, fname, uri, pabort, cb, user_data, title, length); if (it) { after = it; } @@ -340,7 +340,7 @@ load_pls (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_pla } static DB_playItem_t * -m3uplug_load (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data) { +m3uplug_load (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data) { const char *ext = strrchr (fname, '.'); if (!ext) { return NULL; @@ -348,10 +348,10 @@ m3uplug_load (DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB ext++; if (!strcasecmp (ext, "m3u") || !strcasecmp (ext, "m3u8")) { - return load_m3u (after, fname, pabort, cb, user_data); + return load_m3u (plt, after, fname, pabort, cb, user_data); } else if (!strcasecmp (ext, "pls")) { - return load_pls (after, fname, pabort, cb, user_data); + return load_pls (plt, after, fname, pabort, cb, user_data); } return NULL; @@ -428,7 +428,7 @@ m3uplug_save_pls (const char *fname, DB_playItem_t *first, DB_playItem_t *last) } int -m3uplug_save (const char *fname, DB_playItem_t *first, DB_playItem_t *last) { +m3uplug_save (ddb_playlist_t *plt, const char *fname, DB_playItem_t *first, DB_playItem_t *last) { const char *e = strrchr (fname, '.'); if (!e) { return -1; diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index 4354d3c8..e0d806b8 100644 --- a/plugins/mpgmad/mpgmad.c +++ b/plugins/mpgmad/mpgmad.c @@ -1299,7 +1299,7 @@ cmp3_seek (DB_fileinfo_t *_info, float time) { } static DB_playItem_t * -cmp3_insert (DB_playItem_t *after, const char *fname) { +cmp3_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { trace ("cmp3_insert %s\n", fname); DB_FILE *fp = deadbeef->fopen (fname); if (!fp) { @@ -1311,7 +1311,7 @@ cmp3_insert (DB_playItem_t *after, const char *fname) { deadbeef->fclose (fp); deadbeef->pl_add_meta (it, "title", NULL); deadbeef->pl_set_item_duration (it, -1); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; } @@ -1347,18 +1347,18 @@ cmp3_insert (DB_playItem_t *after, const char *fname) { buffer.it = it; cmp3_set_extra_properties (&buffer); - deadbeef->pl_set_item_duration (it, buffer.duration); + deadbeef->plt_set_item_duration (plt, it, buffer.duration); deadbeef->fclose (fp); // FIXME! bad numsamples passed to cue - DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, it, buffer.totalsamples-buffer.delay-buffer.padding, buffer.samplerate); + DB_playItem_t *cue_after = deadbeef->plt_insert_cue (plt, after, it, buffer.totalsamples-buffer.delay-buffer.padding, buffer.samplerate); if (cue_after) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue_after); return cue_after; } - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; } diff --git a/plugins/musepack/musepack.c b/plugins/musepack/musepack.c index e6b22c00..68f93013 100644 --- a/plugins/musepack/musepack.c +++ b/plugins/musepack/musepack.c @@ -319,7 +319,7 @@ mpc_set_trk_properties (DB_playItem_t *it, mpc_streaminfo *si, int64_t fsize) { } static DB_playItem_t * -musepack_insert (DB_playItem_t *after, const char *fname) { +musepack_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { trace ("mpc: inserting %s\n", fname); mpc_reader reader = { .read = musepack_vfs_read, @@ -417,7 +417,7 @@ musepack_insert (DB_playItem_t *after, const char *fname) { mpc_set_trk_properties (it, &si, fsize); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); prev = it; deadbeef->pl_item_unref (it); } @@ -448,7 +448,7 @@ musepack_insert (DB_playItem_t *after, const char *fname) { const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); DB_playItem_t *cue = NULL; if (cuesheet) { - cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), totalsamples, si.sample_freq); + cue = deadbeef->plt_insert_cue_from_buffer (plt, after, it, cuesheet, strlen (cuesheet), totalsamples, si.sample_freq); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -461,7 +461,7 @@ musepack_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_unlock (); mpc_set_trk_properties (it, &si, fsize); - cue = deadbeef->pl_insert_cue (after, it, totalsamples, si.sample_freq); + cue = deadbeef->plt_insert_cue (plt, after, it, totalsamples, si.sample_freq); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -472,7 +472,7 @@ musepack_insert (DB_playItem_t *after, const char *fname) { } deadbeef->pl_add_meta (it, "title", NULL); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); mpc_demux_exit (demux); diff --git a/plugins/shn/shn.c b/plugins/shn/shn.c index 04b00575..c8e0a773 100644 --- a/plugins/shn/shn.c +++ b/plugins/shn/shn.c @@ -860,7 +860,7 @@ shn_seek (DB_fileinfo_t *_info, float time) { } DB_playItem_t * -shn_insert (DB_playItem_t *after, const char *fname) { +shn_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { shn_file *tmp_file; DB_FILE *f; char data[4]; @@ -918,7 +918,7 @@ shn_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_add_meta (it, ":BITRATE", s); deadbeef->pl_add_meta (it, "title", NULL); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; } diff --git a/plugins/sid/csid.cpp b/plugins/sid/csid.cpp index 20293812..569c1083 100644 --- a/plugins/sid/csid.cpp +++ b/plugins/sid/csid.cpp @@ -444,7 +444,7 @@ convstr (const char* str) { } extern "C" DB_playItem_t * -csid_insert (DB_playItem_t *after, const char *fname) { +csid_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { trace ("inserting %s\n", fname); sldb_load (); SidTune *tune; @@ -569,7 +569,7 @@ csid_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_set_item_duration (it, length); deadbeef->pl_add_meta (it, ":FILETYPE", "SID"); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); } } diff --git a/plugins/sid/csid.h b/plugins/sid/csid.h index 66ad0ff5..e40f8c69 100644 --- a/plugins/sid/csid.h +++ b/plugins/sid/csid.h @@ -28,7 +28,7 @@ int csid_init (DB_fileinfo_t *_info, DB_playItem_t *it); void csid_free (DB_fileinfo_t *); int csid_read (DB_fileinfo_t *, char *bytes, int size); int csid_seek (DB_fileinfo_t *, float time); -DB_playItem_t *csid_insert (DB_playItem_t *after, const char *fname); +DB_playItem_t *csid_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname); int csid_numvoices (DB_fileinfo_t *); void csid_mutevoice (DB_fileinfo_t *, int voice, int mute); int csid_start (void); diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c index e8a6231e..259fdfd6 100644 --- a/plugins/sndfile/sndfile.c +++ b/plugins/sndfile/sndfile.c @@ -294,7 +294,7 @@ sndfile_seek (DB_fileinfo_t *_info, float sec) { } static DB_playItem_t * -sndfile_insert (DB_playItem_t *after, const char *fname) { +sndfile_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { SF_INFO inf; sndfile_info_t info; memset (&info, 0, sizeof (info)); @@ -355,7 +355,7 @@ sndfile_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_add_meta (it, ":BITRATE", s); - DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); + DB_playItem_t *cue_after = deadbeef->plt_insert_cue (plt, after, it, totalsamples, samplerate); if (cue_after) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue_after); @@ -363,7 +363,7 @@ sndfile_insert (DB_playItem_t *after, const char *fname) { } deadbeef->pl_add_meta (it, "title", NULL); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; diff --git a/plugins/tta/ttaplug.c b/plugins/tta/ttaplug.c index 95bac3c5..30f7fc38 100644 --- a/plugins/tta/ttaplug.c +++ b/plugins/tta/ttaplug.c @@ -178,7 +178,7 @@ tta_seek (DB_fileinfo_t *_info, float time) { } static DB_playItem_t * -tta_insert (DB_playItem_t *after, const char *fname) { +tta_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { tta_info tta; if (open_tta_file (fname, &tta, 0) != 0) { fprintf (stderr, "tta: failed to open %s\n", fname); @@ -213,7 +213,7 @@ tta_insert (DB_playItem_t *after, const char *fname) { const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); DB_playItem_t *cue = NULL; if (cuesheet) { - cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), totalsamples, tta.SAMPLERATE); + cue = deadbeef->plt_insert_cue_from_buffer (plt, after, it, cuesheet, strlen (cuesheet), totalsamples, tta.SAMPLERATE); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -235,7 +235,7 @@ tta_insert (DB_playItem_t *after, const char *fname) { snprintf (s, sizeof (s), "%d", tta.BITRATE); deadbeef->pl_add_meta (it, ":BITRATE", s); - cue = deadbeef->pl_insert_cue (after, it, totalsamples, tta.SAMPLERATE); + cue = deadbeef->plt_insert_cue (plt, after, it, totalsamples, tta.SAMPLERATE); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -243,7 +243,7 @@ tta_insert (DB_playItem_t *after, const char *fname) { } deadbeef->pl_add_meta (it, "title", NULL); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 5f94a474..07630735 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -451,7 +451,7 @@ cvorbis_seek (DB_fileinfo_t *_info, float time) { } static DB_playItem_t * -cvorbis_insert (DB_playItem_t *after, const char *fname) { +cvorbis_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { // check for validity DB_FILE *fp = deadbeef->fopen (fname); if (!fp) { @@ -464,7 +464,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_add_meta (it, ":FILETYPE", "OggVorbis"); deadbeef->pl_set_item_duration (it, -1); deadbeef->pl_add_meta (it, "title", NULL); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); deadbeef->fclose (fp); return after; @@ -525,7 +525,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { if (nstreams == 1) { - DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); + DB_playItem_t *cue = deadbeef->plt_insert_cue (plt, after, it, totalsamples, samplerate); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -536,7 +536,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { // embedded cue const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); if (cuesheet) { - cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate); + cue = deadbeef->plt_insert_cue_from_buffer (plt, after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate); if (cue) { deadbeef->pl_item_unref (it); deadbeef->pl_item_unref (cue); @@ -549,7 +549,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { currentsample += totalsamples; } - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); } ov_clear (&vorbis_file); diff --git a/plugins/vtx/vtx.c b/plugins/vtx/vtx.c index 891caec3..a24da110 100644 --- a/plugins/vtx/vtx.c +++ b/plugins/vtx/vtx.c @@ -228,7 +228,7 @@ vtx_seek (DB_fileinfo_t *_info, float time) { } static DB_playItem_t * -vtx_insert (DB_playItem_t *after, const char *fname) { +vtx_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { // read information from the track // load/process cuesheet if exists // insert track into playlist @@ -271,7 +271,7 @@ vtx_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_add_meta (it, "album", hdr->from); ayemu_vtx_free (hdr); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); return after; } diff --git a/plugins/wavpack/wavpack.c b/plugins/wavpack/wavpack.c index 1f3dd130..01f218f2 100644 --- a/plugins/wavpack/wavpack.c +++ b/plugins/wavpack/wavpack.c @@ -275,7 +275,7 @@ wv_seek (DB_fileinfo_t *_info, float sec) { } static DB_playItem_t * -wv_insert (DB_playItem_t *after, const char *fname) { +wv_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { DB_FILE *fp = deadbeef->fopen (fname); if (!fp) { return NULL; @@ -339,7 +339,7 @@ wv_insert (DB_playItem_t *after, const char *fname) { const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); if (cuesheet) { trace ("found cuesheet: %s\n", cuesheet); - DB_playItem_t *last = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate); + DB_playItem_t *last = deadbeef->plt_insert_cue_from_buffer (plt, after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate); if (last) { deadbeef->fclose (fp); WavpackCloseFile (ctx); @@ -349,7 +349,7 @@ wv_insert (DB_playItem_t *after, const char *fname) { } } // cue file on disc - DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); + DB_playItem_t *cue_after = deadbeef->plt_insert_cue (plt, after, it, totalsamples, samplerate); if (cue_after) { deadbeef->fclose (fp); WavpackCloseFile (ctx); @@ -358,7 +358,7 @@ wv_insert (DB_playItem_t *after, const char *fname) { return cue_after; } - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); deadbeef->fclose (fp); diff --git a/plugins/wildmidi/wildmidiplug.c b/plugins/wildmidi/wildmidiplug.c index 5ddb3c97..0db8b525 100644 --- a/plugins/wildmidi/wildmidiplug.c +++ b/plugins/wildmidi/wildmidiplug.c @@ -107,7 +107,7 @@ wmidi_seek (DB_fileinfo_t *_info, float time) { } DB_playItem_t * -wmidi_insert (DB_playItem_t *after, const char *fname) { +wmidi_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { DB_playItem_t *it = NULL; midi *m = WildMidi_Open (fname); @@ -121,7 +121,7 @@ wmidi_insert (DB_playItem_t *after, const char *fname) { deadbeef->pl_add_meta (it, "title", NULL); deadbeef->pl_set_item_duration (it, inf->approx_total_samples / 44100.f); deadbeef->pl_add_meta (it, ":FILETYPE", "MID"); - after = deadbeef->pl_insert_item (after, it); + after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); WildMidi_Close (m); return after; |