Tag Parser
9.1.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
Go to the documentation of this file. 1 #ifndef TAG_PARSER_MP4TAGATOM_H
2 #define TAG_PARSER_MP4TAGATOM_H
4 #include "../generictagfield.h"
6 #include <c++utilities/conversion/stringconversion.h>
7 #include <c++utilities/io/binarywriter.h>
18 namespace RawDataType {
67 void make(std::ostream &stream);
69 std::uint64_t requiredSize()
const;
75 std::stringstream m_convertedData;
76 CppUtilities::BinaryWriter m_writer;
77 std::uint32_t m_rawDataType;
78 std::uint64_t m_dataSize;
79 std::uint64_t m_totalSize;
108 void make(std::ostream &stream,
Diagnostics &diag);
110 bool isAdditionalTypeInfoUsed()
const;
111 const std::string &name()
const;
112 void setName(
const std::string &name);
113 const std::string &mean()
const;
114 void setMean(
const std::string &mean);
115 std::uint32_t parsedRawDataType()
const;
116 std::uint16_t countryIndicator()
const;
117 std::uint16_t languageIndicator()
const;
118 bool supportsNestedFields()
const;
119 std::vector<std::uint32_t> expectedRawDataTypes()
const;
120 std::uint32_t appropriateRawDataType()
const;
122 static IdentifierType fieldIdFromString(
const char *idString, std::size_t idStringSize = std::string::npos);
123 static std::string fieldIdToString(IdentifierType
id);
129 std::uint32_t m_parsedRawDataType;
130 std::uint16_t m_countryIndicator;
131 std::uint16_t m_langIndicator;
179 return m_parsedRawDataType;
187 return m_countryIndicator;
195 return m_langIndicator;
213 const auto latin1 = CppUtilities::convertUtf8ToLatin1(idString, idStringSize != std::string::npos ? idStringSize : std::strlen(idString));
214 switch (latin1.second) {
216 return CppUtilities::BE::toUInt32(latin1.first.get());
218 throw CppUtilities::ConversionException(
"MP4 ID must be exactly 4 chars");
229 const auto utf8 = CppUtilities::convertLatin1ToUtf8(CppUtilities::interpretIntegerAsString<std::uint32_t>(
id).data(), 4);
230 return std::string(utf8.first.get(), utf8.second);
235 #endif // TAG_PARSER_MP4TAGATOM_H
static std::string fieldIdToString(IdentifierType id)
Returns the string representation for the specified id.
static IdentifierType fieldIdFromString(const char *idString, std::size_t idStringSize=std::string::npos)
Converts the specified ID string representation to an actual ID.
std::uint16_t countryIndicator() const
Returns the country indicator.
const Mp4TagField & field() const
Returns the associated field.
Defines traits for the specified ImplementationType.
The Mp4TagFieldMaker class helps making tag fields. It allows to calculate the required size.
The Diagnostics class is a container for DiagMessage.
Contains all classes and functions of the TagInfo library.
bool supportsNestedFields() const
Returns whether nested fields are supported.
std::uint16_t languageIndicator() const
Returns the language indicator.
std::uint32_t TypeInfoType
The TagField class is used by FieldMapBasedTag to store the 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.
std::uint64_t requiredSize() const
Returns number of bytes which will be written when making the field.
std::uint32_t parsedRawDataType() const
Returns the raw data type which has been determined when parsing.
The TagValue class wraps values of different types. It is meant to be assigned to a tag field.
void setMean(const std::string &mean)
Sets the "mean" for the "extended" field.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
const std::string & mean() const
Returns the "mean" for "extended" fields.
The Mp4Atom class helps to parse MP4 files.
std::uint32_t IdentifierType
The Mp4TagField class is used by Mp4Tag to store the fields.
typename TagFieldTraits< Mp4TagField >::IdentifierType IdentifierType
const std::string & name() const
Returns the "name" for "extended" fields.