Prevent warning when adding album artist to MP4

Prevents "making MP4 tag field aART: It was not possible to
find an appropriate raw data type id. UTF-8 will be assumed."
This commit is contained in:
Martchus 2019-10-09 18:03:34 +02:00
parent 9299c58c22
commit a59a01cfe9
3 changed files with 13 additions and 7 deletions

View File

@ -10,7 +10,7 @@ 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_APP_DESCRIPTION "C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags")
set(META_VERSION_MAJOR 9) set(META_VERSION_MAJOR 9)
set(META_VERSION_MINOR 1) set(META_VERSION_MINOR 1)
set(META_VERSION_PATCH 0) set(META_VERSION_PATCH 1)
set(META_REQUIRED_CPP_UNIT_VERSION 1.14.0) set(META_REQUIRED_CPP_UNIT_VERSION 1.14.0)
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON) set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)

View File

@ -163,6 +163,7 @@ Mp4Tag::IdentifierType Mp4Tag::internallyGetFieldId(KnownField field) const
default: default:
return 0; return 0;
} }
// do not forget to extend Mp4Tag::internallyGetKnownField() and Mp4TagField::appropriateRawDataType() as well
} }
KnownField Mp4Tag::internallyGetKnownField(const IdentifierType &id) const KnownField Mp4Tag::internallyGetKnownField(const IdentifierType &id) const
@ -213,6 +214,7 @@ KnownField Mp4Tag::internallyGetKnownField(const IdentifierType &id) const
default: default:
return KnownField::Invalid; return KnownField::Invalid;
} }
// do not forget to extend Mp4Tag::internallyGetFieldId() and Mp4TagField::appropriateRawDataType() as well
} }
bool Mp4Tag::setValue(KnownField field, const TagValue &value) bool Mp4Tag::setValue(KnownField field, const TagValue &value)

View File

@ -350,9 +350,9 @@ std::vector<std::uint32_t> Mp4TagField::expectedRawDataTypes() const
/*! /*!
* \brief Returns an appropriate raw data type. * \brief Returns an appropriate raw data type.
* *
* Returns the type info if assigned; otherwise returns * Returns the type info if assigned; otherwise returns a raw data type considered as appropriate for
* an raw data type considered as appropriate for the ID * the ID of the field. The latter is supposed to work for all supported tag fields IDs (those where a
* of the field. * conversion to KnownField via Mp4Tag exists).
*/ */
std::uint32_t Mp4TagField::appropriateRawDataType() const std::uint32_t Mp4TagField::appropriateRawDataType() const
{ {
@ -362,9 +362,9 @@ std::uint32_t Mp4TagField::appropriateRawDataType() const
return typeInfo(); return typeInfo();
} }
// there is no raw data type assigned (tag field was not // there is no raw data type assigned (tag field was not present in original file and
// present in original file but rather was added manually) // has been inserted by the library's user without type)
// try to derive appropriate raw data type from atom id // -> try to derive appropriate raw data type from atom ID
switch (id()) { switch (id()) {
case Album: case Album:
case Artist: case Artist:
@ -380,6 +380,7 @@ std::uint32_t Mp4TagField::appropriateRawDataType() const
case RecordLabel: case RecordLabel:
case Performers: case Performers:
case Lyricist: case Lyricist:
case AlbumArtist:
switch (value().dataEncoding()) { switch (value().dataEncoding()) {
case TagTextEncoding::Utf8: case TagTextEncoding::Utf8:
return RawDataType::Utf8; return RawDataType::Utf8;
@ -419,6 +420,9 @@ std::uint32_t Mp4TagField::appropriateRawDataType() const
break; break;
default:; default:;
} }
// do not forget to extend Mp4Tag::internallyGetFieldId() and Mp4Tag::internallyGetKnownField() as well
throw Failure(); throw Failure();
} }