Tag Parser 11.0.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
The Mpeg4Descriptor class helps to parse MPEG-4 descriptors. More...
#include <mpeg4descriptor.h>
Public Member Functions | |
Mpeg4Descriptor (ContainerType &container, std::uint64_t startOffset, std::uint64_t maxSize) | |
Constructs a new top level descriptor with the specified container at the specified startOffset and with the specified maxSize. More... | |
std::string | idToString () const |
Converts the specified atom ID to a printable string. More... | |
bool | isParent () const |
Returns an indication whether the descriptor contains sub descriptors. More... | |
bool | isPadding () const |
Returns always false for MPEG-4 descriptors. More... | |
std::uint64_t | firstChildOffset () const |
Returns the offset of the first child (relative to the start offset of this descriptor). More... | |
![]() | |
GenericFileElement (ContainerType &container, std::uint64_t startOffset) | |
GenericFileElement (Mpeg4Descriptor &parent, std::uint64_t startOffset) | |
Constructs a new sub level file element with the specified parent at the specified startOffset. More... | |
GenericFileElement (ContainerType &container, std::uint64_t startOffset, std::uint64_t maxSize) | |
GenericFileElement (const GenericFileElement &other)=delete | |
GenericFileElement (GenericFileElement &other)=delete | |
GenericFileElement & | operator= (const GenericFileElement &other)=delete |
ContainerType & | container () |
Returns the related container. More... | |
const ContainerType & | container () const |
Returns the related container. More... | |
std::iostream & | stream () |
Returns the related stream. More... | |
CppUtilities::BinaryReader & | reader () |
Returns the related BinaryReader. More... | |
CppUtilities::BinaryWriter & | writer () |
Returns the related BinaryWriter. More... | |
std::uint64_t | startOffset () const |
Returns the start offset in the related stream. More... | |
std::uint64_t | relativeStartOffset () const |
Returns the offset of the element in its parent or - if it is a top-level element - in the related stream. More... | |
const IdentifierType & | id () const |
Returns the element ID. More... | |
std::string | idToString () const |
Returns a printable string representation of the element ID. More... | |
std::uint32_t | idLength () const |
Returns the length of the id denotation in byte. More... | |
std::uint32_t | headerSize () const |
Returns the header size of the element in byte. More... | |
DataSizeType | dataSize () const |
Returns the data size of the element in byte. More... | |
std::uint32_t | sizeLength () const |
Returns the length of the size denotation of the element in byte. More... | |
std::uint64_t | dataOffset () const |
Returns the data offset of the element in the related stream. More... | |
std::uint64_t | totalSize () const |
Returns the total size of the element. More... | |
std::uint64_t | endOffset () const |
Returns the offset of the first byte which doesn't belong to this element anymore. More... | |
std::uint64_t | maxTotalSize () const |
Returns maximum total size. More... | |
std::uint8_t | level () const |
Returns how deep the element is nested (0 for top-level elements, 1 for children of top-level elements, ...). More... | |
Mpeg4Descriptor * | parent () |
Returns the parent of the element. More... | |
const Mpeg4Descriptor * | parent () const |
Returns the parent of the element. More... | |
Mpeg4Descriptor * | parent (std::uint8_t n) |
Returns the n-th parent of the element. More... | |
const Mpeg4Descriptor * | parent (std::uint8_t n) const |
Returns the n-th parent of the element. More... | |
Mpeg4Descriptor * | nextSibling () |
Returns the next sibling of the element. More... | |
const Mpeg4Descriptor * | nextSibling () const |
Returns the next sibling of the element. More... | |
Mpeg4Descriptor * | firstChild () |
Returns the first child of the element. More... | |
const Mpeg4Descriptor * | firstChild () const |
Returns the first child of the element. More... | |
Mpeg4Descriptor * | lastChild () |
Returns the last child of the element. More... | |
const Mpeg4Descriptor * | lastChild () const |
Returns the last child of the element. More... | |
Mpeg4Descriptor * | subelementByPath (Diagnostics &diag, IdentifierType item) |
Returns the sub element for the specified path. More... | |
Mpeg4Descriptor * | subelementByPath (Diagnostics &diag, IdentifierType item, IdentifierType remainingPath...) |
Returns the sub element for the specified path. More... | |
const Mpeg4Descriptor * | subelementByPath (Diagnostics &diag, IdentifierType item) const |
Returns the sub element for the specified path. More... | |
const Mpeg4Descriptor * | subelementByPath (Diagnostics &diag, IdentifierType item, IdentifierType remainingPath...) const |
Returns the sub element for the specified path. More... | |
Mpeg4Descriptor * | childById (const IdentifierType &id, Diagnostics &diag) |
Returns the first child with the specified id. More... | |
const Mpeg4Descriptor * | childById (const IdentifierType &id, Diagnostics &diag) const |
Returns the first child with the specified id. More... | |
Mpeg4Descriptor * | siblingById (const IdentifierType &id, Diagnostics &diag) |
Returns the first sibling with the specified id. More... | |
const Mpeg4Descriptor * | siblingById (const IdentifierType &id, Diagnostics &diag) const |
Returns the first sibling with the specified id. More... | |
Mpeg4Descriptor * | siblingByIdIncludingThis (const IdentifierType &id, Diagnostics &diag) |
Returns the first sibling with the specified id or the current instance if its ID equals id. More... | |
const Mpeg4Descriptor * | siblingByIdIncludingThis (const IdentifierType &id, Diagnostics &diag) const |
Returns the first sibling with the specified id or the current instance if its ID equals id. More... | |
bool | isParent () const |
Returns an indication whether this instance is a parent element. More... | |
bool | isPadding () const |
Returns an indication whether this instance is a padding element. More... | |
std::uint64_t | firstChildOffset () const |
Returns the offset of the first child (relative to the start offset of this element). More... | |
bool | isParsed () const |
Returns an indication whether this instance has been parsed yet. More... | |
void | clear () |
Clears the status of the element. More... | |
void | parse (Diagnostics &diag) |
Parses the header information of the element which is read from the related stream at the start offset. More... | |
void | reparse (Diagnostics &diag) |
Parses the header information of the element which is read from the related stream at the start offset. More... | |
void | validateSubsequentElementStructure (Diagnostics &diag, std::uint64_t *paddingSize=nullptr, AbortableProgressFeedback *progress=nullptr) |
Parses (see parse()) this and all subsequent elements. More... | |
void | copyHeader (std::ostream &targetStream, Diagnostics &diag, AbortableProgressFeedback *progress) |
Writes the header information of the element to the specified targetStream. More... | |
void | copyWithoutChilds (std::ostream &targetStream, Diagnostics &diag, AbortableProgressFeedback *progress) |
Writes the element without its children to the specified targetStream. More... | |
void | copyEntirely (std::ostream &targetStream, Diagnostics &diag, AbortableProgressFeedback *progress) |
Writes the entire element including all children to the specified targetStream. More... | |
void | makeBuffer () |
Buffers the element (header and data). More... | |
void | discardBuffer () |
Discards buffered data. More... | |
void | copyBuffer (std::ostream &targetStream) |
Copies buffered data to targetStream. More... | |
void | copyPreferablyFromBuffer (std::ostream &targetStream, Diagnostics &diag, AbortableProgressFeedback *progress) |
Copies buffered data to targetStream if data has been buffered; copies from input stream otherwise. More... | |
const std::unique_ptr< char[]> & | buffer () |
Returns buffered data. More... | |
Mpeg4Descriptor * | denoteFirstChild (std::uint32_t offset) |
Denotes the first child to start at the specified offset (relative to the start offset of this descriptor). More... | |
Protected Member Functions | |
Mpeg4Descriptor (Mpeg4Descriptor &parent, std::uint64_t startOffset) | |
Constructs a new sub level descriptor with the specified parent at the specified startOffset. More... | |
void | internalParse (Diagnostics &diag) |
Parses the MPEG-4 descriptor. More... | |
Friends | |
class | GenericFileElement< Mpeg4Descriptor > |
Additional Inherited Members | |
![]() | |
using | ContainerType = typename FileElementTraits< Mpeg4Descriptor >::ContainerType |
Specifies the type of the corresponding container. More... | |
using | IdentifierType = typename FileElementTraits< Mpeg4Descriptor >::IdentifierType |
Specifies the type used to store identifiers. More... | |
using | DataSizeType = typename FileElementTraits< Mpeg4Descriptor >::DataSizeType |
Specifies the type used to store data sizes. More... | |
![]() | |
static constexpr std::uint32_t | maximumIdLengthSupported () |
Returns the maximum id length supported by the class in byte. More... | |
static constexpr std::uint32_t | maximumSizeLengthSupported () |
Returns the maximum size length supported by the class in byte. More... | |
static constexpr std::uint8_t | minimumElementSize () |
Returns the minimum element size. More... | |
![]() | |
IdentifierType | m_id |
std::uint64_t | m_startOffset |
std::uint64_t | m_maxSize |
DataSizeType | m_dataSize |
std::uint32_t | m_idLength |
std::uint32_t | m_sizeLength |
Mpeg4Descriptor * | m_parent |
std::unique_ptr< Mpeg4Descriptor > | m_nextSibling |
std::unique_ptr< Mpeg4Descriptor > | m_firstChild |
std::unique_ptr< char[]> | m_buffer |
bool | m_sizeUnknown |
The Mpeg4Descriptor class helps to parse MPEG-4 descriptors.
Definition at line 31 of file mpeg4descriptor.h.
TagParser::Mpeg4Descriptor::Mpeg4Descriptor | ( | ContainerType & | container, |
std::uint64_t | startOffset, | ||
std::uint64_t | maxSize | ||
) |
Constructs a new top level descriptor with the specified container at the specified startOffset and with the specified maxSize.
Definition at line 23 of file mpeg4descriptor.cpp.
|
protected |
Constructs a new sub level descriptor with the specified parent at the specified startOffset.
Definition at line 31 of file mpeg4descriptor.cpp.
|
inline |
Returns the offset of the first child (relative to the start offset of this descriptor).
Definition at line 74 of file mpeg4descriptor.h.
std::string TagParser::Mpeg4Descriptor::idToString | ( | ) | const |
Converts the specified atom ID to a printable string.
Definition at line 47 of file mpeg4descriptor.cpp.
|
protected |
Parses the MPEG-4 descriptor.
Definition at line 56 of file mpeg4descriptor.cpp.
|
inline |
Returns always false for MPEG-4 descriptors.
Definition at line 64 of file mpeg4descriptor.h.
|
inline |
Returns an indication whether the descriptor contains sub descriptors.
Definition at line 56 of file mpeg4descriptor.h.
|
friend |
Definition at line 25 of file mpeg4descriptor.h.