1 #ifndef TAG_PARSER_OGGPAGE_H
2 #define TAG_PARSER_OGGPAGE_H
16 OggPage(std::istream &stream, std::uint64_t startOffset, std::int32_t maxSize);
18 void parseHeader(std::istream &stream, std::uint64_t startOffset, std::int32_t maxSize);
19 static std::uint32_t computeChecksum(std::istream &stream, std::uint64_t startOffset);
20 static void updateChecksum(std::iostream &stream, std::uint64_t startOffset);
22 std::uint64_t startOffset()
const;
23 std::uint8_t streamStructureVersion()
const;
24 std::uint8_t headerTypeFlag()
const;
25 bool isContinued()
const;
26 bool isFirstpage()
const;
27 bool isLastPage()
const;
28 std::uint64_t absoluteGranulePosition()
const;
29 std::uint32_t streamSerialNumber()
const;
30 bool matchesStreamSerialNumber(std::uint32_t streamSerialNumber)
const;
31 std::uint32_t sequenceNumber()
const;
32 std::uint32_t checksum()
const;
33 std::uint8_t segmentTableSize()
const;
34 const std::vector<std::uint32_t> &segmentSizes()
const;
35 std::uint32_t headerSize()
const;
36 std::uint32_t dataSize()
const;
37 std::uint32_t totalSize()
const;
38 std::uint64_t dataOffset(std::vector<std::uint32_t>::size_type segmentIndex = 0)
const;
39 static std::uint32_t makeSegmentSizeDenotation(std::ostream &stream, std::uint32_t size);
42 std::uint64_t m_startOffset;
43 std::uint8_t m_streamStructureVersion;
44 std::uint8_t m_headerTypeFlag;
45 std::uint64_t m_absoluteGranulePosition;
46 std::uint32_t m_streamSerialNumber;
47 std::uint32_t m_sequenceNumber;
48 std::uint32_t m_checksum;
49 std::uint8_t m_segmentCount;
50 std::vector<std::uint32_t> m_segmentSizes;
58 , m_streamStructureVersion(0)
60 , m_absoluteGranulePosition(0)
61 , m_streamSerialNumber(0)
72 inline OggPage::OggPage(std::istream &stream, std::uint64_t startOffset, std::int32_t maxSize)
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 std::accumulate(m_segmentSizes.cbegin(), m_segmentSizes.cend(), 0u);
251 + std::accumulate<decltype(m_segmentSizes)::const_iterator, std::uint64_t>(
252 m_segmentSizes.cbegin(), m_segmentSizes.cbegin() +
static_cast<decltype(m_segmentSizes)::difference_type
>(segmentIndex), 0u);
The OggPage class is used to parse OGG pages.
std::uint32_t sequenceNumber() const
Returns the page sequence number.
std::uint32_t dataSize() const
Returns the data size in byte.
void parseHeader(std::istream &stream, std::uint64_t startOffset, std::int32_t maxSize)
Parses the header read from the specified stream at the specified startOffset.
bool isFirstpage() const
Returns whether this page is the first page of the logical bitstream.
std::uint32_t totalSize() const
Returns the total size of the page in byte.
std::uint64_t dataOffset(std::vector< std::uint32_t >::size_type segmentIndex=0) const
Returns the data offset of the segment with the specified segmentIndex.
std::uint32_t streamSerialNumber() const
Returns the stream serial number.
const std::vector< std::uint32_t > & segmentSizes() const
Returns the sizes of the segments of the page in byte.
std::uint8_t headerTypeFlag() const
Returns the header type flag.
OggPage()
Constructs a new OGG page.
std::uint64_t startOffset() const
Returns the start offset of the page.
bool matchesStreamSerialNumber(std::uint32_t streamSerialNumber) const
Returns whether the stream serial number of the current instance matches the specified one.
std::uint32_t checksum() const
Returns the page checksum.
std::uint8_t streamStructureVersion() const
Returns the stream structure version.
bool isLastPage() const
Returns whether this page is the last page of the logical bitstream.
bool isContinued() const
Returns whether this page is a continued packed (true) or a fresh packed (false).
std::uint8_t segmentTableSize() const
Returns the size of the segment table.
std::uint64_t absoluteGranulePosition() const
Returns the absolute granule position.
std::uint32_t headerSize() const
Returns the header size in byte.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.