diff options
author | Mario Lenz <m@riolenz.de> | 2009-03-15 23:31:07 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-16 19:38:34 +0100 |
commit | 36dab871f12a6e82a7837e782e79a4ec3828de64 (patch) | |
tree | 9bb57001d965d2a1a38712b9f9e4ffd5ad04969a /src/decoder/flac_plugin.c | |
parent | d47ef51cb351e8ad09ee7688749cb63a18f42916 (diff) | |
download | mpd-36dab871f12a6e82a7837e782e79a4ec3828de64.tar.gz mpd-36dab871f12a6e82a7837e782e79a4ec3828de64.tar.xz mpd-36dab871f12a6e82a7837e782e79a4ec3828de64.zip |
flac: get CUE track titles from additional FLAC comments
The cue sheet embedded in a flac file doen't contain any information
about track titles and similar. There are three possibilities: Use an
external cue sheet that includes these information, use a tag CUESHEET
with a cue sheet including these information or use tags. I think the
latter is the best option and is already used by other projects.
Diffstat (limited to '')
-rw-r--r-- | src/decoder/flac_plugin.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c index 1eac7cfe0..bde1cb7e2 100644 --- a/src/decoder/flac_plugin.c +++ b/src/decoder/flac_plugin.c @@ -227,7 +227,7 @@ flac_write_cb(const flac_decoder *dec, const FLAC__Frame *frame, } static struct tag * -flac_tag_load(const char *file) +flac_tag_load(const char *file, const char *char_tnum) { struct tag *tag; FLAC__Metadata_SimpleIterator *it; @@ -265,7 +265,7 @@ flac_tag_load(const char *file) if (!block) break; if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - flac_vorbis_comments_to_tag(tag, block); + flac_vorbis_comments_to_tag(tag, char_tnum, block); } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) { tag->time = ((float)block->data.stream_info.total_samples) / block->data.stream_info.sample_rate + 0.5; @@ -298,13 +298,13 @@ flac_cue_tag_load(const char *file) FLAC__StreamMetadata* cs = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET); tnum = flac_vtrack_tnum(file); + char_tnum = g_strdup_printf("%u", tnum); slash = strrchr(file, '/'); *slash = '\0'; - tag = flac_tag_load(file); + tag = flac_tag_load(file, char_tnum); - char_tnum = g_strdup_printf("%u", tnum); if (char_tnum != NULL) { tag_add_item( tag, @@ -350,7 +350,7 @@ flac_tag_dup(const char *file) return flac_cue_tag_load(file); else #endif /* FLAC_API_VERSION_CURRENT >= 7 */ - return flac_tag_load(file); + return flac_tag_load(file, NULL); } static void @@ -823,7 +823,7 @@ oggflac_tag_dup(const char *file) if (!(block = FLAC__metadata_iterator_get_block(it))) break; if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - flac_vorbis_comments_to_tag(ret, block); + flac_vorbis_comments_to_tag(ret, NULL, block); } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) { ret->time = ((float)block->data.stream_info. total_samples) / |