Tag Parser 12.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
Implementation of TagParser::Tag for the MP4 container. More...
#include <mp4tag.h>
Public Member Functions | |
Mp4Tag () | |
Constructs a new tag. | |
bool | canEncodingBeUsed (TagTextEncoding encoding) const override |
Returns an indication whether the specified encoding can be used to provide string values for the tag. | |
bool | supportsField (KnownField field) const override |
Returns an indication whether the specified field is supported by the tag. | |
const TagValue & | value (KnownField value) const override |
Returns the value of the specified field. | |
std::vector< const TagValue * > | values (KnownField field) const override |
Returns the values of the specified field. | |
const TagValue & | value (std::string_view mean, std::string_view name) const |
Returns the value of the field with the specified mean and name attributes. | |
bool | setValue (KnownField field, const TagValue &value) override |
Assigns the given value to the specified field. | |
bool | setValues (KnownField field, const std::vector< TagValue > &values) override |
Assigns the given values to the field with the specified id. | |
bool | setValue (std::string_view mean, std::string_view name, const TagValue &value) |
Assigns the given value to the field with the specified mean and name attributes. | |
bool | hasField (KnownField value) const override |
Returns an indication whether the specified field is present. | |
bool | supportsMultipleValues (KnownField) const override |
Returns false for all fields (for now). | |
void | parse (Mp4Atom &metaAtom, Diagnostics &diag) |
Parses tag information from the specified metaAtom. | |
Mp4TagMaker | prepareMaking (Diagnostics &diag) |
Prepares making. | |
void | make (std::ostream &stream, Diagnostics &diag) |
Writes tag information to the specified stream. | |
Public Member Functions inherited from TagParser::FieldMapBasedTag< Mp4Tag > | |
FieldMapBasedTag () | |
Constructs a new FieldMapBasedTag. | |
TagType | type () const |
Returns the type of the tag as TagParser::TagType. | |
std::string_view | typeName () const |
Returns the type name of the tag as C-style string. | |
TagTextEncoding | proposedTextEncoding () const |
Returns the proposed text encoding. | |
const TagValue & | value (const IdentifierType &id) const |
Returns the value of the field with the specified id. | |
std::vector< const TagValue * > | values (const IdentifierType &id) const |
Returns the values of the field with the specified id. | |
bool | setValue (const IdentifierType &id, const TagValue &value) |
Assigns the given value to the field with the specified id. | |
bool | setValues (const IdentifierType &id, const std::vector< TagValue > &values) |
Assigns the given values to the field with the specified id. | |
bool | hasField (const IdentifierType &id) const |
Returns an indication whether the field with the specified id is present. | |
void | removeAllFields () |
Removes all fields from the tag. | |
const std::multimap< IdentifierType, FieldType, Compare > & | fields () const |
Returns the fields of the tag by providing direct access to the field map of the tag. | |
std::multimap< IdentifierType, FieldType, Compare > & | fields () |
Returns the fields of the tag by providing direct access to the field map of the tag. | |
std::size_t | fieldCount () const |
Returns the number of present fields. | |
IdentifierType | fieldId (KnownField value) const |
Returns the ID for the specified field. | |
KnownField | knownField (const IdentifierType &id) const |
Returns the field for the specified ID. | |
TagDataType | proposedDataType (const IdentifierType &id) const |
Returns the proposed data type for the field with the specified id. | |
virtual TagDataType | proposedDataType (KnownField field) const |
Returns the proposed data type for the specified field as TagDataType. | |
std::size_t | insertFields (const FieldMapBasedTag< Mp4Tag > &from, bool overwrite) |
Inserts all fields from another tag of the same field type and compare function. | |
std::size_t | insertValues (const Tag &from, bool overwrite) |
Inserts all compatible values from another Tag. | |
void | ensureTextValuesAreProperlyEncoded () |
Ensures the encoding of all assigned text values is supported by the tag by converting the character set if necessary. | |
Public Member Functions inherited from TagParser::Tag | |
virtual | ~Tag () |
Destroys the Tag. | |
std::string | toString () const |
Returns a string representation of the tag. | |
const std::string & | version () const |
Returns the version of the tag as std::string. | |
std::uint64_t | size () const |
Returns the size the tag within the file it is parsed from in bytes. | |
virtual bool | supportsTarget () const |
Returns an indication whether a target is supported by the tag. | |
const TagTarget & | target () const |
TagTarget & | target () |
Returns the target of tag. | |
void | setTarget (const TagTarget &target) |
Sets the target of tag. | |
virtual TagTargetLevel | targetLevel () const |
Returns the name of the current tag target level. | |
std::string_view | targetLevelName () const |
Returns the name of the current target level. | |
bool | isTargetingLevel (TagTargetLevel tagTargetLevel) const |
Returns whether the tag is targeting the specified tagTargetLevel. | |
std::string | targetString () const |
Returns the string representation for the assigned tag target. | |
virtual bool | supportsDescription (KnownField field) const |
Returns an indications whether the specified field supports descriptions. | |
virtual bool | supportsMimeType (KnownField field) const |
Returns an indications whether the specified field supports mime types. | |
Static Public Attributes | |
static constexpr TagType | tagType = TagType::Mp4Tag |
static constexpr std::string_view | tagName = "MP4/iTunes tag" |
static constexpr TagTextEncoding | defaultTextEncoding = TagTextEncoding::Utf8 |
Protected Member Functions | |
IdentifierType | internallyGetFieldId (KnownField field) const |
KnownField | internallyGetKnownField (const IdentifierType &id) const |
void | internallyGetValuesFromField (const FieldType &field, std::vector< const TagValue * > &values) const |
Adds values from additional data atoms as well. | |
Protected Member Functions inherited from TagParser::FieldMapBasedTag< Mp4Tag > | |
const TagValue & | internallyGetValue (const IdentifierType &id) const |
Default implementation for value(). | |
void | internallyGetValuesFromField (const FieldType &field, std::vector< const TagValue * > &values) const |
Default way to gather values from a field in internallyGetValues(). | |
std::vector< const TagValue * > | internallyGetValues (const IdentifierType &id) const |
Default implementation for values(). | |
bool | internallySetValue (const IdentifierType &id, const TagValue &value) |
Default implementation for setValue(). | |
bool | internallySetValues (const IdentifierType &id, const std::vector< TagValue > &values) |
Default implementation for setValues(). | |
bool | internallyHasField (const IdentifierType &id) const |
Default implementation for hasField(). | |
TagDataType | internallyGetProposedDataType (const IdentifierType &id) const |
Default implementation for proposedDataType(). | |
Protected Member Functions inherited from TagParser::Tag | |
Tag () | |
Constructs a new Tag. | |
Friends | |
class | FieldMapBasedTag< Mp4Tag > |
Additional Inherited Members | |
Public Types inherited from TagParser::FieldMapBasedTag< Mp4Tag > | |
using | FieldType |
using | IdentifierType |
using | Compare |
Protected Types inherited from TagParser::FieldMapBasedTag< Mp4Tag > | |
using | CRTPBase |
Protected Attributes inherited from TagParser::Tag | |
std::string | m_version |
std::uint64_t | m_size |
std::unique_ptr< TagPrivate > | m_p |
TagTarget | m_target |
Implementation of TagParser::Tag for the MP4 container.
|
overridevirtual |
Returns an indication whether the specified encoding can be used to provide string values for the tag.
Only the proposedTextEncoding() is accepted by default. This might be overwritten when subclassing.
The tag class and its subclasses do not perform any conversions. You have to provide all string values using an encoding which is appropriate for the specific tag type. This method is meant to determine if a particular encoding can be used.
Reimplemented from TagParser::Tag.
Definition at line 47 of file mp4tag.cpp.
|
overridevirtual |
Returns an indication whether the specified field is present.
Reimplemented from TagParser::FieldMapBasedTag< Mp4Tag >.
Definition at line 361 of file mp4tag.cpp.
|
protected |
Definition at line 119 of file mp4tag.cpp.
|
protected |
Definition at line 193 of file mp4tag.cpp.
|
protected |
Adds values from additional data atoms as well.
Definition at line 271 of file mp4tag.cpp.
void TagParser::Mp4Tag::make | ( | std::ostream & | stream, |
Diagnostics & | diag ) |
Writes tag information to the specified stream.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | TagParser::Failure or a derived exception when a making error occurs. |
Definition at line 455 of file mp4tag.cpp.
void TagParser::Mp4Tag::parse | ( | Mp4Atom & | metaAtom, |
Diagnostics & | diag ) |
Parses tag information from the specified metaAtom.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | TagParser::Failure or a derived exception when a parsing error occurs. |
Definition at line 378 of file mp4tag.cpp.
Mp4TagMaker TagParser::Mp4Tag::prepareMaking | ( | Diagnostics & | diag | ) |
Prepares making.
Throws | TagParser::Failure or a derived exception when a making error occurs. |
This method might be useful when it is necessary to know the size of the tag before making it.
Definition at line 444 of file mp4tag.cpp.
|
overridevirtual |
Assigns the given value to the specified field.
Reimplemented from TagParser::FieldMapBasedTag< Mp4Tag >.
Definition at line 283 of file mp4tag.cpp.
bool TagParser::Mp4Tag::setValue | ( | std::string_view | mean, |
std::string_view | name, | ||
const TagValue & | value ) |
Assigns the given value to the field with the specified mean and name attributes.
Definition at line 348 of file mp4tag.cpp.
|
overridevirtual |
Assigns the given values to the field with the specified id.
Reimplemented from TagParser::FieldMapBasedTag< Mp4Tag >.
Definition at line 307 of file mp4tag.cpp.
|
inlineoverridevirtual |
Returns an indication whether the specified field is supported by the tag.
Reimplemented from TagParser::FieldMapBasedTag< Mp4Tag >.
|
inlineoverridevirtual |
Returns false for all fields (for now).
Reimplemented from TagParser::Tag.
|
overridevirtual |
Returns the value of the specified field.
Reimplemented from TagParser::FieldMapBasedTag< Mp4Tag >.
Definition at line 59 of file mp4tag.cpp.
const TagValue & TagParser::Mp4Tag::value | ( | std::string_view | mean, |
std::string_view | name ) const |
Returns the value of the field with the specified mean and name attributes.
Definition at line 108 of file mp4tag.cpp.
|
overridevirtual |
Returns the values of the specified field.
Reimplemented from TagParser::FieldMapBasedTag< Mp4Tag >.
Definition at line 85 of file mp4tag.cpp.
|
friend |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |