From 4da00f8b75bdac762e0fcc60b2a44df356249ce7 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 9 Apr 2022 23:36:39 +0200 Subject: [PATCH] Add more field mappings --- CMakeLists.txt | 2 +- id3/id3v2frameids.cpp | 4 ++++ id3/id3v2frameids.h | 3 +++ id3/id3v2tag.cpp | 8 ++++++++ mp4/mp4ids.cpp | 3 ++- mp4/mp4ids.h | 13 +++++++++++++ mp4/mp4tag.cpp | 32 ++++++++++++++++++++++++++++++++ vorbis/vorbiscomment.cpp | 16 ++++++++++++++-- vorbis/vorbiscommentids.h | 8 ++++++++ 9 files changed, 85 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e2a1f9..ce8f600 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ set(META_APP_AUTHOR "Martchus") set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}") set(META_APP_DESCRIPTION "C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags") set(META_VERSION_MAJOR 11) -set(META_VERSION_MINOR 1) +set(META_VERSION_MINOR 2) set(META_VERSION_PATCH 0) set(META_REQUIRED_CPP_UNIT_VERSION 1.14.0) set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON) diff --git a/id3/id3v2frameids.cpp b/id3/id3v2frameids.cpp index b447900..7790580 100644 --- a/id3/id3v2frameids.cpp +++ b/id3/id3v2frameids.cpp @@ -79,6 +79,8 @@ std::uint32_t convertToShortId(std::uint32_t id) return sRemixedBy; case lCopyright: return sCopyright; + case lISRC: + return sISRC; default: return 0; } @@ -143,6 +145,8 @@ std::uint32_t convertToLongId(std::uint32_t id) return lRemixedBy; case sCopyright: return lCopyright; + case sISRC: + return lISRC; default: return 0; } diff --git a/id3/id3v2frameids.h b/id3/id3v2frameids.h index 6a9e790..b6aac04 100644 --- a/id3/id3v2frameids.h +++ b/id3/id3v2frameids.h @@ -45,6 +45,8 @@ enum KnownValue : std::uint32_t { lRemixedBy = 0x54504534, /**< TPE4 */ lCopyright = 0x54434F50, /**< TCOP */ lEncodingTime = 0x5444454E, /**< TDEN */ + lMood = 0x544D4F4F, /**< TMOO */ + lISRC = 0x54535243, /**< TSRC */ lUserDefinedText = 0x54585858, /**< TXXX */ sAlbum = 0x54414c, /**< ?TAL */ @@ -76,6 +78,7 @@ enum KnownValue : std::uint32_t { sRating = 0x504f50, /**< ?POP */ sRemixedBy = 0x545034, /**< TP4 */ sCopyright = 0x544352, /**< TCR */ + sISRC = 0x545243, /**< TRC */ sUserDefinedText = 0x545858, /**< ?TXX */ }; diff --git a/id3/id3v2tag.cpp b/id3/id3v2tag.cpp index 345c525..49f71a8 100644 --- a/id3/id3v2tag.cpp +++ b/id3/id3v2tag.cpp @@ -190,6 +190,8 @@ Id3v2Tag::IdentifierType Id3v2Tag::internallyGetFieldId(KnownField field) const return lEncodingTime; case KnownField::OriginalReleaseDate: return lOriginalReleaseTime; + case KnownField::Mood: + return lMood; default:; } } else { @@ -303,6 +305,10 @@ KnownField Id3v2Tag::internallyGetKnownField(const IdentifierType &id) const return KnownField::EncodingDate; case lOriginalReleaseTime: return KnownField::OriginalReleaseDate; + case lMood: + return KnownField::Mood; + case lISRC: + return KnownField::ISRC; case sAlbum: return KnownField::Album; case sArtist: @@ -343,6 +349,8 @@ KnownField Id3v2Tag::internallyGetKnownField(const IdentifierType &id) const return KnownField::RemixedBy; case sCopyright: return KnownField::Copyright; + case sISRC: + return KnownField::ISRC; default: return KnownField::Invalid; } diff --git a/mp4/mp4ids.cpp b/mp4/mp4ids.cpp index 2ea7c60..87466df 100644 --- a/mp4/mp4ids.cpp +++ b/mp4/mp4ids.cpp @@ -12,7 +12,8 @@ namespace Mp4AtomIds { /*! * \brief Encapsulates IDs of MP4 atoms holding tag information. - * \sa See http://atomicparsley.sourceforge.net/mpeg-4files.html for a table of known iTunes metadata atom IDs. + * \sa See http://atomicparsley.sourceforge.net/mpeg-4files.html and + * https://exiftool.org/TagNames/QuickTime.html for a table of known iTunes metadata atom IDs. */ namespace Mp4TagAtomIds { } diff --git a/mp4/mp4ids.h b/mp4/mp4ids.h index 02be457..41f09e4 100644 --- a/mp4/mp4ids.h +++ b/mp4/mp4ids.h @@ -120,6 +120,19 @@ enum KnownValue : std::uint32_t { TvSeason = 0x7476736e, /**< tvsn */ TvShowName = 0x74767368, /**< tvsh */ Year = 0xA9646179, /**< ©day */ + Conductor = 0x40636F6E, /** ©con */ + Director = 0x40646972, /**< @dir */ + Narrator = 0xA96E7274, /** ©nrt */ + Publisher = 0xA9707562, /** ©pub */ + SortWith = 0x736F6E6D, /** sonm */ + Compilation = 0x6370696C, /** cpil (flag, set to 1 if it is a compilation) */ + SoundEngineer = 0xA9736E65, /** ©sne */ + ExecutiveProducer = 0xA9787064, /** ©xpd */ + ArtDirector = 0xA9617264, /** ©ard */ + Arranger = 0xA9617267, /** ©arg */ + Author = 0xA9617574, /** ©aut */ + OriginalArtist = 0xA96F7065, /** ©ope */ + Year2 = 0x79727263, /** yrrc (could be mapped to release date but likely not well supported elsewhere (e.g. Kodi uses ©day) */ }; } diff --git a/mp4/mp4tag.cpp b/mp4/mp4tag.cpp index d00a4d9..fc19d7b 100644 --- a/mp4/mp4tag.cpp +++ b/mp4/mp4tag.cpp @@ -162,6 +162,22 @@ Mp4Tag::IdentifierType Mp4Tag::internallyGetFieldId(KnownField field) const return AlbumArtist; case KnownField::Copyright: return Copyright; + case KnownField::Conductor: + return Conductor; + case KnownField::Director: + return Director; + case KnownField::Publisher: + return Publisher; + case KnownField::SoundEngineer: + return SoundEngineer; + case KnownField::Producer: + return Producer; + case KnownField::ExecutiveProducer: + return ExecutiveProducer; + case KnownField::ArtDirector: + return ArtDirector; + case KnownField::Arranger: + return Arranger; default: return 0; } @@ -215,6 +231,22 @@ KnownField Mp4Tag::internallyGetKnownField(const IdentifierType &id) const return KnownField::AlbumArtist; case Copyright: return KnownField::Copyright; + case Conductor: + return KnownField::Conductor; + case Director: + return KnownField::Director; + case Publisher: + return KnownField::Publisher; + case SoundEngineer: + return KnownField::SoundEngineer; + case Producer: + return KnownField::Producer; + case ExecutiveProducer: + return KnownField::ExecutiveProducer; + case ArtDirector: + return KnownField::ArtDirector; + case Arranger: + return KnownField::Arranger; default: return KnownField::Invalid; } diff --git a/vorbis/vorbiscomment.cpp b/vorbis/vorbiscomment.cpp index fbc9ac2..ded5d7d 100644 --- a/vorbis/vorbiscomment.cpp +++ b/vorbis/vorbiscomment.cpp @@ -73,6 +73,8 @@ VorbisComment::IdentifierType VorbisComment::internallyGetFieldId(KnownField fie return std::string(composer()); case KnownField::Encoder: return std::string(encoder()); + case KnownField::EncodedBy: + return std::string(encodedBy()); case KnownField::EncoderSettings: return std::string(encoderSettings()); case KnownField::Description: @@ -95,6 +97,12 @@ VorbisComment::IdentifierType VorbisComment::internallyGetFieldId(KnownField fie return std::string(conductor()); case KnownField::Copyright: return std::string(copyright()); + case KnownField::License: + return std::string(license()); + case KnownField::Director: + return std::string(director()); + case KnownField::ISRC: + return std::string(isrc()); default: return std::string(); } @@ -118,6 +126,7 @@ KnownField VorbisComment::internallyGetKnownField(const IdentifierType &id) cons { partNumber(), KnownField::PartNumber }, { composer(), KnownField::Composer }, { encoder(), KnownField::Encoder }, + { encodedBy(), KnownField::EncodedBy }, { encoderSettings(), KnownField::EncoderSettings }, { description(), KnownField::Description }, { grouping(), KnownField::Grouping }, @@ -126,8 +135,11 @@ KnownField VorbisComment::internallyGetKnownField(const IdentifierType &id) cons { lyricist(), KnownField::Lyricist }, { lyrics(), KnownField::Lyrics }, { albumArtist(), KnownField::AlbumArtist }, - { conductor(), KnownField::Conductor }, - { copyright(), KnownField::Copyright }, { copyright(), KnownField::Copyright }, + { conductor(), KnownField::Conductor }, + { copyright(), KnownField::Copyright }, + { license(), KnownField::License }, + { director(), KnownField::Director }, + { isrc(), KnownField::ISRC }, }); // clang-format on const auto knownField(fieldMap.find(id)); diff --git a/vorbis/vorbiscommentids.h b/vorbis/vorbiscommentids.h index 5a1037e..4abc1bf 100644 --- a/vorbis/vorbiscommentids.h +++ b/vorbis/vorbiscommentids.h @@ -101,6 +101,10 @@ constexpr TAG_PARSER_EXPORT std::string_view encoder() { return "ENCODER"; } +constexpr TAG_PARSER_EXPORT std::string_view encodedBy() +{ + return "ENCODED_BY"; +} constexpr TAG_PARSER_EXPORT std::string_view encoderSettings() { return "ENCODER_OPTIONS"; @@ -129,6 +133,10 @@ constexpr TAG_PARSER_EXPORT std::string_view description() { return "DESCRIPTION"; } +constexpr TAG_PARSER_EXPORT std::string_view director() +{ + return "DIRECTOR"; +} constexpr TAG_PARSER_EXPORT std::string_view isrc() { return "ISRC";