Tag Parser  8.0.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 TAG_PARSER_MPEG4DESCRIPTOR_H
2 #define TAG_PARSER_MPEG4DESCRIPTOR_H
3 
4 #include "../genericfileelement.h"
5 
6 #include <memory>
7 
8 namespace TagParser {
9 
10 class Mp4Container;
11 class Mpeg4Descriptor;
12 
17 public:
19  using IdentifierType = byte;
20  using DataSizeType = uint32;
21 
25  static constexpr byte minimumElementSize()
26  {
27  return 2;
28  }
29 };
30 
31 class TAG_PARSER_EXPORT Mpeg4Descriptor : public GenericFileElement<Mpeg4Descriptor> {
33 
34 public:
35  Mpeg4Descriptor(ContainerType &container, uint64 startOffset, uint64 maxSize);
36 
37  std::string idToString() const;
38  bool isParent() const;
39  bool isPadding() const;
40  uint64 firstChildOffset() const;
41 
42 protected:
43  Mpeg4Descriptor(Mpeg4Descriptor &parent, uint64 startOffset);
44 
45  void internalParse(Diagnostics &diag);
46 
47 private:
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 uint64 Mpeg4Descriptor::firstChildOffset() const
75 {
76  return firstChild() ? firstChild()->startOffset() - startOffset() : 0;
77 }
78 
79 } // namespace TagParser
80 
81 #endif // TAG_PARSER_MPEG4DESCRIPTOR_H
Defines traits for the specified ImplementationType.
uint64 firstChildOffset() const
Returns the offset of the first child (relative to the start offset of this descriptor).
std::unique_ptr< ImplementationType > m_firstChild
bool isParent() const
Returns an indication whether the descriptor contains sub descriptors.
ImplementationType * firstChild()
Returns the first child of the element.
The Mpeg4Descriptor class helps to parse MPEG-4 descriptors.
Implementation of GenericContainer<MediaFileInfo, Mp4Tag, Mp4Track, Mp4Atom>.
Definition: mp4container.h:19
uint64 startOffset() const
Returns the start offset in the related stream.
bool isPadding() const
Returns always false for MPEG-4 descriptors.
static constexpr byte minimumElementSize()
Returns the minimal descriptor size which is 2 byte.
The GenericFileElement class helps to parse binary files which consist of an arboreal element strucut...
typename FileElementTraits< ImplementationType >::ContainerType ContainerType
Specifies the type of the corresponding container.
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
The Diagnostics class is a container for DiagMessage.
Definition: diagnostics.h:156