From fc10a78a92fab1fff627236a1b5d3f22b9d2554e Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 13 Feb 2011 21:59:20 +0100 Subject: added extra properties to vorbis plugin --- plugins/vorbis/vorbis.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index c4958d39..05f8ca7b 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H # include #endif @@ -427,6 +428,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { trace ("vorbis: failed to fopen %s\n", fname); return NULL; } + int64_t fsize = deadbeef->fgetlength (fp); if (fp->vfs->is_streaming ()) { DB_playItem_t *it = deadbeef->pl_item_alloc (); it->fname = strdup (fname); @@ -482,6 +484,19 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { update_vorbis_comments (it, vc, 0); int samplerate = vi->rate; + char s[100]; + snprintf (s, sizeof (s), "%lld", fsize); + deadbeef->pl_add_meta (it, ":FILE_SIZE", s); + deadbeef->pl_add_meta (it, ":BPS", "16"); + snprintf (s, sizeof (s), "%d", vi->channels); + deadbeef->pl_add_meta (it, ":CHANNELS", s); + snprintf (s, sizeof (s), "%d", samplerate); + deadbeef->pl_add_meta (it, ":SAMPLERATE", s); + int br = (int)roundf(fsize / duration * 8 / 1000); + snprintf (s, sizeof (s), "%d", br); + deadbeef->pl_add_meta (it, ":BITRATE", s); + + if (nstreams == 1) { DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate); if (cue) { -- cgit v1.2.3