summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-05-08 21:14:30 +0200
committerGravatar waker <wakeroid@gmail.com>2011-05-08 21:14:30 +0200
commit3ec7a3d62a7383f19d4d4ee68ea9f0c66c9fe970 (patch)
treee7f95127ad480f446c10c81ffe220e581622e8e2 /plugins
parentb5ffaa4ae71ce0520d55b99e0501b92c031e860e (diff)
changed few old-style pl_* functions which were working with current playlist with the new ones, working with specific playlist passed as argument
Diffstat (limited to 'plugins')
-rw-r--r--plugins/aac/aac.c2
-rw-r--r--plugins/adplug/adplug-db.cpp2
-rw-r--r--plugins/ao/plugin.c4
-rw-r--r--plugins/cdda/cdda.c4
-rw-r--r--plugins/dca/dcaplug.c2
-rw-r--r--plugins/dumb/cdumb.c2
-rw-r--r--plugins/ffap/ffap.c2
-rw-r--r--plugins/ffmpeg/ffmpeg.c4
-rw-r--r--plugins/flac/flac.c4
-rw-r--r--plugins/gme/cgme.c4
-rw-r--r--plugins/gtkui/fileman.c21
-rw-r--r--plugins/gtkui/gtkui.c28
-rw-r--r--plugins/gtkui/gtkui.h4
-rw-r--r--plugins/m3u/m3u.c4
-rw-r--r--plugins/mpgmad/mpgmad.c14
-rw-r--r--plugins/musepack/musepack.c6
-rw-r--r--plugins/shn/shn.c2
-rw-r--r--plugins/sid/csid.cpp2
-rw-r--r--plugins/sndfile/sndfile.c2
-rw-r--r--plugins/tta/ttaplug.c2
-rw-r--r--plugins/vorbis/vorbis.c10
-rw-r--r--plugins/vtx/vtx.c2
-rw-r--r--plugins/wavpack/wavpack.c2
-rw-r--r--plugins/wildmidi/wildmidiplug.c2
24 files changed, 79 insertions, 52 deletions
diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c
index c751135d..6dfecdfd 100644
--- a/plugins/aac/aac.c
+++ b/plugins/aac/aac.c
@@ -1216,7 +1216,7 @@ aac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", ftype);
- deadbeef->pl_set_item_duration (it, duration);
+ deadbeef->plt_set_item_duration (plt, it, duration);
trace ("duration: %f sec\n", duration);
// read tags
diff --git a/plugins/adplug/adplug-db.cpp b/plugins/adplug/adplug-db.cpp
index 4b461ff1..98005298 100644
--- a/plugins/adplug/adplug-db.cpp
+++ b/plugins/adplug/adplug-db.cpp
@@ -267,7 +267,7 @@ adplug_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, adplug_plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", adplug_get_extension (fname));
deadbeef->pl_set_meta_int (it, ":TRACKNUM", i);
- deadbeef->pl_set_item_duration (it, dur);
+ deadbeef->plt_set_item_duration (plt, it, dur);
#if 0
// add metainfo
if (p->gettitle()[0]) {
diff --git a/plugins/ao/plugin.c b/plugins/ao/plugin.c
index 6be17c1e..6d7c1b1d 100644
--- a/plugins/ao/plugin.c
+++ b/plugins/ao/plugin.c
@@ -18,7 +18,7 @@
*/
#include <stdlib.h>
#include <string.h>
-#include <deadbeef/deadbeef.h>
+#include "../../deadbeef.h"
#include "ao.h"
#include "eng_protos.h"
@@ -326,7 +326,7 @@ aoplug_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
}
}
}
- deadbeef->pl_set_item_duration (it, duration+fade);
+ deadbeef->plt_set_item_duration (plt, it, duration+fade);
deadbeef->pl_add_meta (it, "title", NULL);
after = deadbeef->plt_insert_item (plt, after, it);
deadbeef->pl_item_unref (it);
diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c
index 6c4d6af7..79f11323 100644
--- a/plugins/cdda/cdda.c
+++ b/plugins/cdda/cdda.c
@@ -321,7 +321,7 @@ insert_single_track (CdIo_t* cdio, ddb_playlist_t *plt, DB_playItem_t *after, co
DB_playItem_t *it = deadbeef->pl_item_alloc_init (tmp, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", "cdda");
- deadbeef->pl_set_item_duration (it, (float)sector_count / 75.0);
+ deadbeef->plt_set_item_duration (plt, it, (float)sector_count / 75.0);
snprintf (tmp, sizeof (tmp), "CD Track %02d", track_nr);
deadbeef->pl_add_meta (it, "title", tmp);
@@ -591,7 +591,7 @@ cda_action_add_cd (DB_plugin_action_t *act, DB_playItem_t *it)
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
if (plt) {
deadbeef->pl_add_files_begin (plt);
- deadbeef->pl_add_file ("all.cda", NULL, NULL);
+ deadbeef->plt_add_file (plt, "all.cda", NULL, NULL);
deadbeef->pl_add_files_end ();
deadbeef->plt_modified (plt);
deadbeef->plt_unref (plt);
diff --git a/plugins/dca/dcaplug.c b/plugins/dca/dcaplug.c
index 29f572e3..63a8e2fd 100644
--- a/plugins/dca/dcaplug.c
+++ b/plugins/dca/dcaplug.c
@@ -684,7 +684,7 @@ dts_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", filetype);
- deadbeef->pl_set_item_duration (it, dur);
+ deadbeef->plt_set_item_duration (plt, it, dur);
deadbeef->fclose (fp);
diff --git a/plugins/dumb/cdumb.c b/plugins/dumb/cdumb.c
index e85ce37a..59eec4ef 100644
--- a/plugins/dumb/cdumb.c
+++ b/plugins/dumb/cdumb.c
@@ -814,7 +814,7 @@ cdumb_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
read_metadata_internal (it, itsd);
dumb_it_do_initial_runthrough (duh);
- deadbeef->pl_set_item_duration (it, duh_get_length (duh)/65536.0f);
+ deadbeef->plt_set_item_duration (plt, it, duh_get_length (duh)/65536.0f);
deadbeef->pl_add_meta (it, ":FILETYPE", ftype);
// printf ("duration: %f\n", _info->duration);
after = deadbeef->plt_insert_item (plt, after, it);
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c
index 99d965e2..d2fe5d2d 100644
--- a/plugins/ffap/ffap.c
+++ b/plugins/ffap/ffap.c
@@ -1766,7 +1766,7 @@ ffap_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = NULL;
it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", "APE");
- deadbeef->pl_set_item_duration (it, duration);
+ deadbeef->plt_set_item_duration (plt, it, duration);
/*int v2err = */deadbeef->junk_id3v2_read (it, fp);
int v1err = deadbeef->junk_id3v1_read (it, fp);
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index e79a06d7..742fc928 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -530,10 +530,10 @@ ffmpeg_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
deadbeef->pl_replace_meta (it, ":FILETYPE", codec->name);
if (!deadbeef->is_local_file (deadbeef->pl_find_meta (it, ":URI"))) {
- deadbeef->pl_set_item_duration (it, -1);
+ deadbeef->plt_set_item_duration (plt, it, -1);
}
else {
- deadbeef->pl_set_item_duration (it, duration);
+ deadbeef->plt_set_item_duration (plt, it, duration);
}
// add metainfo
diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c
index 4e52cee2..6485f1a4 100644
--- a/plugins/flac/flac.c
+++ b/plugins/flac/flac.c
@@ -49,6 +49,7 @@ typedef struct {
DB_FILE *file;
// used only on insert
+ ddb_playlist_t *plt;
DB_playItem_t *after;
DB_playItem_t *last;
DB_playItem_t *it;
@@ -583,7 +584,7 @@ cflac_init_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__Str
_info->fmt.channels = metadata->data.stream_info.channels;
_info->fmt.bps = metadata->data.stream_info.bits_per_sample;
info->totalsamples = metadata->data.stream_info.total_samples;
- deadbeef->pl_set_item_duration (it, metadata->data.stream_info.total_samples / (float)metadata->data.stream_info.sample_rate);
+ deadbeef->plt_set_item_duration (info->plt, it, metadata->data.stream_info.total_samples / (float)metadata->data.stream_info.sample_rate);
}
else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
const FLAC__StreamMetadata_VorbisComment *vc = &metadata->data.vorbis_comment;
@@ -614,6 +615,7 @@ cflac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
info.fname = fname;
info.after = after;
info.last = after;
+ info.plt = plt;
info.file = deadbeef->fopen (fname);
if (!info.file) {
goto cflac_insert_fail;
diff --git a/plugins/gme/cgme.c b/plugins/gme/cgme.c
index 35070d7c..57788851 100644
--- a/plugins/gme/cgme.c
+++ b/plugins/gme/cgme.c
@@ -333,10 +333,10 @@ cgme_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
cgme_add_meta (it, "track", trk);
if (inf->length == -1 || inf->length == 0) {
float songlength = deadbeef->conf_get_float ("gme.songlength", 3);
- deadbeef->pl_set_item_duration (it, songlength * 60.f);
+ deadbeef->plt_set_item_duration (plt, it, songlength * 60.f);
}
else {
- deadbeef->pl_set_item_duration (it, (float)inf->length/1000.f);
+ deadbeef->plt_set_item_duration (plt, it, (float)inf->length/1000.f);
}
const char *ext = fname + strlen (fname) - 1;
while (ext >= fname && *ext != '.') {
diff --git a/plugins/gtkui/fileman.c b/plugins/gtkui/fileman.c
index d7353d82..8947c821 100644
--- a/plugins/gtkui/fileman.c
+++ b/plugins/gtkui/fileman.c
@@ -10,13 +10,17 @@
void
gtkpl_add_dir (DdbListview *ps, char *folder) {
- gtkui_original_pl_add_dir (folder, gtkui_add_file_info_cb, NULL);
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ gtkui_original_plt_add_dir (plt, folder, gtkui_add_file_info_cb, NULL);
+ deadbeef->plt_unref (plt);
g_free (folder);
}
static void
gtkpl_adddir_cb (gpointer data, gpointer userdata) {
- gtkui_original_pl_add_dir (data, gtkui_add_file_info_cb, userdata);
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ gtkui_original_plt_add_dir (plt, data, gtkui_add_file_info_cb, userdata);
+ deadbeef->plt_unref (plt);
g_free (data);
}
@@ -52,7 +56,9 @@ gtkpl_add_dirs (GSList *lst) {
static void
gtkpl_addfile_cb (gpointer data, gpointer userdata) {
- gtkui_original_pl_add_file (data, gtkui_add_file_info_cb, userdata);
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ gtkui_original_plt_add_file (plt, data, gtkui_add_file_info_cb, userdata);
+ deadbeef->plt_unref (plt);
g_free (data);
}
@@ -170,8 +176,10 @@ set_dnd_cursor_idle (gpointer data) {
void
gtkpl_add_fm_dropped_files (DB_playItem_t *drop_before, char *ptr, int length) {
- if (deadbeef->pl_add_files_begin (deadbeef->plt_get_curr ()) < 0) {
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ if (deadbeef->pl_add_files_begin (plt) < 0) {
free (ptr);
+ deadbeef->plt_unref (plt);
return;
}
DdbListview *pl = DDB_LISTVIEW (lookup_widget (mainwin, "playlist"));
@@ -196,9 +204,9 @@ gtkpl_add_fm_dropped_files (DB_playItem_t *drop_before, char *ptr, int length) {
//strncpy (fname, p, pe - p);
//fname[pe - p] = 0;
int abort = 0;
- DdbListviewIter inserted = deadbeef->pl_insert_dir (after, fname, &abort, gtkui_add_file_info_cb, NULL);
+ DdbListviewIter inserted = deadbeef->plt_insert_dir (plt, after, fname, &abort, gtkui_add_file_info_cb, NULL);
if (!inserted && !abort) {
- inserted = deadbeef->pl_insert_file (after, fname, &abort, gtkui_add_file_info_cb, NULL);
+ inserted = deadbeef->plt_insert_file (plt, after, fname, &abort, gtkui_add_file_info_cb, NULL);
}
if (inserted) {
if (!first) {
@@ -223,6 +231,7 @@ gtkpl_add_fm_dropped_files (DB_playItem_t *drop_before, char *ptr, int length) {
free (ptr);
deadbeef->pl_add_files_end ();
+ deadbeef->plt_unref (plt);
g_idle_add (set_dnd_cursor_idle, first);
}
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 8967e2ac..8699706d 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -806,11 +806,15 @@ on_add_location_activate (GtkMenuItem *menuitem,
if (entry) {
const char *text = gtk_entry_get_text (entry);
if (text) {
- if (!deadbeef->pl_add_files_begin (deadbeef->plt_get_curr ())) {
- deadbeef->pl_add_file (text, NULL, NULL);
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ if (!deadbeef->pl_add_files_begin (plt)) {
+ deadbeef->plt_add_file (plt, text, NULL, NULL);
deadbeef->pl_add_files_end ();
playlist_refresh ();
}
+ if (plt) {
+ deadbeef->plt_unref (plt);
+ }
}
}
}
@@ -1132,22 +1136,22 @@ gtkui_add_file_info_cb (DB_playItem_t *it, void *data) {
return 0;
}
-int (*gtkui_original_pl_add_dir) (const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
-int (*gtkui_original_pl_add_file) (const char *fname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
+int (*gtkui_original_plt_add_dir) (ddb_playlist_t *plt, const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
+int (*gtkui_original_plt_add_file) (ddb_playlist_t *plt, const char *fname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
int (*gtkui_original_pl_add_files_begin) (ddb_playlist_t *plt);
void (*gtkui_original_pl_add_files_end) (void);
DB_playItem_t * (*gtkui_original_plt_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);
int
-gtkui_pl_add_dir (const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data) {
- int res = gtkui_original_pl_add_dir (dirname, gtkui_add_file_info_cb, NULL);
+gtkui_plt_add_dir (ddb_playlist_t *plt, const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data) {
+ int res = gtkui_original_plt_add_dir (plt, dirname, gtkui_add_file_info_cb, NULL);
return res;
}
int
-gtkui_pl_add_file (const char *filename, int (*cb)(DB_playItem_t *it, void *data), void *user_data) {
- int res = gtkui_original_pl_add_file (filename, gtkui_add_file_info_cb, NULL);
+gtkui_plt_add_file (ddb_playlist_t *plt, const char *filename, int (*cb)(DB_playItem_t *it, void *data), void *user_data) {
+ int res = gtkui_original_plt_add_file (plt, filename, gtkui_add_file_info_cb, NULL);
return res;
}
@@ -1211,11 +1215,11 @@ gtkui_start (void) {
}
// override default file adding APIs to show progress bar
- gtkui_original_pl_add_dir = deadbeef->pl_add_dir;
- deadbeef->pl_add_dir = gtkui_pl_add_dir;
+ gtkui_original_plt_add_dir = deadbeef->plt_add_dir;
+ deadbeef->plt_add_dir = gtkui_plt_add_dir;
- gtkui_original_pl_add_file = deadbeef->pl_add_file;
- deadbeef->pl_add_file = gtkui_pl_add_file;
+ gtkui_original_plt_add_file = deadbeef->plt_add_file;
+ deadbeef->plt_add_file = gtkui_plt_add_file;
gtkui_original_pl_add_files_begin = deadbeef->pl_add_files_begin;
deadbeef->pl_add_files_begin = gtkui_pl_add_files_begin;
diff --git a/plugins/gtkui/gtkui.h b/plugins/gtkui/gtkui.h
index dfc73455..073262c5 100644
--- a/plugins/gtkui/gtkui.h
+++ b/plugins/gtkui/gtkui.h
@@ -154,8 +154,8 @@ gtkui_set_progress_text_idle (gpointer data);
int
gtkui_add_file_info_cb (DB_playItem_t *it, void *data);
-extern int (*gtkui_original_pl_add_dir) (const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
-extern int (*gtkui_original_pl_add_file) (const char *fname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
+extern int (*gtkui_original_plt_add_dir) (ddb_playlist_t *plt, const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
+extern int (*gtkui_original_plt_add_file) (ddb_playlist_t *plt, const char *fname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
void
gtkui_focus_on_playing_track (void);
diff --git a/plugins/m3u/m3u.c b/plugins/m3u/m3u.c
index fae1f6c6..e293dc2a 100644
--- a/plugins/m3u/m3u.c
+++ b/plugins/m3u/m3u.c
@@ -87,7 +87,7 @@ load_m3u (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pab
DB_playItem_t *it = NULL;
if (strrchr (nm, '/')) {
trace ("pl_insert_m3u: adding file %s\n", nm);
- it = deadbeef->pl_insert_file (after, nm, pabort, cb, user_data);
+ it = deadbeef->plt_insert_file (plt, after, nm, pabort, cb, user_data);
}
else {
int l = strlen (nm);
@@ -95,7 +95,7 @@ load_m3u (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pab
memcpy (fullpath, fname, slash - fname + 1);
strcpy (fullpath + (slash - fname + 1), nm);
trace ("pl_insert_m3u: 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 (it) {
after = it;
diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c
index 3b7c23b5..adda106c 100644
--- a/plugins/mpgmad/mpgmad.c
+++ b/plugins/mpgmad/mpgmad.c
@@ -823,7 +823,11 @@ cmp3_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
trace ("mp3 totalsamples: %d\n", info->buffer.endsample-info->buffer.startsample+1);
}
else {
- deadbeef->pl_set_item_duration (it, info->buffer.duration);
+ ddb_playlist_t *plt = deadbeef->pl_get_playlist (it);
+ deadbeef->plt_set_item_duration (plt, it, info->buffer.duration);
+ if (plt) {
+ deadbeef->plt_unref (plt);
+ }
info->buffer.startsample = info->buffer.delay;
info->buffer.endsample = info->buffer.totalsamples-info->buffer.padding-1;
trace ("mp3 totalsamples: %d (%d, %d, %d | %d %d)\n", info->buffer.endsample-info->buffer.startsample+1, info->buffer.totalsamples, info->buffer.delay, info->buffer.padding, info->buffer.startsample, info->buffer.endsample);
@@ -854,7 +858,11 @@ cmp3_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
cmp3_set_extra_properties (&info->buffer);
- deadbeef->pl_set_item_duration (it, info->buffer.duration);
+ ddb_playlist_t *plt = deadbeef->pl_get_playlist (it);
+ deadbeef->plt_set_item_duration (plt, it, info->buffer.duration);
+ if (plt) {
+ deadbeef->plt_unref (plt);
+ }
if (info->buffer.duration >= 0) {
info->buffer.endsample = info->buffer.totalsamples - 1;
}
@@ -1310,7 +1318,7 @@ cmp3_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->fclose (fp);
deadbeef->pl_add_meta (it, "title", NULL);
- deadbeef->pl_set_item_duration (it, -1);
+ deadbeef->plt_set_item_duration (plt, it, -1);
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 68f93013..2a5d9766 100644
--- a/plugins/musepack/musepack.c
+++ b/plugins/musepack/musepack.c
@@ -401,11 +401,11 @@ musepack_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
else {
prev->endsample = it->startsample-1;
float dur = (prev->endsample - prev->startsample) / (float)si.sample_freq;
- deadbeef->pl_set_item_duration (prev, dur);
+ deadbeef->plt_set_item_duration (plt, prev, dur);
}
if (i == nchapters - 1) {
float dur = (it->endsample - it->startsample) / (float)si.sample_freq;
- deadbeef->pl_set_item_duration (it, dur);
+ deadbeef->plt_set_item_duration (plt, it, dur);
}
if (ch->tag_size > 0) {
uint8_t *tag = ch->tag;
@@ -432,7 +432,7 @@ musepack_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", "MusePack");
- deadbeef->pl_set_item_duration (it, dur);
+ deadbeef->plt_set_item_duration (plt, it, dur);
/*int apeerr = */deadbeef->junk_apev2_read (it, fp);
deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_ALBUMGAIN, gain_album);
diff --git a/plugins/shn/shn.c b/plugins/shn/shn.c
index c8e0a773..c7f20149 100644
--- a/plugins/shn/shn.c
+++ b/plugins/shn/shn.c
@@ -896,7 +896,7 @@ shn_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", "Shorten");
- deadbeef->pl_set_item_duration (it, tmp_file->wave_header.length);
+ deadbeef->plt_set_item_duration (plt, it, tmp_file->wave_header.length);
int apeerr = deadbeef->junk_apev2_read (it, tmp_file->vars.fd);
int v2err = deadbeef->junk_id3v2_read (it, tmp_file->vars.fd);
diff --git a/plugins/sid/csid.cpp b/plugins/sid/csid.cpp
index 569c1083..b82491e7 100644
--- a/plugins/sid/csid.cpp
+++ b/plugins/sid/csid.cpp
@@ -566,7 +566,7 @@ csid_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
// trace ("\n");
// }
}
- deadbeef->pl_set_item_duration (it, length);
+ deadbeef->plt_set_item_duration (plt, it, length);
deadbeef->pl_add_meta (it, ":FILETYPE", "SID");
after = deadbeef->plt_insert_item (plt, after, it);
diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c
index 259fdfd6..f5db72d6 100644
--- a/plugins/sndfile/sndfile.c
+++ b/plugins/sndfile/sndfile.c
@@ -318,7 +318,7 @@ sndfile_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
float duration = (float)totalsamples / samplerate;
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", "wav");
- deadbeef->pl_set_item_duration (it, duration);
+ deadbeef->plt_set_item_duration (plt, it, duration);
trace ("sndfile: totalsamples=%d, samplerate=%d, duration=%f\n", totalsamples, samplerate, duration);
diff --git a/plugins/tta/ttaplug.c b/plugins/tta/ttaplug.c
index 30f7fc38..3c44003d 100644
--- a/plugins/tta/ttaplug.c
+++ b/plugins/tta/ttaplug.c
@@ -195,7 +195,7 @@ tta_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", "TTA");
- deadbeef->pl_set_item_duration (it, dur);
+ deadbeef->plt_set_item_duration (plt, it, dur);
close_tta_file (&tta);
DB_FILE *fp = deadbeef->fopen (fname);
diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c
index ad95d649..f64645df 100644
--- a/plugins/vorbis/vorbis.c
+++ b/plugins/vorbis/vorbis.c
@@ -220,7 +220,11 @@ cvorbis_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
trace ("ov_open_callbacks returned %d\n", err);
return -1;
}
- deadbeef->pl_set_item_duration (it, -1);
+ ddb_playlist_t *plt = deadbeef->pl_get_playlist (it);
+ deadbeef->plt_set_item_duration (plt, it, -1);
+ if (plt) {
+ deadbeef->plt_unref (plt);
+ }
deadbeef->pl_replace_meta (it, ":FILETYPE", "OggVorbis");
}
else
@@ -463,7 +467,7 @@ cvorbis_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
if (fp->vfs->is_streaming ()) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", "OggVorbis");
- deadbeef->pl_set_item_duration (it, -1);
+ deadbeef->plt_set_item_duration (plt, it, -1);
deadbeef->pl_add_meta (it, "title", NULL);
after = deadbeef->plt_insert_item (plt, after, it);
deadbeef->pl_item_unref (it);
@@ -500,7 +504,7 @@ cvorbis_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", "OggVorbis");
deadbeef->pl_set_meta_int (it, ":TRACKNUM", stream);
- deadbeef->pl_set_item_duration (it, duration);
+ deadbeef->plt_set_item_duration (plt, it, duration);
if (nstreams > 1) {
it->startsample = currentsample;
it->endsample = currentsample + totalsamples;
diff --git a/plugins/vtx/vtx.c b/plugins/vtx/vtx.c
index a24da110..ffb14c7e 100644
--- a/plugins/vtx/vtx.c
+++ b/plugins/vtx/vtx.c
@@ -263,7 +263,7 @@ vtx_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
int numframes = hdr->regdata_size / AY_FRAME_SIZE;
// int totalsamples = numframes * hdr->playerFreq;
trace ("vtx: numframes=%d, playerFreq=%d\n", numframes, hdr->playerFreq);
- deadbeef->pl_set_item_duration (it, (float)numframes / hdr->playerFreq);
+ deadbeef->plt_set_item_duration (plt, it, (float)numframes / hdr->playerFreq);
// add metadata
deadbeef->pl_add_meta (it, "title", hdr->title);
diff --git a/plugins/wavpack/wavpack.c b/plugins/wavpack/wavpack.c
index 01f218f2..75f1d47b 100644
--- a/plugins/wavpack/wavpack.c
+++ b/plugins/wavpack/wavpack.c
@@ -297,7 +297,7 @@ wv_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
deadbeef->pl_add_meta (it, ":FILETYPE", "wv");
- deadbeef->pl_set_item_duration (it, duration);
+ deadbeef->plt_set_item_duration (plt, it, duration);
trace ("wv: totalsamples=%d, samplerate=%d, duration=%f\n", totalsamples, samplerate, duration);
#if 0
diff --git a/plugins/wildmidi/wildmidiplug.c b/plugins/wildmidi/wildmidiplug.c
index 0db8b525..d989c695 100644
--- a/plugins/wildmidi/wildmidiplug.c
+++ b/plugins/wildmidi/wildmidiplug.c
@@ -119,7 +119,7 @@ wmidi_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
struct _WM_Info *inf = WildMidi_GetInfo (m);
it = deadbeef->pl_item_alloc_init (fname, wmidi_plugin.plugin.id);
deadbeef->pl_add_meta (it, "title", NULL);
- deadbeef->pl_set_item_duration (it, inf->approx_total_samples / 44100.f);
+ deadbeef->plt_set_item_duration (plt, it, inf->approx_total_samples / 44100.f);
deadbeef->pl_add_meta (it, ":FILETYPE", "MID");
after = deadbeef->plt_insert_item (plt, after, it);
deadbeef->pl_item_unref (it);