Tag Parser: TagParser::Mp4TagField Class Reference

Tag Parser 12.5.2 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
TagParser::Mp4TagField Class Reference

The Mp4TagField class is used by Mp4Tag to store the fields. More...

`#include <mp4tagfield.h>`

Inheritance diagram for TagParser::Mp4TagField:
[legend]
Collaboration diagram for TagParser::Mp4TagField:
[legend]

## Classes
struct | AdditionalData

## Public Member Functions
| Mp4TagField ()
| Constructs a new Mp4TagField.
| Mp4TagField (IdentifierType id, const TagValue &value)
| Constructs a new Mp4TagField with the specified id and value.
| Mp4TagField (std::string_view mean, std::string_view name, const TagValue &value)
| Constructs a new Mp4TagField with the specified mean, name and value.
void | reparse (Mp4Atom &ilstChild, Diagnostics &diag)
| Parses field information from the specified Mp4Atom.
Mp4TagFieldMaker | prepareMaking (Diagnostics &diag)
| Prepares making.
void | make (std::ostream &stream, Diagnostics &diag)
| Saves the field to the specified stream.
const std::vector< AdditionalData > & | additionalData () const
| Returns additional data (and the corresponding raw data type, country and language).
std::vector< AdditionalData > & | additionalData ()
| Returns additional data (and the corresponding raw data type, country and language).
bool | isAdditionalTypeInfoUsed () const
| Returns whether the additional type info is used.
const std::string & | name () const
| Returns the "name" for "extended" fields.
void | setName (const std::string &name)
| Sets the "name" for the "extended" field.
const std::string & | mean () const
| Returns the "mean" for "extended" fields.
void | setMean (const std::string &mean)
| Sets the "mean" for the "extended" field.
std::uint32_t | parsedRawDataType () const
| Returns the raw data type which has been determined when parsing.
std::uint16_t | countryIndicator () const
| Returns the country indicator.
std::uint16_t | languageIndicator () const
| Returns the language indicator.
bool | supportsNestedFields () const
| Returns whether nested fields are supported.
std::vector< std::uint32_t > | expectedRawDataTypes () const
| Returns the expected raw data types for the ID of the field.
std::uint32_t | appropriateRawDataType () const
| Returns an appropriate raw data type.
std::uint32_t | appropriateRawDataTypeForValue (const TagValue &value) const
| Returns an appropriate raw data type.
Public Member Functions inherited from TagParser::TagField< Mp4TagField >
| TagField ()
| Constructs an empty TagField.
| ~TagField ()
| Destroys the TagField.
IdentifierType & | id ()
| Returns the id of the current TagField.
std::string | idToString () const
| Returns the id of the current TagField as string.
void | setId (const IdentifierType &id)
| Sets the id of the current Tag Field.
void | clearId ()
| Clears the id of the current TagField.
TagValue & | value ()
| Returns the value of the current TagField.
void | setValue (const TagValue &value)
| Sets the value of the current TagField.
void | clearValue ()
| Clears the value of the current TagField.
const TypeInfoType & | typeInfo () const
| Returns the type info of the current TagField.
void | setTypeInfo (const TypeInfoType &typeInfo)
| Sets the type info of the current TagField.
void | removeTypeInfo ()
| Removes the type info from the current TagField.
bool | isTypeInfoAssigned () const
| Returns an indication whether a type info is assigned.
bool | isDefault () const
| Returns an indication whether the field is labeled as default.
void | setDefault (bool isDefault)
| Sets whether the field is labeled as default.
void | clear ()
| Clears id, value, type info, sets default flag to false and resets further implementation specific values.
bool | isAdditionalTypeInfoUsed () const
| Returns an indication whether the additional type info is used.
const std::vector< Mp4TagField > & | nestedFields () const
| Returns the nested fields.
bool | supportsNestedFields () const
| Returns whether nested fields are supported by the implementation.

## Static Public Member Functions
static IdentifierType | fieldIdFromString (std::string_view idString)
| Converts the specified ID string representation to an actual ID.
static std::string | fieldIdToString (IdentifierType id)
| Returns the string representation for the specified id.

## Friends
class | TagField< Mp4TagField >

## Additional Inherited Members
Public Types inherited from TagParser::TagField< Mp4TagField >
using | IdentifierType
using | TypeInfoType
Protected Member Functions inherited from TagParser::TagField< Mp4TagField >
void | internallyClearValue ()
| Clears the assigned value; called via clearValue() and clear().
void | internallyClearFurtherData ()
| Clears further data; called via clear().

## Detailed Description

The Mp4TagField class is used by Mp4Tag to store the fields.

Definition at line 112 of file mp4tagfield.h.

## Constructor & Destructor Documentation

## ◆ Mp4TagField() [1/3]

TagParser::Mp4TagField::Mp4TagField | ( |  | ) |

Constructs a new Mp4TagField.

Definition at line 29 of file mp4tagfield.cpp.

## ◆ Mp4TagField() [2/3]

TagParser::Mp4TagField::Mp4TagField | ( | IdentifierType | id,
|  | const TagValue & | value )

Constructs a new Mp4TagField with the specified id and value.

Definition at line 39 of file mp4tagfield.cpp.

## ◆ Mp4TagField() [3/3]

TagParser::Mp4TagField::Mp4TagField | ( | std::string_view | mean,
|  | std::string_view | name,
|  | const TagValue & | value )

Constructs a new Mp4TagField with the specified mean, name and value.

The ID will be set to Mp4TagAtomIds::Extended indicating an tag field using the reverse DNS style.

See also
  The last paragraph of Known iTunes Metadata Atoms gives additional information about this form of MP4 tag fields.

Definition at line 56 of file mp4tagfield.cpp.

## Member Function Documentation

## ◆ additionalData() [1/2]

std::vector< Mp4TagField::AdditionalData > & TagParser::Mp4TagField::additionalData | ( |  | ) |
| inline

Returns additional data (and the corresponding raw data type, country and language).

Remarks
  Some files seen in the wild have multiple data atoms. This function allows to access the data from additional atoms.

Definition at line 173 of file mp4tagfield.h.

## ◆ additionalData() [2/2]

const std::vector< Mp4TagField::AdditionalData > & TagParser::Mp4TagField::additionalData | ( |  | ) | const
| inline

Returns additional data (and the corresponding raw data type, country and language).

Remarks
  Some files seen in the wild have multiple data atoms. This function allows to access the data from additional atoms.

Definition at line 164 of file mp4tagfield.h.

## ◆ appropriateRawDataType()

std::uint32_t TagParser::Mp4TagField::appropriateRawDataType | ( |  | ) | const

Returns an appropriate raw data type.

Returns
  Returns the type info if assigned; otherwise returns a raw data type considered as appropriate for the ID of the field and its value.

See also
  See Mp4TagField::appropriateRawDataTypeForValue() for the behavior if no type info is assigned.

Definition at line 408 of file mp4tagfield.cpp.

## ◆ appropriateRawDataTypeForValue()

std::uint32_t TagParser::Mp4TagField::appropriateRawDataTypeForValue | ( | const TagValue & | value | ) | const

Returns an appropriate raw data type.

Returns
  Returns a raw data type considered as appropriate for the ID of the field and the specified value.

Exceptions

  Throws | TagParser::Failure if an appropriate raw data type can not be determined. It is possible to determine the raw data type for all supported tag field IDs (those where a conversion to KnownField via Mp4Tag exists).

Definition at line 429 of file mp4tagfield.cpp.

## ◆ countryIndicator()

std::uint16_t TagParser::Mp4TagField::countryIndicator | ( |  | ) | const
| inline

Returns the country indicator.

Definition at line 229 of file mp4tagfield.h.

## ◆ expectedRawDataTypes()

std::vector< std::uint32_t > TagParser::Mp4TagField::expectedRawDataTypes | ( |  | ) | const

Returns the expected raw data types for the ID of the field.

Definition at line 348 of file mp4tagfield.cpp.

## ◆ fieldIdFromString()

Mp4TagField::IdentifierType TagParser::Mp4TagField::fieldIdFromString | ( | std::string_view | idString | ) |
| inlinestatic

Converts the specified ID string representation to an actual ID.

Remarks
  The specified idString is assumed to be UTF-8 encoded. In order to get the ©-sign correctly, it is converted to Latin-1.

Definition at line 255 of file mp4tagfield.h.

## ◆ fieldIdToString()

std::string TagParser::Mp4TagField::fieldIdToString | ( | IdentifierType | id | ) |
| inlinestatic

Returns the string representation for the specified id.

Remarks
  The specified id is considered Latin-1 encoded. In order to get the ©-sign correctly, it is converted to UTF-8.

Definition at line 271 of file mp4tagfield.h.

## ◆ isAdditionalTypeInfoUsed()

bool TagParser::Mp4TagField::isAdditionalTypeInfoUsed | ( |  | ) | const
| inline

Returns whether the additional type info is used.

Definition at line 181 of file mp4tagfield.h.

## ◆ languageIndicator()

std::uint16_t TagParser::Mp4TagField::languageIndicator | ( |  | ) | const
| inline

Returns the language indicator.

Definition at line 237 of file mp4tagfield.h.

## ◆ make()

void TagParser::Mp4TagField::make | ( | std::ostream & | stream,
|  | Diagnostics & | diag )

Saves the field to the specified stream.

Exceptions

  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 340 of file mp4tagfield.cpp.

## ◆ mean()

const std::string & TagParser::Mp4TagField::mean | ( |  | ) | const
| inline

Returns the "mean" for "extended" fields.

Definition at line 205 of file mp4tagfield.h.

## ◆ name()

const std::string & TagParser::Mp4TagField::name | ( |  | ) | const
| inline

Returns the "name" for "extended" fields.

Definition at line 189 of file mp4tagfield.h.

## ◆ parsedRawDataType()

std::uint32_t TagParser::Mp4TagField::parsedRawDataType | ( |  | ) | const
| inline

Returns the raw data type which has been determined when parsing.

Definition at line 221 of file mp4tagfield.h.

## ◆ prepareMaking()

Mp4TagFieldMaker TagParser::Mp4TagField::prepareMaking | ( | Diagnostics & | diag | ) |

Prepares making.

Returns
  Returns a Mp4TagFieldMaker object which can be used to actually make the field.

Remarks
  The field must NOT be mutated after making is prepared when it is intended to actually make the field using the make method of the returned object.

Exceptions

  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 field before making it.

Definition at line 328 of file mp4tagfield.cpp.

## ◆ reparse()

void TagParser::Mp4TagField::reparse | ( | Mp4Atom & | ilstChild,
|  | Diagnostics & | diag )

Parses field information from the specified Mp4Atom.

The specified atom should be a child atom of the "ilst" atom. Each child of the "ilst" atom holds one field of the Mp4Tag.

Exceptions

  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 104 of file mp4tagfield.cpp.

## ◆ setMean()

void TagParser::Mp4TagField::setMean | ( | const std::string & | mean | ) |
| inline

Sets the "mean" for the "extended" field.

Definition at line 213 of file mp4tagfield.h.

## ◆ setName()

void TagParser::Mp4TagField::setName | ( | const std::string & | name | ) |
| inline

Sets the "name" for the "extended" field.

Definition at line 197 of file mp4tagfield.h.

## ◆ supportsNestedFields()

bool TagParser::Mp4TagField::supportsNestedFields | ( |  | ) | const
| inline

Returns whether nested fields are supported.

Definition at line 245 of file mp4tagfield.h.

## Friends And Related Symbol Documentation

## ◆ TagField< Mp4TagField >

friend class TagField< Mp4TagField >
| friend

Definition at line 93 of file mp4tagfield.h.

The documentation for this class was generated from the following files:

- mp4/mp4tagfield.h
- mp4/mp4tagfield.cpp