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 bool isLastSegmentUnconcluded()
const;
29 std::uint64_t absoluteGranulePosition()
const;
30 std::uint32_t streamSerialNumber()
const;
31 bool matchesStreamSerialNumber(std::uint32_t streamSerialNumber)
const;
32 std::uint32_t sequenceNumber()
const;
33 std::uint32_t checksum()
const;
34 std::uint8_t segmentTableSize()
const;
35 const std::vector<std::uint32_t> &segmentSizes()
const;
36 std::uint32_t headerSize()
const;
37 std::uint32_t dataSize()
const;
38 std::uint32_t totalSize()
const;
39 std::uint64_t dataOffset(std::vector<std::uint32_t>::size_type segmentIndex = 0)
const;
40 static std::uint32_t makeSegmentSizeDenotation(std::ostream &stream, std::uint32_t size);
43 std::uint64_t m_startOffset;
44 std::uint8_t m_streamStructureVersion;
45 std::uint8_t m_headerTypeFlag;
46 std::uint64_t m_absoluteGranulePosition;
47 std::uint32_t m_streamSerialNumber;
48 std::uint32_t m_sequenceNumber;
49 std::uint32_t m_checksum;
50 std::uint8_t m_segmentCount;
51 bool m_lastSegmentUnconcluded;
52 std::vector<std::uint32_t> m_segmentSizes;
60 , m_streamStructureVersion(0)
62 , m_absoluteGranulePosition(0)
63 , m_streamSerialNumber(0)
67 , m_lastSegmentUnconcluded(false)
75inline OggPage::OggPage(std::istream &stream, std::uint64_t startOffset, std::int32_t maxSize)
96 return m_streamStructureVersion;
107 return m_headerTypeFlag & 0xF;
115 return m_headerTypeFlag & 0x01;
123 return m_headerTypeFlag & 0x02;
131 return m_headerTypeFlag & 0x04;
139 return m_lastSegmentUnconcluded;
155 return m_absoluteGranulePosition;
168 return m_streamSerialNumber;
187 return m_sequenceNumber;
212 return m_segmentCount;
222 return m_segmentSizes;
232 return 27 + m_segmentCount;
240 return std::accumulate(m_segmentSizes.cbegin(), m_segmentSizes.cend(), 0u);
262 + std::accumulate<decltype(m_segmentSizes)::const_iterator, std::uint64_t>(
263 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.
bool isLastSegmentUnconcluded() const
Returns whether the last segment is unconcluded (the last lacing value of the last segment is 0xFF).
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 packet (true) or a fresh packet (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.