Tag Parser  6.2.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
mpeg4descriptor.h
Go to the documentation of this file.
1 #ifndef MPEG4DESCRIPTOR_H
2 #define MPEG4DESCRIPTOR_H
3 
4 #include "../genericfileelement.h"
5 
6 #include <memory>
7 
8 namespace Media {
9 
10 class Mp4Container;
11 class Mpeg4Descriptor;
12 
16 template <>
18 {
19 public:
24 
28  typedef byte identifierType;
29 
33  typedef uint32 dataSizeType;
34 
39 
43  static constexpr byte minimumElementSize()
44  {
45  return 2;
46  }
47 };
48 
49 class TAG_PARSER_EXPORT Mpeg4Descriptor : public GenericFileElement<Mpeg4Descriptor>
50 {
52 
53 public:
54  Mpeg4Descriptor(containerType& container, uint64 startOffset, uint64 maxSize);
55 
56  std::string idToString() const;
57  bool isParent() const;
58  bool isPadding() const;
59  uint64 firstChildOffset() const;
60 
61 protected:
62  Mpeg4Descriptor(implementationType &parent, uint64 startOffset);
63 
64  void internalParse();
65 
66 private:
67  std::string parsingContext() const;
68 };
69 
75 inline bool Mpeg4Descriptor::isParent() const
76 {
77  return m_firstChild != nullptr;
78 }
79 
83 inline bool Mpeg4Descriptor::isPadding() const
84 {
85  return false;
86 }
87 
93 inline uint64 Mpeg4Descriptor::firstChildOffset() const
94 {
95  return firstChild() ? firstChild()->startOffset() - startOffset() : 0;
96 }
97 
98 }
99 
100 #endif // MPEG4DESCRIPTOR_H
static constexpr byte minimumElementSize()
Returns the minimal descriptor size which is 2 byte.
byte identifierType
The type used to store atom IDs is an unsigned 32-bit integer.
Mp4Container containerType
The container type used to store such elements is Mp4Container.
Mpeg4Descriptor implementationType
The implementation type is Mp4Atom.
uint32 dataSizeType
The type used to store element sizes is an unsigned 32-bit integer.
The Mpeg4Descriptor class helps to parse MPEG-4 descriptors.
Implementation of GenericContainer<MediaFileInfo, Mp4Tag, Mp4Track, Mp4Atom>.
Definition: mp4container.h:19
bool isPadding() const
Returns always false for MPEG-4 descriptors.
bool isParent() const
Returns an indication whether the descriptor contains sub descriptors.
The GenericFileElement class helps to parse binary files which consist of an arboreal element strucut...
uint64 firstChildOffset() const
Returns the offset of the first child (relative to the start offset of this descriptor).
Defines traits for the specified ImplementationType.
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.