diff options
author | waker <wakeroid@gmail.com> | 2011-03-24 21:30:11 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-03-24 21:30:11 +0100 |
commit | fd04c7a395f4ac26942222e29e2dd9a8901bff41 (patch) | |
tree | 0ed33d33f0171603c7f6503b52f5512770e59fcd /plugins | |
parent | 2278425be18b7600c055e54e5777b44858e1af4e (diff) |
got rid of filetype field in playitem structure
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/aac/aac.c | 2 | ||||
-rw-r--r-- | plugins/adplug/adplug-db.cpp | 2 | ||||
-rw-r--r-- | plugins/ao/plugin.c | 18 | ||||
-rw-r--r-- | plugins/cdda/cdda.c | 2 | ||||
-rw-r--r-- | plugins/dca/dcaplug.c | 2 | ||||
-rw-r--r-- | plugins/dumb/cdumb.c | 2 | ||||
-rw-r--r-- | plugins/ffap/ffap.c | 2 | ||||
-rw-r--r-- | plugins/ffmpeg/ffmpeg.c | 12 | ||||
-rw-r--r-- | plugins/flac/flac.c | 2 | ||||
-rw-r--r-- | plugins/gme/cgme.c | 4 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.c | 6 | ||||
-rw-r--r-- | plugins/mpgmad/mpgmad.c | 10 | ||||
-rw-r--r-- | plugins/musepack/musepack.c | 4 | ||||
-rw-r--r-- | plugins/shn/shn.c | 2 | ||||
-rw-r--r-- | plugins/sid/csid.cpp | 2 | ||||
-rw-r--r-- | plugins/sndfile/sndfile.c | 2 | ||||
-rw-r--r-- | plugins/tta/ttaplug.c | 2 | ||||
-rw-r--r-- | plugins/vorbis/vorbis.c | 4 | ||||
-rw-r--r-- | plugins/vtx/vtx.c | 2 | ||||
-rw-r--r-- | plugins/wavpack/wavpack.c | 2 | ||||
-rw-r--r-- | plugins/wildmidi/wildmidiplug.c | 2 |
21 files changed, 45 insertions, 41 deletions
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); |