6 #include <c++utilities/conversion/types.h> 18 OggPage(std::istream &stream, uint64 startOffset, int32 maxSize);
20 void parseHeader(std::istream &stream, uint64 startOffset, int32 maxSize);
21 static uint32 computeChecksum(std::istream &stream, uint64 startOffset);
22 static void updateChecksum(std::iostream &stream, uint64 startOffset);
24 uint64 startOffset()
const;
25 byte streamStructureVersion()
const;
26 byte headerTypeFlag()
const;
27 bool isContinued()
const;
28 bool isFirstpage()
const;
29 bool isLastPage()
const;
30 uint64 absoluteGranulePosition()
const;
31 uint32 streamSerialNumber()
const;
32 bool matchesStreamSerialNumber(uint32 streamSerialNumber)
const;
33 uint32 sequenceNumber()
const;
34 uint32 checksum()
const;
35 byte segmentTableSize()
const;
36 const std::vector<uint32> &segmentSizes()
const;
37 uint32 headerSize()
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),
93 return m_streamStructureVersion;
104 return m_headerTypeFlag;
112 return m_headerTypeFlag & 0x01;
120 return m_headerTypeFlag & 0x02;
128 return m_headerTypeFlag & 0x04;
144 return m_absoluteGranulePosition;
157 return m_streamSerialNumber;
176 return m_sequenceNumber;
201 return m_segmentCount;
211 return m_segmentSizes;
221 return 27 + m_segmentCount;
229 return headerSize() + std::accumulate(m_segmentSizes.cbegin(), m_segmentSizes.cend(), 0);
242 return startOffset() +
headerSize() + std::accumulate(m_segmentSizes.cbegin(), m_segmentSizes.cbegin() + segmentIndex, 0);
uint64 dataOffset(byte segmentIndex=0) const
Returns the data offset of the segment with the specified segmentIndex.
uint32 checksum() const
Returns the page checksum.
void parseHeader(std::istream &stream, uint64 startOffset, int32 maxSize)
Parses the header read from the specified stream at the specified startOffset.
uint32 headerSize() const
Returns the header size in byte.
bool matchesStreamSerialNumber(uint32 streamSerialNumber) const
Returns whether the stream serial number of the current instance matches the specified one...
uint32 sequenceNumber() const
Returns the page sequence number.
byte segmentTableSize() const
Returns the size of the segment table.
uint32 streamSerialNumber() const
Returns the stream serial number.
uint32 totalSize() const
Returns the total size of the page in byte.
The OggPage class is used to parse OGG pages.
byte streamStructureVersion() const
Returns the stream structure version.
uint64 absoluteGranulePosition() const
Returns the absolute granule position.
OggPage()
Constructs a new OGG page.
bool isFirstpage() const
Returns whether this page is the first page of the logical bitstream.
byte headerTypeFlag() const
Returns the header type flag.
bool isContinued() const
Returns whether this page is a continued packed (true) or a fresh packed (false). ...
uint64 startOffset() const
Returns the start offset of the page.
bool isLastPage() const
Returns whether this page is the last page of the logical bitstream.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
const std::vector< uint32 > & segmentSizes() const
Returns the sizes of the segments of the page in byte.