1 #ifndef TAG_PARSER_OGGPAGE_H 2 #define TAG_PARSER_OGGPAGE_H 6 #include <c++utilities/conversion/types.h> 17 OggPage(std::istream &stream, uint64 startOffset, int32 maxSize);
19 void parseHeader(std::istream &stream, uint64 startOffset, int32 maxSize);
20 static uint32 computeChecksum(std::istream &stream, uint64 startOffset);
21 static void updateChecksum(std::iostream &stream, uint64 startOffset);
23 uint64 startOffset()
const;
24 byte streamStructureVersion()
const;
25 byte headerTypeFlag()
const;
26 bool isContinued()
const;
27 bool isFirstpage()
const;
28 bool isLastPage()
const;
29 uint64 absoluteGranulePosition()
const;
30 uint32 streamSerialNumber()
const;
31 bool matchesStreamSerialNumber(uint32 streamSerialNumber)
const;
32 uint32 sequenceNumber()
const;
33 uint32 checksum()
const;
34 byte segmentTableSize()
const;
35 const std::vector<uint32> &segmentSizes()
const;
36 uint32 headerSize()
const;
37 uint32 dataSize()
const;
38 uint32 totalSize()
const;
39 uint64 dataOffset(byte segmentIndex = 0)
const;
40 static uint32 makeSegmentSizeDenotation(std::ostream &stream, uint32 size);
44 byte m_streamStructureVersion;
45 byte m_headerTypeFlag;
46 uint64 m_absoluteGranulePosition;
47 uint32 m_streamSerialNumber;
48 uint32 m_sequenceNumber;
51 std::vector<uint32> m_segmentSizes;
59 , m_streamStructureVersion(0)
61 , m_absoluteGranulePosition(0)
62 , m_streamSerialNumber(0)
94 return m_streamStructureVersion;
105 return m_headerTypeFlag;
113 return m_headerTypeFlag & 0x01;
121 return m_headerTypeFlag & 0x02;
129 return m_headerTypeFlag & 0x04;
145 return m_absoluteGranulePosition;
158 return m_streamSerialNumber;
177 return m_sequenceNumber;
202 return m_segmentCount;
212 return m_segmentSizes;
222 return 27 + m_segmentCount;
230 return std::accumulate(m_segmentSizes.cbegin(), m_segmentSizes.cend(), 0u);
251 return startOffset() +
headerSize() + std::accumulate(m_segmentSizes.cbegin(), m_segmentSizes.cbegin() + segmentIndex, 0);
256 #endif // TAG_PARSER_OGGPAGE_H uint64 dataOffset(byte segmentIndex=0) const
Returns the data offset of the segment with the specified segmentIndex.
bool isLastPage() const
Returns whether this page is the last page of the logical bitstream.
byte headerTypeFlag() const
Returns the header type flag.
uint32 dataSize() const
Returns the data size in byte.
uint32 totalSize() const
Returns the total size of the page in byte.
bool matchesStreamSerialNumber(uint32 streamSerialNumber) const
Returns whether the stream serial number of the current instance matches the specified one...
const std::vector< uint32 > & segmentSizes() const
Returns the sizes of the segments of the page in byte.
uint32 sequenceNumber() const
Returns the page sequence number.
uint64 startOffset() const
Returns the start offset of the page.
void parseHeader(std::istream &stream, uint64 startOffset, int32 maxSize)
Parses the header read from the specified stream at the specified startOffset.
uint32 checksum() const
Returns the page checksum.
uint32 streamSerialNumber() const
Returns the stream serial number.
uint64 absoluteGranulePosition() const
Returns the absolute granule position.
bool isFirstpage() const
Returns whether this page is the first page of the logical bitstream.
uint32 headerSize() const
Returns the header size in byte.
bool isContinued() const
Returns whether this page is a continued packed (true) or a fresh packed (false). ...
OggPage()
Constructs a new OGG page.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
byte streamStructureVersion() const
Returns the stream structure version.
byte segmentTableSize() const
Returns the size of the segment table.