diff options
author | Max Kellermann <max@duempel.org> | 2014-07-11 21:57:41 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-07-11 21:57:41 +0200 |
commit | 2a96ce97ee8cb03e1d2da9776f5cbb0993577537 (patch) | |
tree | 8c52ecd21fc592abcbb512337fc63fd696167801 | |
parent | 8cfe901391044da6509b1dc5c58bccabcaf9e4b4 (diff) | |
download | mpd-2a96ce97ee8cb03e1d2da9776f5cbb0993577537.tar.gz mpd-2a96ce97ee8cb03e1d2da9776f5cbb0993577537.tar.xz mpd-2a96ce97ee8cb03e1d2da9776f5cbb0993577537.zip |
decoder/sndfile: add str_type to TagType table
Diffstat (limited to '')
-rw-r--r-- | src/decoder/plugins/SndfileDecoderPlugin.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/decoder/plugins/SndfileDecoderPlugin.cxx b/src/decoder/plugins/SndfileDecoderPlugin.cxx index 8c9024201..dbdd5d39b 100644 --- a/src/decoder/plugins/SndfileDecoderPlugin.cxx +++ b/src/decoder/plugins/SndfileDecoderPlugin.cxx @@ -222,6 +222,15 @@ sndfile_handle_tag(SNDFILE *sf, int str, TagType tag, tag_handler_invoke_tag(handler, handler_ctx, tag, value); } +static constexpr struct { + int8_t str; + TagType tag; +} sndfile_tags[] = { + { SF_STR_TITLE, TAG_TITLE }, + { SF_STR_ARTIST, TAG_ARTIST }, + { SF_STR_DATE, TAG_DATE }, +}; + static bool sndfile_scan_file(Path path_fs, const struct tag_handler *handler, void *handler_ctx) @@ -245,9 +254,8 @@ sndfile_scan_file(Path path_fs, tag_handler_invoke_duration(handler, handler_ctx, info.frames / info.samplerate); - sndfile_handle_tag(sf, SF_STR_TITLE, TAG_TITLE, handler, handler_ctx); - sndfile_handle_tag(sf, SF_STR_ARTIST, TAG_ARTIST, handler, handler_ctx); - sndfile_handle_tag(sf, SF_STR_DATE, TAG_DATE, handler, handler_ctx); + for (auto i : sndfile_tags) + sndfile_handle_tag(sf, i.str, i.tag, handler, handler_ctx); sf_close(sf); |