summaryrefslogtreecommitdiff
path: root/plugins/musepack
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-08-19 21:56:13 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-08-19 21:56:13 +0200
commit8437abdf435233fc0490e063bda30c7daa00e50b (patch)
treef84b65fbacc58b7e6e24b1c759c335592ebe0197 /plugins/musepack
parent2011d37a462fd7121717b6cd7567fb84d12cd0e4 (diff)
added metadata support to musepack chapters
Diffstat (limited to 'plugins/musepack')
-rw-r--r--plugins/musepack/musepack.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/musepack/musepack.c b/plugins/musepack/musepack.c
index 4333c98e..ec3091b4 100644
--- a/plugins/musepack/musepack.c
+++ b/plugins/musepack/musepack.c
@@ -339,6 +339,7 @@ musepack_insert (DB_playItem_t *after, const char *fname) {
// chapters
int nchapters = mpc_demux_chap_nb (demux);
DB_playItem_t *prev = NULL;
+ DB_playItem_t *meta = NULL;
if (nchapters > 1) {
int i;
for (i = 0; i < nchapters; i++) {
@@ -351,15 +352,24 @@ musepack_insert (DB_playItem_t *after, const char *fname) {
it->startsample = ch->sample;
it->endsample = totalsamples-1;
deadbeef->pl_set_item_flags (it, DDB_IS_SUBTRACK);
- if (prev) {
+ if (!prev) {
+ /*int apeerr = */deadbeef->junk_apev2_read (it, fp);
+ meta = it;
+ }
+ else {
prev->endsample = it->startsample-1;
float dur = (prev->endsample - prev->startsample) / (float)si.sample_freq;
deadbeef->pl_set_item_duration (prev, dur);
+ deadbeef->pl_items_copy_junk (meta, it, it);
}
if (i == nchapters - 1) {
float dur = (it->endsample - it->startsample) / (float)si.sample_freq;
deadbeef->pl_set_item_duration (it, dur);
}
+ if (ch->tag_size > 0) {
+ uint8_t *tag = ch->tag;
+ deadbeef->junk_apev2_read_mem (it, ch->tag, ch->tag_size);
+ }
after = deadbeef->pl_insert_item (after, it);
prev = it;
deadbeef->pl_item_unref (it);