diff options
author | Serge Ziryukin <ftrvxmtrx@gmail.com> | 2009-07-09 17:13:09 +0300 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-07-09 19:01:24 +0200 |
commit | 75c0a33ec5fcce72358c1d5625885890114d1889 (patch) | |
tree | c5a4f722869fdaaf2c6fc4494af1a3e17ec6d7b1 | |
parent | 8ae9b45da06fc48a54e90a7394dbe7592deb36a2 (diff) | |
download | mpd-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".
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/decoder/flac_plugin.c | 14 |
2 files changed, 15 insertions, 0 deletions
@@ -9,6 +9,7 @@ ver 0.16 (20??/??/??) * decoders: - ffmpeg: support multiple tags - sndfile: new decoder plugin based on libsndfile + - flac: load external cue sheet when no internal one * mixers: - removed support for legacy mixer configuration - reimplemented software volume as mixer+filter plugin 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) |