summaryrefslogtreecommitdiff
path: root/plugins/vorbis
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-02-13 21:59:20 +0100
committerGravatar waker <wakeroid@gmail.com>2011-02-13 21:59:20 +0100
commitfc10a78a92fab1fff627236a1b5d3f22b9d2554e (patch)
tree02c4ce1ba07d9ec55d977864c1ea44e1ce3f5a62 /plugins/vorbis
parentd984a3612d886027fa1509968890863d3826359f (diff)
added extra properties to vorbis plugin
Diffstat (limited to 'plugins/vorbis')
-rw-r--r--plugins/vorbis/vorbis.c15
1 files changed, 15 insertions, 0 deletions
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 <assert.h>
#include <limits.h>
#include <unistd.h>
+#include <math.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#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) {