aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorSerge Ziryukin <ftrvxmtrx@gmail.com>2009-07-09 17:13:09 +0300
committerMax Kellermann <max@duempel.org>2009-07-09 19:01:24 +0200
commit75c0a33ec5fcce72358c1d5625885890114d1889 (patch)
treec5a4f722869fdaaf2c6fc4494af1a3e17ec6d7b1 /src/decoder
parent8ae9b45da06fc48a54e90a7394dbe7592deb36a2 (diff)
downloadmpd-75c0a33ec5fcce72358c1d5625885890114d1889.tar.gz
mpd-75c0a33ec5fcce72358c1d5625885890114d1889.tar.xz
mpd-75c0a33ec5fcce72358c1d5625885890114d1889.zip
flac: load external cue sheet when no internal one
External cue sheet file for "file.flac" should be named as "file.flac.cue".
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/flac_plugin.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index 965a8b46b..b235469f2 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -300,6 +300,8 @@ flac_cue_tag_load(const char *file)
FLAC__uint64 track_time = 0;
#ifdef HAVE_CUE /* libcue */
FLAC__StreamMetadata* vc = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ char* cs_filename;
+ FILE* cs_file;
#endif /* libcue */
FLAC__StreamMetadata* si = FLAC__metadata_object_new(FLAC__METADATA_TYPE_STREAMINFO);
FLAC__StreamMetadata* cs = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET);
@@ -328,6 +330,18 @@ flac_cue_tag_load(const char *file)
}
FLAC__metadata_object_delete(vc);
}
+
+ if (tag == NULL) {
+ cs_filename = g_strconcat(file, ".cue", NULL);
+
+ cs_file = fopen(cs_filename, "rt");
+ g_free(cs_filename);
+
+ if (cs_file != NULL) {
+ tag = cue_tag_file(cs_file, tnum);
+ fclose(cs_file);
+ }
+ }
#endif /* libcue */
if (tag == NULL)