summaryrefslogtreecommitdiff
path: root/plugins/ffap/ffap.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-02-13 21:51:11 +0100
committerGravatar waker <wakeroid@gmail.com>2011-02-13 21:51:11 +0100
commitd984a3612d886027fa1509968890863d3826359f (patch)
tree7b80a7bdfb958667a194efcafa31545b0350ee41 /plugins/ffap/ffap.c
parentb892ac27f3792998ff059d612cdf3d18ac1a8c03 (diff)
added ape properties, fixed filesize property in flac and wv
Diffstat (limited to 'plugins/ffap/ffap.c')
-rw-r--r--plugins/ffap/ffap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c
index f4b3d8a8..f0c9355a 100644
--- a/plugins/ffap/ffap.c
+++ b/plugins/ffap/ffap.c
@@ -36,6 +36,7 @@
#include <stdlib.h>
//#include <alloca.h>
#include <assert.h>
+#include <math.h>
#include "../../deadbeef.h"
#ifdef TARGET_ANDROID
@@ -1741,6 +1742,9 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
if (!fp) {
return NULL;
}
+
+ int64_t fsize = deadbeef->fgetlength (fp);
+
int skip = deadbeef->junk_get_leading_size (fp);
if (skip > 0) {
deadbeef->fseek (fp, skip, SEEK_SET);
@@ -1794,6 +1798,19 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
}
deadbeef->pl_unlock ();
+ char s[100];
+ snprintf (s, sizeof (s), "%lld", fsize);
+ deadbeef->pl_add_meta (it, ":FILE_SIZE", s);
+ snprintf (s, sizeof (s), "%d", ape_ctx.bps);
+ deadbeef->pl_add_meta (it, ":BPS", s);
+ snprintf (s, sizeof (s), "%d", ape_ctx.channels);
+ deadbeef->pl_add_meta (it, ":CHANNELS", s);
+ snprintf (s, sizeof (s), "%d", ape_ctx.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);
+
cue = deadbeef->pl_insert_cue (after, it, ape_ctx.totalsamples, ape_ctx.samplerate);
if (cue) {
deadbeef->pl_item_unref (it);
@@ -1802,6 +1819,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
}
deadbeef->pl_add_meta (it, "title", NULL);
+
after = deadbeef->pl_insert_item (after, it);
deadbeef->pl_item_unref (it);