From 044a715c61f1b78cb569fd7711d794296b61b994 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Sat, 2 Jan 2010 13:45:23 +0100 Subject: changed cuesheet loading APIs, embedded metadata now adds up with cuesheet metadata --- plugins/ffap/ffap.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'plugins/ffap') diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c index e04ca40d..d737df02 100644 --- a/plugins/ffap/ffap.c +++ b/plugins/ffap/ffap.c @@ -1651,13 +1651,6 @@ ffap_insert (DB_playItem_t *after, const char *fname) { float duration = ape_ctx.totalsamples / (float)ape_ctx.samplerate; DB_playItem_t *it = NULL; - it = deadbeef->pl_insert_cue (after, fname, &plugin, "APE", ape_ctx.totalsamples, ape_ctx.samplerate); - if (it) { - deadbeef->fclose (fp); - ape_free_ctx (&ape_ctx); - return it; - } - it = deadbeef->pl_item_alloc (); it->decoder = &plugin; it->fname = strdup (fname); @@ -1675,22 +1668,27 @@ ffap_insert (DB_playItem_t *after, const char *fname) { /*int apeerr = */deadbeef->junk_read_ape (it, fp); deadbeef->fclose (fp); + ape_free_ctx (&ape_ctx); + + DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, ape_ctx.totalsamples, ape_ctx.samplerate); + if (cue) { + deadbeef->pl_item_free (it); + return cue; + } // embedded cue const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); if (cuesheet) { - DB_playItem_t *last = deadbeef->pl_insert_cue_from_buffer (after, fname, cuesheet, strlen (cuesheet), &plugin, plugin.filetypes[0], ape_ctx.totalsamples, ape_ctx.samplerate); - if (last) { + cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), ape_ctx.totalsamples, ape_ctx.samplerate); + if (cue) { deadbeef->pl_item_free (it); - ape_free_ctx (&ape_ctx); - return last; + return cue; } } deadbeef->pl_add_meta (it, "title", NULL); after = deadbeef->pl_insert_item (after, it); - ape_free_ctx (&ape_ctx); return after; } -- cgit v1.2.3