aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/SndfileDecoderPlugin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder/plugins/SndfileDecoderPlugin.cxx')
-rw-r--r--src/decoder/plugins/SndfileDecoderPlugin.cxx14
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);