flac: load external cue sheet when no internal one

External cue sheet file for "file.flac" should be named as "file.flac.cue".
This commit is contained in:
Serge Ziryukin 2009-07-09 17:13:09 +03:00 committed by Max Kellermann
parent 8ae9b45da0
commit 75c0a33ec5
2 changed files with 15 additions and 0 deletions

1
NEWS
View File

@ -9,6 +9,7 @@ ver 0.16 (20??/??/??)
* decoders: * decoders:
- ffmpeg: support multiple tags - ffmpeg: support multiple tags
- sndfile: new decoder plugin based on libsndfile - sndfile: new decoder plugin based on libsndfile
- flac: load external cue sheet when no internal one
* mixers: * mixers:
- removed support for legacy mixer configuration - removed support for legacy mixer configuration
- reimplemented software volume as mixer+filter plugin - reimplemented software volume as mixer+filter plugin

View File

@ -300,6 +300,8 @@ flac_cue_tag_load(const char *file)
FLAC__uint64 track_time = 0; FLAC__uint64 track_time = 0;
#ifdef HAVE_CUE /* libcue */ #ifdef HAVE_CUE /* libcue */
FLAC__StreamMetadata* vc = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); FLAC__StreamMetadata* vc = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
char* cs_filename;
FILE* cs_file;
#endif /* libcue */ #endif /* libcue */
FLAC__StreamMetadata* si = FLAC__metadata_object_new(FLAC__METADATA_TYPE_STREAMINFO); FLAC__StreamMetadata* si = FLAC__metadata_object_new(FLAC__METADATA_TYPE_STREAMINFO);
FLAC__StreamMetadata* cs = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET); 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); 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 */ #endif /* libcue */
if (tag == NULL) if (tag == NULL)