Commit 45310d0c authored by Max Kellermann's avatar Max Kellermann

decoder/mp4v2: add tag table

parent 032e4354
...@@ -265,16 +265,25 @@ mp4_scan_file(Path path_fs, ...@@ -265,16 +265,25 @@ mp4_scan_file(Path path_fs,
const MP4Tags* tags = MP4TagsAlloc(); const MP4Tags* tags = MP4TagsAlloc();
MP4TagsFetch(tags, handle); MP4TagsFetch(tags, handle);
mp4_safe_invoke_tag(handler, handler_ctx, TAG_NAME, tags->name); static constexpr struct {
mp4_safe_invoke_tag(handler, handler_ctx, TAG_ARTIST, tags->artist); const char *MP4Tags::*p;
mp4_safe_invoke_tag(handler, handler_ctx, TAG_ALBUM_ARTIST, tags->albumArtist); TagType tag_type;
mp4_safe_invoke_tag(handler, handler_ctx, TAG_ALBUM, tags->album); } mp4v2_tags[] = {
mp4_safe_invoke_tag(handler, handler_ctx, TAG_COMPOSER, tags->composer); { &MP4Tags::name, TAG_NAME },
mp4_safe_invoke_tag(handler, handler_ctx, TAG_COMMENT, tags->comments); { &MP4Tags::artist, TAG_ARTIST },
mp4_safe_invoke_tag(handler, handler_ctx, TAG_GENRE, tags->genre); { &MP4Tags::albumArtist, TAG_ALBUM_ARTIST },
mp4_safe_invoke_tag(handler, handler_ctx, TAG_DATE, tags->releaseDate); { &MP4Tags::album, TAG_ALBUM },
mp4_safe_invoke_tag(handler, handler_ctx, TAG_ARTIST_SORT, tags->sortArtist); { &MP4Tags::composer, TAG_COMPOSER },
mp4_safe_invoke_tag(handler, handler_ctx, TAG_ALBUM_ARTIST_SORT, tags->sortAlbumArtist); { &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. */ char buff[8]; /* tmp buffer for index to string. */
if (tags->track != nullptr) { if (tags->track != nullptr) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment