1#ifndef TAG_PARSER_MP4TAGATOM_H
2#define TAG_PARSER_MP4TAGATOM_H
6#include <c++utilities/conversion/stringconversion.h>
7#include <c++utilities/io/binarywriter.h>
68 void make(std::ostream &stream);
76 Data(Data &&) =
default;
77 std::string_view rawData;
78 std::stringstream convertedData;
79 std::uint64_t size = 0;
80 std::uint32_t rawType = 0;
81 std::uint16_t countryIndicator = 0;
82 std::uint16_t languageIndicator = 0;
87 std::uint64_t prepareDataAtom(
88 const TagValue &value, std::uint16_t countryIndicator, std::uint16_t languageIndicator,
const std::string &context,
Diagnostics &diag);
91 CppUtilities::BinaryWriter m_writer;
92 std::vector<Data> m_data;
93 std::uint64_t m_totalSize;
134 const std::string &
name()
const;
136 const std::string &
mean()
const;
150 void internallyClearValue();
151 void internallyClearFurtherData();
154 std::vector<AdditionalData> m_additionalData;
155 std::uint32_t m_parsedRawDataType;
156 std::uint16_t m_countryIndicator;
157 std::uint16_t m_langIndicator;
166 return m_additionalData;
175 return m_additionalData;
223 return m_parsedRawDataType;
231 return m_countryIndicator;
239 return m_langIndicator;
257 const auto latin1 = CppUtilities::convertUtf8ToLatin1(idString.data(), idString.size());
258 switch (latin1.second) {
260 return CppUtilities::BE::toInt<std::uint32_t>(latin1.first.get());
262 throw CppUtilities::ConversionException(
"MP4 ID must be exactly 4 chars");
273 const auto utf8 = CppUtilities::convertLatin1ToUtf8(CppUtilities::interpretIntegerAsString<std::uint32_t>(
id).data(), 4);
274 return std::string(utf8.first.get(), utf8.second);
The Diagnostics class is a container for DiagMessage.
The Mp4Atom class helps to parse MP4 files.
The Mp4TagFieldMaker class helps making tag fields.
void make(std::ostream &stream)
Saves the field (specified when constructing the object) to the specified stream.
Mp4TagFieldMaker(Mp4TagFieldMaker &&)=default
std::uint64_t requiredSize() const
Returns number of bytes which will be written when making the field.
const Mp4TagField & field() const
Returns the associated field.
The Mp4TagField class is used by Mp4Tag to store the fields.
Mp4TagFieldMaker prepareMaking(Diagnostics &diag)
Prepares making.
bool supportsNestedFields() const
Returns whether nested fields are supported.
const std::vector< AdditionalData > & additionalData() const
Returns additional data (and the corresponding raw data type, country and language).
void reparse(Mp4Atom &ilstChild, Diagnostics &diag)
Parses field information from the specified Mp4Atom.
const std::string & name() const
Returns the "name" for "extended" fields.
void setName(const std::string &name)
Sets the "name" for the "extended" field.
Mp4TagField()
Constructs a new Mp4TagField.
bool isAdditionalTypeInfoUsed() const
Returns whether the additional type info is used.
std::uint32_t appropriateRawDataTypeForValue(const TagValue &value) const
Returns an appropriate raw data type.
const std::string & mean() const
Returns the "mean" for "extended" fields.
std::uint32_t appropriateRawDataType() const
Returns an appropriate raw data type.
static IdentifierType fieldIdFromString(std::string_view idString)
Converts the specified ID string representation to an actual ID.
std::uint32_t parsedRawDataType() const
Returns the raw data type which has been determined when parsing.
void setMean(const std::string &mean)
Sets the "mean" for the "extended" field.
std::uint16_t languageIndicator() const
Returns the language indicator.
std::vector< std::uint32_t > expectedRawDataTypes() const
Returns the expected raw data types for the ID of the field.
std::uint16_t countryIndicator() const
Returns the country indicator.
void make(std::ostream &stream, Diagnostics &diag)
Saves the field to the specified stream.
static std::string fieldIdToString(IdentifierType id)
Returns the string representation for the specified id.
std::uint32_t TypeInfoType
std::uint32_t IdentifierType
Defines traits for the specified ImplementationType.
typename TagFieldTraits< Mp4TagField >::IdentifierType IdentifierType
The TagValue class wraps values of different types.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Encapsulates the most common data type IDs of MP4 tag fields.
Contains all classes and functions of the TagInfo library.
std::uint16_t countryIndicator
std::uint32_t rawDataType
std::uint16_t languageIndicator