Tag Parser: mp4/mpeg4descriptor.h Source File

Tag Parser 12.5.2 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
mpeg4descriptor.h
Go to the documentation of this file.
1#ifndef TAG_PARSER_MPEG4DESCRIPTOR_H
2#define TAG_PARSER_MPEG4DESCRIPTOR_H
3
4#include "../genericfileelement.h"
5
6#include <memory>
7
8namespace TagParser {
9
10class Mp4Container;
11class Mpeg4Descriptor;
12
16 template <> class TAG_PARSER_EXPORT FileElementTraits<Mpeg4Descriptor> {
17public:
18 using ContainerType = Mp4Container;
19 using IdentifierType = std::uint8_t;
20 using DataSizeType = std::uint32_t;
21
25 static constexpr std::uint8_t minimumElementSize()
26 {
27 return 2;
28 }
29};
30
31 class TAG_PARSER_EXPORT Mpeg4Descriptor : public GenericFileElement<Mpeg4Descriptor> {
32 friend class GenericFileElement<Mpeg4Descriptor>;
33
34public:
35 Mpeg4Descriptor(ContainerType &container, std::uint64_t startOffset, std::uint64_t maxSize);
36
37 std::string idToString() const;
38 bool isParent() const;
39 bool isPadding() const;
40 std::uint64_t firstChildOffset() const;
41
42protected:
43 Mpeg4Descriptor(Mpeg4Descriptor &parent, std::uint64_t startOffset);
44
45 void internalParse(Diagnostics &diag);
46
47private:
48 std::string parsingContext() const;
49};
50
56 inline bool Mpeg4Descriptor::isParent() const
57{
58 return m_firstChild != nullptr;
59}
60
64 inline bool Mpeg4Descriptor::isPadding() const
65{
66 return false;
67}
68
74 inline std::uint64_t Mpeg4Descriptor::firstChildOffset() const
75{
76 return firstChild() ? firstChild()->startOffset() - startOffset() : 0;
77}
78
79} // namespace TagParser
80
81#endif // TAG_PARSER_MPEG4DESCRIPTOR_H
TagParser::Diagnostics
The Diagnostics class is a container for DiagMessage.
Definition diagnostics.h:156
TagParser::FileElementTraits< Mpeg4Descriptor >::ContainerType
Mp4Container ContainerType
Definition mpeg4descriptor.h:18
TagParser::FileElementTraits< Mpeg4Descriptor >::IdentifierType
std::uint8_t IdentifierType
Definition mpeg4descriptor.h:19
TagParser::FileElementTraits< Mpeg4Descriptor >::DataSizeType
std::uint32_t DataSizeType
Definition mpeg4descriptor.h:20
TagParser::FileElementTraits
Defines traits for the specified ImplementationType.
Definition genericfileelement.h:34
TagParser::GenericFileElement< Mpeg4Descriptor >::GenericFileElement
GenericFileElement(ContainerType &container, std::uint64_t startOffset)
TagParser::GenericFileElement< Mpeg4Descriptor >::startOffset
std::uint64_t startOffset() const
Definition genericfileelement.h:266
TagParser::GenericFileElement< Mpeg4Descriptor >::ContainerType
typename FileElementTraits< Mpeg4Descriptor >::ContainerType ContainerType
Definition genericfileelement.h:51
TagParser::GenericFileElement< Mpeg4Descriptor >::parent
Mpeg4Descriptor * parent()
Definition genericfileelement.h:390
TagParser::GenericFileElement< Mpeg4Descriptor >::minimumElementSize
static constexpr std::uint8_t minimumElementSize()
Definition genericfileelement.h:996
TagParser::GenericFileElement< Mpeg4Descriptor >::firstChild
Mpeg4Descriptor * firstChild()
Definition genericfileelement.h:465
TagParser::GenericFileElement< Mpeg4Descriptor >::m_firstChild
std::unique_ptr< Mpeg4Descriptor > m_firstChild
Definition genericfileelement.h:143
TagParser::GenericFileElement< Mpeg4Descriptor >::container
ContainerType & container()
Definition genericfileelement.h:225
TagParser::Mp4Container
Implementation of GenericContainer<MediaFileInfo, Mp4Tag, Mp4Track, Mp4Atom>.
Definition mp4container.h:18
TagParser::Mpeg4Descriptor
The Mpeg4Descriptor class helps to parse MPEG-4 descriptors.
Definition mpeg4descriptor.h:31
TagParser::Mpeg4Descriptor::isPadding
bool isPadding() const
Returns always false for MPEG-4 descriptors.
Definition mpeg4descriptor.h:64
TagParser::Mpeg4Descriptor::idToString
std::string idToString() const
Converts the specified atom ID to a printable string.
Definition mpeg4descriptor.cpp:47
TagParser::Mpeg4Descriptor::isParent
bool isParent() const
Returns an indication whether the descriptor contains sub descriptors.
Definition mpeg4descriptor.h:56
TagParser::Mpeg4Descriptor::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 w...
Definition mpeg4descriptor.cpp:23
TagParser::Mpeg4Descriptor::internalParse
void internalParse(Diagnostics &diag)
Parses the MPEG-4 descriptor.
Definition mpeg4descriptor.cpp:56
TagParser::Mpeg4Descriptor::firstChildOffset
std::uint64_t firstChildOffset() const
Returns the offset of the first child (relative to the start offset of this descriptor).
Definition mpeg4descriptor.h:74
genericfileelement.h
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
TagParser
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10