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>
18namespace RawDataType {
68 void make(std::ostream &stream);
70 std::uint64_t requiredSize()
const;
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;
118 std::uint32_t rawDataType = 0;
119 std::uint16_t countryIndicator = 0;
120 std::uint16_t languageIndicator = 0;
129 void make(std::ostream &stream,
Diagnostics &diag);
131 const std::vector<AdditionalData> &additionalData()
const;
132 std::vector<AdditionalData> &additionalData();
133 bool isAdditionalTypeInfoUsed()
const;
134 const std::string &name()
const;
135 void setName(
const std::string &name);
136 const std::string &mean()
const;
137 void setMean(
const std::string &mean);
138 std::uint32_t parsedRawDataType()
const;
139 std::uint16_t countryIndicator()
const;
140 std::uint16_t languageIndicator()
const;
141 bool supportsNestedFields()
const;
142 std::vector<std::uint32_t> expectedRawDataTypes()
const;
143 std::uint32_t appropriateRawDataType()
const;
144 std::uint32_t appropriateRawDataTypeForValue(
const TagValue &value)
const;
146 static IdentifierType fieldIdFromString(std::string_view idString);
147 static std::string fieldIdToString(IdentifierType
id);
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.
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.
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).
const std::string & name() const
Returns the "name" for "extended" fields.
void setName(const std::string &name)
Sets the "name" for the "extended" field.
bool isAdditionalTypeInfoUsed() const
Returns whether the additional type info is used.
const std::string & mean() const
Returns the "mean" for "extended" fields.
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::uint16_t countryIndicator() const
Returns the country indicator.
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.
The TagField class is used by FieldMapBasedTag to store the fields.
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.
Contains all classes and functions of the TagInfo library.