summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-09-03 21:48:05 +0200
committerGravatar waker <wakeroid@gmail.com>2009-09-03 21:48:05 +0200
commitc92e90a5159ac7a81b6f859b16779cea804707ef (patch)
treeb28fb395317d9752e8290d8bf8595179e1551553 /plugins
parentbdd655e1d6dc660a81529ba06b82f91670d11d6f (diff)
tag reader is now exposed through plugin API; fixed some mp3 parsing problems
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ape/ape.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/plugins/ape/ape.c b/plugins/ape/ape.c
index e4fed9ac..6ce1d05c 100644
--- a/plugins/ape/ape.c
+++ b/plugins/ape/ape.c
@@ -125,9 +125,9 @@ ape_insert (DB_playItem_t *after, const char *fname) {
ape_decompress_get_info_data (dec, APE_INFO_WAVEFORMATEX, &wfe);
float duration = ape_decompress_get_info_int (dec, APE_DECOMPRESS_TOTAL_BLOCKS) / (float)wfe.nSamplesPerSec;
+ ape_decompress_destroy (dec);
DB_playItem_t *it = deadbeef->pl_insert_cue (after, fname, &plugin, "APE", duration);
if (it) {
- ape_decompress_destroy (dec);
return it;
}
@@ -136,12 +136,28 @@ ape_insert (DB_playItem_t *after, const char *fname) {
it->fname = strdup (fname);
it->filetype = "APE";
it->duration = duration;
-
+
+ // try to read tags
+ FILE *fp = fopen (fname, "rb");
+ if (!fp) {
+ deadbeef->pl_item_free (it);
+ return NULL;
+ }
+
+ int v2err = deadbeef->junk_read_id3v2 (it, fp);
+ int v1err = deadbeef->junk_read_id3v1 (it, fp);
+ if (v1err >= 0) {
+ fseek (fp, -128, SEEK_END);
+ }
+ else {
+ fseek (fp, 0, SEEK_END);
+ }
+ int apeerr = deadbeef->junk_read_ape (it, fp);
deadbeef->pl_add_meta (it, "title", NULL);
+ fclose (fp);
+
after = deadbeef->pl_insert_item (after, it);
- // print info about ape
- ape_decompress_destroy (dec);
return after;
}