aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-09-24 23:29:10 +0200
committerMax Kellermann <max@duempel.org>2014-09-24 23:29:10 +0200
commit45310d0cf6731bad36956510e5c54faab691a877 (patch)
tree0bd2e4f38d393b6958937ef287df3c95f78ec240 /src
parent032e435490b5e1e27c951a8b529a8e11c8a81ae6 (diff)
downloadmpd-45310d0cf6731bad36956510e5c54faab691a877.tar.gz
mpd-45310d0cf6731bad36956510e5c54faab691a877.tar.xz
mpd-45310d0cf6731bad36956510e5c54faab691a877.zip
decoder/mp4v2: add tag table
Diffstat (limited to 'src')
-rw-r--r--src/decoder/plugins/Mp4v2DecoderPlugin.cxx29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/decoder/plugins/Mp4v2DecoderPlugin.cxx b/src/decoder/plugins/Mp4v2DecoderPlugin.cxx
index d4f7c5843..bf97763c5 100644
--- a/src/decoder/plugins/Mp4v2DecoderPlugin.cxx
+++ b/src/decoder/plugins/Mp4v2DecoderPlugin.cxx
@@ -265,16 +265,25 @@ mp4_scan_file(Path path_fs,
const MP4Tags* tags = MP4TagsAlloc();
MP4TagsFetch(tags, handle);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_NAME, tags->name);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_ARTIST, tags->artist);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_ALBUM_ARTIST, tags->albumArtist);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_ALBUM, tags->album);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_COMPOSER, tags->composer);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_COMMENT, tags->comments);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_GENRE, tags->genre);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_DATE, tags->releaseDate);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_ARTIST_SORT, tags->sortArtist);
- mp4_safe_invoke_tag(handler, handler_ctx, TAG_ALBUM_ARTIST_SORT, tags->sortAlbumArtist);
+ static constexpr struct {
+ const char *MP4Tags::*p;
+ TagType tag_type;
+ } mp4v2_tags[] = {
+ { &MP4Tags::name, TAG_NAME },
+ { &MP4Tags::artist, TAG_ARTIST },
+ { &MP4Tags::albumArtist, TAG_ALBUM_ARTIST },
+ { &MP4Tags::album, TAG_ALBUM },
+ { &MP4Tags::composer, TAG_COMPOSER },
+ { &MP4Tags::comments, TAG_COMMENT },
+ { &MP4Tags::genre, TAG_GENRE },
+ { &MP4Tags::releaseDate, TAG_DATE },
+ { &MP4Tags::sortArtist, TAG_ARTIST_SORT },
+ { &MP4Tags::sortAlbumArtist, TAG_ALBUM_ARTIST_SORT },
+ };
+
+ for (const auto &i : mp4v2_tags)
+ mp4_safe_invoke_tag(handler, handler_ctx,
+ i.tag_type, tags->*i.p);
char buff[8]; /* tmp buffer for index to string. */
if (tags->track != nullptr) {