summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-03-24 21:30:11 +0100
committerGravatar waker <wakeroid@gmail.com>2011-03-24 21:30:11 +0100
commitfd04c7a395f4ac26942222e29e2dd9a8901bff41 (patch)
tree0ed33d33f0171603c7f6503b52f5512770e59fcd
parent2278425be18b7600c055e54e5777b44858e1af4e (diff)
got rid of filetype field in playitem structure
-rw-r--r--deadbeef.h1
-rw-r--r--playlist.c45
-rw-r--r--playlist.h1
-rw-r--r--plugins/aac/aac.c2
-rw-r--r--plugins/adplug/adplug-db.cpp2
-rw-r--r--plugins/ao/plugin.c18
-rw-r--r--plugins/cdda/cdda.c2
-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.c12
-rw-r--r--plugins/flac/flac.c2
-rw-r--r--plugins/gme/cgme.c4
-rw-r--r--plugins/gtkui/gtkui.c6
-rw-r--r--plugins/mpgmad/mpgmad.c10
-rw-r--r--plugins/musepack/musepack.c4
-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.c4
-rw-r--r--plugins/vtx/vtx.c2
-rw-r--r--plugins/wavpack/wavpack.c2
-rw-r--r--plugins/wildmidi/wildmidiplug.c2
-rw-r--r--streamer.c8
25 files changed, 70 insertions, 71 deletions
diff --git a/deadbeef.h b/deadbeef.h
index 85071b75..e800b4fc 100644
--- a/deadbeef.h
+++ b/deadbeef.h
@@ -109,7 +109,6 @@ typedef struct DB_playItem_s {
int shufflerating; // sort order for shuffle mode
float playtime; // actual playback time of this track in seconds
time_t started_timestamp; // result of calling time(NULL)
- const char *filetype; // e.g. MP3 or OGG
} DB_playItem_t;
typedef struct DB_metaInfo_s {
diff --git a/playlist.c b/playlist.c
index 2f53c368..ffb8130d 100644
--- a/playlist.c
+++ b/playlist.c
@@ -876,7 +876,7 @@ pl_process_cue_track (playItem_t *after, const char *fname, playItem_t **prev, c
pl_set_meta_int (it, ":TRACKNUM", atoi (track));
it->startsample = index01[0] ? f_index01 * samplerate : 0;
it->endsample = -1; // will be filled by next read, or by decoder
- it->filetype = ftype;
+ pl_replace_meta (it, ":FILETYPE", ftype);
if (performer[0]) {
pl_add_meta (it, "artist", performer);
if (albumperformer[0]) {
@@ -991,7 +991,8 @@ pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t
trace ("cue: adding track: %s %s %s\n", origin->fname, title, track);
if (title[0]) {
// add previous track
- after = pl_process_cue_track (after, pl_find_meta (origin, ":URI"), &prev, track, index00, index01, pregap, title, albumperformer, performer, albumtitle, genre, date, replaygain_album_gain, replaygain_album_peak, replaygain_track_gain, replaygain_track_peak, pl_find_meta (origin, ":DECODER"), origin->filetype, samplerate);
+ const char *filetype = pl_find_meta (origin, ":FILETYPE");
+ after = pl_process_cue_track (after, pl_find_meta (origin, ":URI"), &prev, track, index00, index01, pregap, title, albumperformer, performer, albumtitle, genre, date, replaygain_album_gain, replaygain_album_peak, replaygain_track_gain, replaygain_track_peak, pl_find_meta (origin, ":DECODER"), filetype, samplerate);
trace ("cue: added %p (%p)\n", after);
}
@@ -1035,7 +1036,8 @@ pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t
UNLOCK;
return NULL;
}
- after = pl_process_cue_track (after, pl_find_meta (origin, ":URI"), &prev, track, index00, index01, pregap, title, albumperformer, performer, albumtitle, genre, date, replaygain_album_gain, replaygain_album_peak, replaygain_track_gain, replaygain_track_peak, pl_find_meta (origin, ":DECODER"), origin->filetype, samplerate);
+ const char *filetype = pl_find_meta (origin, ":FILETYPE");
+ after = pl_process_cue_track (after, pl_find_meta (origin, ":URI"), &prev, track, index00, index01, pregap, title, albumperformer, performer, albumtitle, genre, date, replaygain_album_gain, replaygain_album_peak, replaygain_track_gain, replaygain_track_peak, pl_find_meta (origin, ":DECODER"), filetype, samplerate);
if (after) {
trace ("last track endsample: %d\n", numsamples-1);
after->endsample = numsamples-1;
@@ -1472,7 +1474,7 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla
}
playItem_t *it = pl_item_alloc_init (fname, NULL);
- it->filetype = "content";
+ pl_replace_meta (it, ":FILETYPE", "content");
pl_add_meta (it, "title", NULL);
after = plt_insert_item (addfiles_playlist ? addfiles_playlist : playlist, after, it);
pl_item_unref (it);
@@ -1803,7 +1805,6 @@ pl_item_copy (playItem_t *out, playItem_t *it) {
out->startsample = it->startsample;
out->endsample = it->endsample;
out->shufflerating = it->shufflerating;
- out->filetype = it->filetype;
out->_duration = it->_duration;
out->started_timestamp = it->started_timestamp;
out->next[PL_MAIN] = it->next[PL_MAIN];
@@ -2192,12 +2193,16 @@ pl_save (const char *fname) {
if (fwrite (&it->_duration, 1, 4, fp) != 4) {
goto save_fail;
}
- uint8_t ft = it->filetype ? strlen (it->filetype) : 0;
+ const char *filetype = pl_find_meta (it, ":FILETYPE");
+ if (!filetype) {
+ filetype = "";
+ }
+ uint8_t ft = strlen (filetype);
if (fwrite (&ft, 1, 1, fp) != 1) {
goto save_fail;
}
if (ft) {
- if (fwrite (it->filetype, 1, ft, fp) != ft) {
+ if (fwrite (filetype, 1, ft, fp) != ft) {
goto save_fail;
}
}
@@ -2450,7 +2455,8 @@ pl_load (const char *fname) {
char s[100];
pl_format_time (it->_duration, s, sizeof(s));
pl_replace_meta (it, ":DURATION", s);
- // get const filetype string from decoder
+
+ // legacy filetype support
uint8_t ft;
if (fread (&ft, 1, 1, fp) != 1) {
goto load_fail;
@@ -2461,20 +2467,7 @@ pl_load (const char *fname) {
goto load_fail;
}
ftype[ft] = 0;
- if (!strcmp (ftype, "content")) {
- it->filetype = "content";
- }
- else if (decoder_id[0]) {
- DB_decoder_t *dec = plug_get_decoder_for_id (decoder_id);
- if (dec && dec->filetypes) {
- for (int i = 0; dec->filetypes[i]; i++) {
- if (!strcasecmp (dec->filetypes[i], ftype)) {
- it->filetype = dec->filetypes[i];
- break;
- }
- }
- }
- }
+ pl_replace_meta (it, ":FILETYPE", ftype);
}
float f;
@@ -2557,7 +2550,13 @@ pl_load (const char *fname) {
goto load_fail;
}
value[l] = 0;
- pl_add_meta (it, key, value);
+ if (key[0] == ':') {
+ // to avoid storage conflicts -- give more priority to metadata
+ pl_replace_meta (it, key, value);
+ }
+ else {
+ pl_add_meta (it, key, value);
+ }
}
}
plt_insert_item (plt, plt->tail[PL_MAIN], it);
diff --git a/playlist.h b/playlist.h
index 1a13ef8d..40cfa1d6 100644
--- a/playlist.h
+++ b/playlist.h
@@ -35,7 +35,6 @@ typedef struct playItem_s {
int shufflerating; // sort order for shuffle mode
float playtime; // total playtime
time_t started_timestamp; // result of calling time(NULL)
- const char *filetype; // e.g. MP3 or OGG
// private area, must not be visible to plugins
float _duration;
uint32_t _flags;
diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c
index 903b189e..08679a55 100644
--- a/plugins/aac/aac.c
+++ b/plugins/aac/aac.c
@@ -1121,7 +1121,7 @@ aac_insert (DB_playItem_t *after, const char *fname) {
}
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = ftype;
+ deadbeef->pl_add_meta (it, ":FILETYPE", ftype);
deadbeef->pl_set_item_duration (it, duration);
trace ("duration: %f sec\n", duration);
diff --git a/plugins/adplug/adplug-db.cpp b/plugins/adplug/adplug-db.cpp
index 973da0da..a25f3ffe 100644
--- a/plugins/adplug/adplug-db.cpp
+++ b/plugins/adplug/adplug-db.cpp
@@ -265,7 +265,7 @@ adplug_insert (DB_playItem_t *after, const char *fname) {
continue;
}
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, adplug_plugin.plugin.id);
- it->filetype = adplug_get_extension (fname);
+ 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);
#if 0
diff --git a/plugins/ao/plugin.c b/plugins/ao/plugin.c
index 77eba78c..6c9233dc 100644
--- a/plugins/ao/plugin.c
+++ b/plugins/ao/plugin.c
@@ -259,26 +259,26 @@ aoplug_insert (DB_playItem_t *after, const char *fname) {
if (*ext == '.') {
ext++;
if (!strcasecmp (ext, "psf") || !strcasecmp (ext, "minipsf")) {
- it->filetype = filetypes[0];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[0]);
}
else if (!strcasecmp (ext, "psf2") || !strcasecmp (ext, "minipsf2")) {
- it->filetype = filetypes[1];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[1]);
}
else if (!strcasecmp (ext, "spu")) {
- it->filetype = filetypes[2];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[2]);
}
else if (!strcasecmp (ext, "ssf") || !strcasecmp (ext, "minissf")) {
- it->filetype = filetypes[3];
- }
- else if (!strcasecmp (ext, "dsf") || !strcasecmp (ext, "minidsf")) {
- it->filetype = filetypes[5];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[3]);
}
else if (!strcasecmp (ext, "qsf") || !strcasecmp (ext, "miniqsf")) {
- it->filetype = filetypes[4];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[4]);
+ }
+ else if (!strcasecmp (ext, "dsf") || !strcasecmp (ext, "minidsf")) {
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[5]);
}
}
else {
- it->filetype = filetypes[0];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[0]);
}
float duration = 120;
diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c
index d23bac38..55352e97 100644
--- a/plugins/cdda/cdda.c
+++ b/plugins/cdda/cdda.c
@@ -286,7 +286,7 @@ insert_single_track (CdIo_t* cdio, DB_playItem_t *after, const char* file, int t
int sector_count = cdio_get_track_sec_count (cdio, track_nr);
DB_playItem_t *it = deadbeef->pl_item_alloc_init (tmp, plugin.plugin.id);
- it->filetype = "cdda";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "cdda");
deadbeef->pl_set_item_duration (it, (float)sector_count / 75.0);
snprintf (tmp, sizeof (tmp), "CD Track %02d", track_nr);
diff --git a/plugins/dca/dcaplug.c b/plugins/dca/dcaplug.c
index 034e5fdc..8642c7b0 100644
--- a/plugins/dca/dcaplug.c
+++ b/plugins/dca/dcaplug.c
@@ -607,7 +607,7 @@ dts_insert (DB_playItem_t *after, const char *fname) {
}
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = filetype;
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetype);
deadbeef->pl_set_item_duration (it, dur);
deadbeef->fclose (fp);
diff --git a/plugins/dumb/cdumb.c b/plugins/dumb/cdumb.c
index 5b665f9b..b5367640 100644
--- a/plugins/dumb/cdumb.c
+++ b/plugins/dumb/cdumb.c
@@ -814,7 +814,7 @@ cdumb_insert (DB_playItem_t *after, const char *fname) {
dumb_it_do_initial_runthrough (duh);
deadbeef->pl_set_item_duration (it, duh_get_length (duh)/65536.0f);
- it->filetype = ftype;
+ deadbeef->pl_add_meta (it, ":FILETYPE", ftype);
// printf ("duration: %f\n", _info->duration);
after = deadbeef->pl_insert_item (after, it);
deadbeef->pl_item_unref (it);
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c
index 4c414a9f..7abf0103 100644
--- a/plugins/ffap/ffap.c
+++ b/plugins/ffap/ffap.c
@@ -1765,7 +1765,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
float duration = ape_ctx.totalsamples / (float)ape_ctx.samplerate;
DB_playItem_t *it = NULL;
it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = "APE";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "APE");
deadbeef->pl_set_item_duration (it, duration);
/*int v2err = */deadbeef->junk_id3v2_read (it, fp);
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index 25dda2ca..823f64a1 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -166,19 +166,19 @@ ffmpeg_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
}
if (!strcasecmp (info->codec->name, "alac")) {
- it->filetype = filetypes[FT_ALAC];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[FT_ALAC]);
}
else if (strcasestr (info->codec->name, "wma")) {
- it->filetype = filetypes[FT_WMA];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[FT_WMA]);
}
else if (strcasestr (info->codec->name, "ac3")) {
- it->filetype = filetypes[FT_AC3];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[FT_AC3]);
}
else if (strcasestr (info->codec->name, "amr")) {
- it->filetype = filetypes[FT_AMR];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[FT_AMR]);
}
else {
- it->filetype = filetypes[FT_UNKNOWN];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[FT_UNKNOWN]);
}
int bps = av_get_bits_per_sample_format (info->ctx->sample_fmt);
@@ -543,7 +543,7 @@ ffmpeg_insert (DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
// FIXME: get proper codec
- it->filetype = filetypes[FT_UNKNOWN];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[FT_UNKNOWN]);
if (!deadbeef->is_local_file (deadbeef->pl_find_meta (it, ":URI"))) {
deadbeef->pl_set_item_duration (it, -1);
diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c
index 87a81db1..0f4c729d 100644
--- a/plugins/flac/flac.c
+++ b/plugins/flac/flac.c
@@ -688,7 +688,7 @@ cflac_insert (DB_playItem_t *after, const char *fname) {
}
FLAC__stream_decoder_delete(decoder);
decoder = NULL;
- it->filetype = isogg ? "OggFLAC" : "FLAC";
+ deadbeef->pl_add_meta (it, ":FILETYPE", isogg ? "OggFLAC" : "FLAC");
char s[100];
int64_t fsize = deadbeef->fgetlength (info.file);
diff --git a/plugins/gme/cgme.c b/plugins/gme/cgme.c
index 5b6a436f..8eb6d8d3 100644
--- a/plugins/gme/cgme.c
+++ b/plugins/gme/cgme.c
@@ -339,12 +339,12 @@ cgme_insert (DB_playItem_t *after, const char *fname) {
while (ext >= fname && *ext != '.') {
ext--;
}
- it->filetype = NULL;
if (*ext == '.') {
ext++;
for (int i = 0; plugin.exts[i]; i++) {
if (!strcasecmp (ext, plugin.exts[i])) {
- it->filetype = plugin.exts[i];
+ deadbeef->pl_add_meta (it, ":FILETYPE", plugin.exts[i]);
+ break;
}
}
}
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 15afcf6b..f2c6d30d 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -190,7 +190,11 @@ update_songinfo (gpointer ctx) {
}
}
const char *spaused = deadbeef->get_output ()->state () == OUTPUT_STATE_PAUSED ? _("Paused | ") : "";
- snprintf (sbtext_new, sizeof (sbtext_new), _("%s%s %s| %dHz | %d bit | %s | %d:%02d / %s | %d tracks | %s total playtime"), spaused, track->filetype ? track->filetype:"-", sbitrate, samplerate, bitspersample, mode, minpos, secpos, t, deadbeef->pl_getcount (PL_MAIN), totaltime_str);
+ const char *filetype = deadbeef->pl_find_meta (track, ":FILETYPE");
+ if (!filetype) {
+ filetype = "-";
+ }
+ snprintf (sbtext_new, sizeof (sbtext_new), _("%s%s %s| %dHz | %d bit | %s | %d:%02d / %s | %d tracks | %s total playtime"), spaused, filetype, sbitrate, samplerate, bitspersample, mode, minpos, secpos, t, deadbeef->pl_getcount (PL_MAIN), totaltime_str);
}
if (strcmp (sbtext_new, sb_text)) {
diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c
index dd6be528..29ea88b9 100644
--- a/plugins/mpgmad/mpgmad.c
+++ b/plugins/mpgmad/mpgmad.c
@@ -737,7 +737,7 @@ cmp3_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
}
else {
deadbeef->fset_track (info->buffer.file, it);
- info->buffer.it->filetype = NULL;
+ deadbeef->pl_delete_meta (info->buffer.it, ":FILETYPE");
int64_t len = deadbeef->fgetlength (info->buffer.file);
if (len > 0) {
deadbeef->pl_delete_all_meta (it);
@@ -1008,10 +1008,11 @@ cmp3_stream_frame (mpgmad_info_t *info) {
}
}
- if (!info->buffer.it->filetype) {
+ const char *filetype = deadbeef->pl_find_meta (info->buffer.it, ":FILETYPE");
+ if (!filetype) {
int layer = info->frame.header.layer;
if (layer >= 1 && layer <= 3) {
- info->buffer.it->filetype = plugin.filetypes[layer-1];
+ deadbeef->pl_replace_meta (info->buffer.it, ":FILETYPE", plugin.filetypes[layer-1]);
}
}
@@ -1254,7 +1255,6 @@ 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);
- it->filetype = NULL;
after = deadbeef->pl_insert_item (after, it);
deadbeef->pl_item_unref (it);
return after;
@@ -1331,7 +1331,7 @@ cmp3_insert (DB_playItem_t *after, const char *fname) {
cmp3_set_extra_properties (&buffer);
deadbeef->pl_set_item_duration (it, buffer.duration);
- it->filetype = ftype;
+ deadbeef->pl_replace_meta (it, ":FILETYPE", ftype);
deadbeef->fclose (fp);
// FIXME! bad numsamples passed to cue
diff --git a/plugins/musepack/musepack.c b/plugins/musepack/musepack.c
index 26eede96..7f34c624 100644
--- a/plugins/musepack/musepack.c
+++ b/plugins/musepack/musepack.c
@@ -378,7 +378,7 @@ musepack_insert (DB_playItem_t *after, const char *fname) {
for (i = 0; i < nchapters; i++) {
const mpc_chap_info *ch = mpc_demux_chap (demux, i);
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = "MusePack";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "MusePack");
deadbeef->pl_set_meta_int (it, ":TRACKNUM", i);
it->startsample = ch->sample;
it->endsample = totalsamples-1;
@@ -431,7 +431,7 @@ musepack_insert (DB_playItem_t *after, const char *fname) {
}
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = "MusePack";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "MusePack");
deadbeef->pl_set_item_duration (it, dur);
/*int apeerr = */deadbeef->junk_apev2_read (it, fp);
diff --git a/plugins/shn/shn.c b/plugins/shn/shn.c
index 7d33de5e..87440ee2 100644
--- a/plugins/shn/shn.c
+++ b/plugins/shn/shn.c
@@ -894,7 +894,7 @@ shn_insert (DB_playItem_t *after, const char *fname) {
}
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = "Shorten";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "Shorten");
deadbeef->pl_set_item_duration (it, tmp_file->wave_header.length);
int apeerr = deadbeef->junk_apev2_read (it, tmp_file->vars.fd);
diff --git a/plugins/sid/csid.cpp b/plugins/sid/csid.cpp
index 2e8d00a8..dd176e05 100644
--- a/plugins/sid/csid.cpp
+++ b/plugins/sid/csid.cpp
@@ -566,7 +566,7 @@ csid_insert (DB_playItem_t *after, const char *fname) {
// }
}
deadbeef->pl_set_item_duration (it, length);
- it->filetype = "SID";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "SID");
after = deadbeef->pl_insert_item (after, it);
deadbeef->pl_item_unref (it);
diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c
index 57d09763..f9a7369f 100644
--- a/plugins/sndfile/sndfile.c
+++ b/plugins/sndfile/sndfile.c
@@ -316,7 +316,7 @@ sndfile_insert (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);
- it->filetype = "wav";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "wav");
deadbeef->pl_set_item_duration (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 22df3ad0..b83e805b 100644
--- a/plugins/tta/ttaplug.c
+++ b/plugins/tta/ttaplug.c
@@ -194,7 +194,7 @@ tta_insert (DB_playItem_t *after, const char *fname) {
double dur = tta.LENGTH;
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = "TTA";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "TTA");
deadbeef->pl_set_item_duration (it, dur);
close_tta_file (&tta);
diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c
index 2317e67d..691e40f3 100644
--- a/plugins/vorbis/vorbis.c
+++ b/plugins/vorbis/vorbis.c
@@ -450,7 +450,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) {
int64_t fsize = deadbeef->fgetlength (fp);
if (fp->vfs->is_streaming ()) {
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = "OggVorbis";
+ 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);
@@ -486,7 +486,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) {
int totalsamples = ov_pcm_total (&vorbis_file, stream);
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = "OggVorbis";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "OggVorbis");
deadbeef->pl_set_meta_int (it, ":TRACKNUM", stream);
deadbeef->pl_set_item_duration (it, duration);
if (nstreams > 1) {
diff --git a/plugins/vtx/vtx.c b/plugins/vtx/vtx.c
index 27777981..aa62422e 100644
--- a/plugins/vtx/vtx.c
+++ b/plugins/vtx/vtx.c
@@ -259,7 +259,7 @@ vtx_insert (DB_playItem_t *after, const char *fname) {
trace ("vtx: datasize: %d\n", hdr->regdata_size);
DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
- it->filetype = filetypes[0];
+ deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[0]);
int numframes = hdr->regdata_size / AY_FRAME_SIZE;
// int totalsamples = numframes * hdr->playerFreq;
diff --git a/plugins/wavpack/wavpack.c b/plugins/wavpack/wavpack.c
index 6646183b..39f2e66f 100644
--- a/plugins/wavpack/wavpack.c
+++ b/plugins/wavpack/wavpack.c
@@ -296,7 +296,7 @@ wv_insert (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);
- it->filetype = "wv";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "wv");
deadbeef->pl_set_item_duration (it, duration);
trace ("wv: totalsamples=%d, samplerate=%d, duration=%f\n", totalsamples, samplerate, duration);
diff --git a/plugins/wildmidi/wildmidiplug.c b/plugins/wildmidi/wildmidiplug.c
index ca26e497..b12de3f1 100644
--- a/plugins/wildmidi/wildmidiplug.c
+++ b/plugins/wildmidi/wildmidiplug.c
@@ -120,7 +120,7 @@ wmidi_insert (DB_playItem_t *after, const char *fname) {
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);
- it->filetype = "MID";
+ deadbeef->pl_add_meta (it, ":FILETYPE", "MID");
after = deadbeef->pl_insert_item (after, it);
deadbeef->pl_item_unref (it);
WildMidi_Close (m);
diff --git a/streamer.c b/streamer.c
index ea6b3352..26cd4885 100644
--- a/streamer.c
+++ b/streamer.c
@@ -599,7 +599,8 @@ streamer_set_current (playItem_t *it) {
plug_trigger_event_trackinfochanged (from);
}
const char *decoder_id = pl_find_meta (it, ":DECODER");
- if (!decoder_id && it->filetype && !strcmp (it->filetype, "content")) {
+ const char *filetype = pl_find_meta (it, ":FILETYPE");
+ if (!decoder_id && filetype && !strcmp (filetype, "content")) {
// try to get content-type
mutex_lock (decodemutex);
trace ("\033[0;34mopening file %s\033[37;0m\n", pl_find_meta (it, ":URI"));
@@ -638,7 +639,7 @@ streamer_set_current (playItem_t *it) {
if (!strcmp (decoders[i]->plugin.id, plug)) {
pl_replace_meta (it, ":DECODER", decoders[i]->plugin.id);
decoder_id = decoders[i]->plugin.id;
- it->filetype = decoders[i]->filetypes[0];
+ pl_replace_meta (it, ":FILETYPE", decoders[i]->filetypes[0]);
trace ("\033[0;34mfound plugin %s\033[37;0m\n", plug);
}
}
@@ -1641,9 +1642,6 @@ streamer_read (char *bytes, int size) {
playpos += (float)sz/output->fmt.samplerate/((output->fmt.bps>>3)*output->fmt.channels) * dsp_ratio;
playing_track->playtime += (float)sz/output->fmt.samplerate/((output->fmt.bps>>3)*output->fmt.channels);
if (playlist_track) {
- playing_track->filetype = playlist_track->filetype;
- }
- if (playlist_track) {
playlist_track->playtime = playing_track->playtime;
}
if (bytes_until_next_song > 0) {