From 2a96ce97ee8cb03e1d2da9776f5cbb0993577537 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 11 Jul 2014 21:57:41 +0200 Subject: decoder/sndfile: add str_type to TagType table --- src/decoder/plugins/SndfileDecoderPlugin.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/decoder/plugins/SndfileDecoderPlugin.cxx') 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); -- cgit v1.2.3