Tag Parser  6.5.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
matroskacues.h
Go to the documentation of this file.
1 #ifndef MEDIA_MATROSKACUES_H
2 #define MEDIA_MATROSKACUES_H
3 
4 #include "./ebmlelement.h"
5 
6 #include <map>
7 #include <ostream>
8 
9 namespace Media {
10 
12 {
13 public:
14  MatroskaOffsetStates(uint64 initialValue);
15  uint64 currentValue() const;
16  void update(uint64 newValue);
17  uint64 initialValue() const;
18 private:
19  uint64 m_initialValue;
20  uint64 m_currentValue;
21 };
22 
23 inline MatroskaOffsetStates::MatroskaOffsetStates(uint64 initialValue) :
24  m_initialValue(initialValue),
25  m_currentValue(initialValue)
26 {}
27 
29 {
30  return m_currentValue;
31 }
32 
33 inline void MatroskaOffsetStates::update(uint64 newValue)
34 {
35  m_currentValue = newValue;
36 }
37 
39 {
40  return m_initialValue;
41 }
42 
44 {
45 public:
46  MatroskaReferenceOffsetPair(uint64 referenceOffset, uint64 initialValue);
47  uint64 referenceOffset() const;
48 private:
49  uint64 m_referenceOffset;
50 };
51 
53  MatroskaOffsetStates(initialValue),
54  m_referenceOffset(referenceOffset)
55 {}
56 
58 {
59  return m_referenceOffset;
60 }
61 
63 {
64 public:
66 
67  EbmlElement *cuesElement() const;
68  uint64 totalSize() const;
69 
70  void parse(EbmlElement *cuesElement);
71  bool updateOffsets(uint64 originalOffset, uint64 newOffset);
72  bool updateRelativeOffsets(uint64 referenceOffset, uint64 originalRelativeOffset, uint64 newRelativeOffset);
73  void make(std::ostream &stream);
74  void clear();
75 
76 private:
77  bool updateSize(EbmlElement *element, int shift);
78 
79  EbmlElement *m_cuesElement;
80  std::map<EbmlElement *, MatroskaOffsetStates> m_offsets;
81  std::map<EbmlElement *, MatroskaReferenceOffsetPair> m_relativeOffsets;
82  std::map<EbmlElement *, uint64> m_sizes;
83 };
84 
91  m_cuesElement(nullptr)
92 {}
93 
100 {
101  return m_cuesElement;
102 }
103 
108 {
109  m_cuesElement = nullptr;
110  m_offsets.clear();
111  m_sizes.clear();
112 }
113 
114 } // namespace Media
115 
116 #endif // MEDIA_MATROSKACUES_H
The EbmlElement class helps to parse EBML files such as Matroska files.
Definition: ebmlelement.h:50
MatroskaCuePositionUpdater()
Creates a new MatroskaCuePositionUpdater.
Definition: matroskacues.h:90
void update(uint64 newValue)
Definition: matroskacues.h:33
uint64 initialValue() const
Definition: matroskacues.h:38
MatroskaOffsetStates(uint64 initialValue)
Definition: matroskacues.h:23
The MatroskaCuePositionUpdater class helps to rewrite the "Cues"-element with shifted positions...
Definition: matroskacues.h:62
uint64 currentValue() const
Definition: matroskacues.h:28
The MatroskaOffsetStates holds an offset within a Matroska file.
Definition: matroskacues.h:11
MatroskaReferenceOffsetPair(uint64 referenceOffset, uint64 initialValue)
Definition: matroskacues.h:52
void clear()
Resets the object to its initial state.
Definition: matroskacues.h:107
EbmlElement * cuesElement() const
Returns the "Cues"-element specified when calling the parse() method.
Definition: matroskacues.h:99
The MatroskaReferenceOffsetPair holds an offset within a Matroska file plus the reference offset...
Definition: matroskacues.h:43
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
The StatusProvider class acts as a base class for objects providing status information.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.