Tag Parser
9.1.2
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_ID3V2TAG_H
2 #define TAG_PARSER_ID3V2TAG_H
6 #include "../fieldbasedtag.h"
15 bool operator()(std::uint32_t lhs, std::uint32_t rhs)
const;
22 void make(std::ostream &stream, std::uint32_t padding,
Diagnostics &diag);
24 std::uint64_t requiredSize()
const;
30 std::uint32_t m_framesSize;
31 std::uint32_t m_requiredSize;
32 std::vector<Id3v2FrameMaker> m_maker;
49 return m_requiredSize;
68 static constexpr
const char *tagName =
"ID3v2 tag";
72 bool supportsDescription(
KnownField field)
const override;
73 bool supportsMimeType(
KnownField field)
const override;
74 bool supportsMultipleValues(
KnownField field)
const override;
75 void ensureTextValuesAreProperlyEncoded()
override;
77 void parse(std::istream &sourceStream,
const std::uint64_t maximalSize,
Diagnostics &diag);
79 void make(std::ostream &targetStream, std::uint32_t padding,
Diagnostics &diag);
81 std::uint8_t majorVersion()
const;
82 std::uint8_t revisionVersion()
const;
83 void setVersion(std::uint8_t majorVersion, std::uint8_t revisionVersion);
84 bool isVersionSupported()
const;
85 std::uint8_t flags()
const;
86 bool isUnsynchronisationUsed()
const;
87 bool hasExtendedHeader()
const;
88 bool isExperimental()
const;
89 bool hasFooter()
const;
90 std::uint32_t extendedHeaderSize()
const;
91 std::uint32_t paddingSize()
const;
94 IdentifierType internallyGetFieldId(
KnownField field)
const;
95 KnownField internallyGetKnownField(
const IdentifierType &
id)
const;
96 TagDataType internallyGetProposedDataType(
const std::uint32_t &
id)
const;
97 std::vector<const TagValue *> internallyGetValues(
const IdentifierType &
id)
const;
98 bool internallySetValues(
const IdentifierType &
id,
const std::vector<TagValue> &values);
101 std::uint8_t m_majorVersion;
102 std::uint8_t m_revisionVersion;
103 std::uint8_t m_flags;
104 std::uint32_t m_sizeExcludingHeader;
105 std::uint32_t m_extendedHeaderSize;
106 std::uint32_t m_paddingSize;
114 , m_revisionVersion(0)
116 , m_sizeExcludingHeader(0)
117 , m_extendedHeaderSize(0)
155 return m_majorVersion;
163 return m_revisionVersion;
174 return m_majorVersion == 2 || m_majorVersion == 3 || m_majorVersion == 4;
190 return m_flags & 0x80;
198 return (m_majorVersion >= 3) && (m_flags & 0x40);
206 return (m_majorVersion >= 3) && (m_flags & 0x20);
214 return (m_majorVersion >= 3) && (m_flags & 0x10);
222 return m_extendedHeaderSize;
231 return m_paddingSize;
236 #endif // TAG_PARSER_ID3V2TAG_H
bool isVersionSupported() const
Returns an indication whether the version is supported by the Id3v2Tag class.
bool hasExtendedHeader() const
Returns an indication whether an extended header is used.
The Id3v2Frame class is used by Id3v2Tag to store the fields.
bool isExperimental() const
Returns an indication whether the tag is labeled as experimental.
TagTextEncoding
Specifies the text encoding.
std::uint8_t flags() const
Returns the flags read from the ID3v2 header.
bool hasFooter() const
Returns an indication whether a footer is present.
The Diagnostics class is a container for DiagMessage.
bool supportsDescription(KnownField field) const override
Returns an indications whether the specified field supports descriptions.
Contains all classes and functions of the TagInfo library.
TagDataType
Specifies the data type.
std::uint32_t extendedHeaderSize() const
Returns the size of the extended header if one is present; otherwise returns 0.
bool isUnsynchronisationUsed() const
Returns an indication whether unsynchronisation is used.
std::uint8_t majorVersion() const
Returns the major version if known; otherwise returns 0.
bool canEncodingBeUsed(TagTextEncoding encoding) const override
Returns an indication whether the specified encoding can be used to provide string values for the tag...
TagTextEncoding proposedTextEncoding() const override
Returns the proposed text encoding.
Implementation of TagParser::Tag for ID3v2 tags.
KnownField
Specifies the field.
Id3v2Tag()
Constructs a new tag.
The FieldMapBasedTag provides a generic implementation of Tag which stores the tag fields using std::...
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
std::uint8_t revisionVersion() const
Returns the revision version if known; otherwise returns 0.
Defines the order which is used to store ID3v2 frames.
std::uint64_t requiredSize() const
Returns the number of bytes which will be written when making the tag.
Defines traits for the specified ImplementationType.
std::uint32_t paddingSize() const
Returns the size of the padding between the tag and the first MPEG frame if one is present; otherwise...
bool supportsMimeType(KnownField field) const override
Returns an indications whether the specified field supports mime types.
The Id3v2TagMaker class helps writing ID3v2 tags.
TagType
Specifies the tag type.
const Id3v2Tag & tag() const
Returns the associated tag.