From cc8b7859c5d6f89db65361aeaea147ca3aeed7c1 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Thu, 31 Jul 2014 16:40:11 +0200 Subject: flac: after ignoring a bad FLAC__METADATA_TYPE_CUESHEET, don't give up, but try to load CUE from other sources --- plugins/flac/flac.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'plugins') diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 40744ff6..e30cf848 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -627,7 +627,7 @@ cflac_insert_with_embedded_cue (ddb_playlist_t *plt, DB_playItem_t *after, DB_pl // first check if cuesheet is matching the data for (int i = 0; i < cuesheet->num_tracks; i++) { if (cuesheet->tracks[i].offset >= totalsamples) { - fprintf (stderr, "The flac %s has invalid embedded cuesheet. You should remove it using metaflac.\n", deadbeef->pl_find_meta_raw (origin, ":URI")); + fprintf (stderr, "The flac %s has invalid FLAC__METADATA_TYPE_CUESHEET block, which will get ignored. You should remove it using metaflac.\n", deadbeef->pl_find_meta_raw (origin, ":URI")); return NULL; } } @@ -842,17 +842,15 @@ cflac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { return cue; } } - else { - const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); - if (cuesheet) { - DB_playItem_t *last = deadbeef->plt_insert_cue_from_buffer (plt, after, it, (const uint8_t *)cuesheet, strlen (cuesheet), info.totalsamples, info.info.fmt.samplerate); - if (last) { - cflac_free_temp (_info); - deadbeef->pl_item_unref (it); - deadbeef->pl_item_unref (last); - deadbeef->pl_unlock (); - return last; - } + const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); + if (cuesheet) { + DB_playItem_t *last = deadbeef->plt_insert_cue_from_buffer (plt, after, it, (const uint8_t *)cuesheet, strlen (cuesheet), info.totalsamples, info.info.fmt.samplerate); + if (last) { + cflac_free_temp (_info); + deadbeef->pl_item_unref (it); + deadbeef->pl_item_unref (last); + deadbeef->pl_unlock (); + return last; } } deadbeef->pl_unlock (); -- cgit v1.2.3