Tag Parser
7.0.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
#include <oggpage.h>
Public Member Functions | |
OggPage () | |
Constructs a new OGG page. More... | |
OggPage (std::istream &stream, uint64 startOffset, int32 maxSize) | |
Constructs a new OggPage and instantly parses the header read from the specified stream at the specified startOffset. More... | |
void | parseHeader (std::istream &stream, uint64 startOffset, int32 maxSize) |
Parses the header read from the specified stream at the specified startOffset. More... | |
uint64 | startOffset () const |
Returns the start offset of the page. More... | |
byte | streamStructureVersion () const |
Returns the stream structure version. More... | |
byte | headerTypeFlag () const |
Returns the header type flag. More... | |
bool | isContinued () const |
Returns whether this page is a continued packed (true) or a fresh packed (false). More... | |
bool | isFirstpage () const |
Returns whether this page is the first page of the logical bitstream. More... | |
bool | isLastPage () const |
Returns whether this page is the last page of the logical bitstream. More... | |
uint64 | absoluteGranulePosition () const |
Returns the absolute granule position. More... | |
uint32 | streamSerialNumber () const |
Returns the stream serial number. More... | |
bool | matchesStreamSerialNumber (uint32 streamSerialNumber) const |
Returns whether the stream serial number of the current instance matches the specified one. More... | |
uint32 | sequenceNumber () const |
Returns the page sequence number. More... | |
uint32 | checksum () const |
Returns the page checksum. More... | |
byte | segmentTableSize () const |
Returns the size of the segment table. More... | |
const std::vector< uint32 > & | segmentSizes () const |
Returns the sizes of the segments of the page in byte. More... | |
uint32 | headerSize () const |
Returns the header size in byte. More... | |
uint32 | dataSize () const |
Returns the data size in byte. More... | |
uint32 | totalSize () const |
Returns the total size of the page in byte. More... | |
uint64 | dataOffset (byte segmentIndex=0) const |
Returns the data offset of the segment with the specified segmentIndex. More... | |
Static Public Member Functions | |
static uint32 | computeChecksum (std::istream &stream, uint64 startOffset) |
Computes the actual checksum of the page read from the specified stream at the specified startOffset. More... | |
static void | updateChecksum (std::iostream &stream, uint64 startOffset) |
Updates the checksum of the page read from the specified stream at the specified startOffset. More... | |
static uint32 | makeSegmentSizeDenotation (std::ostream &stream, uint32 size) |
Writes the segment size denotation for the specified segment size to the specified stream. More... | |
|
inline |
|
inline |
|
inline |
Returns the absolute granule position.
The position specified is the total samples encoded after including all packets finished on this page (packets begun on this page but continuing on to the next page do not count). The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is. A truncated stream will still return the proper number of samples that can be decoded fully.
A special value of '-1' (in two's complement) indicates that no packets finish on this page.
|
inline |
Returns the page checksum.
32 bit CRC value (direct algorithm, initial val and final XOR = 0, generator polynomial=0x04c11db7). The value is computed over the entire header (with the CRC field in the header set to zero) and then continued over the page. The CRC field is then filled with the computed value.
|
static |
Computes the actual checksum of the page read from the specified stream at the specified startOffset.
Definition at line 75 of file oggpage.cpp.
|
inline |
Returns the data offset of the segment with the specified segmentIndex.
This is the start offset plus the header size.
|
inline |
|
inline |
|
inline |
Returns the header type flag.
|
inline |
|
inline |
|
inline |
|
static |
Writes the segment size denotation for the specified segment size to the specified stream.
Definition at line 123 of file oggpage.cpp.
|
inline |
Returns whether the stream serial number of the current instance matches the specified one.
void TagParser::OggPage::parseHeader | ( | std::istream & | stream, |
uint64 | startOffset, | ||
int32 | maxSize | ||
) |
Parses the header read from the specified stream at the specified startOffset.
Throws | InvalidDataException if the capture pattern is not present. |
Throws | TruncatedDataException if the header is truncated (according to maxSize). |
Definition at line 25 of file oggpage.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
Returns the start offset of the page.
The start offset has been specified when calling the parseHeader() method.
|
inline |
Returns the stream serial number.
Ogg allows for separate logical bitstreams to be mixed at page granularity in a physical bitstream. The most common case would be sequential arrangement, but it is possible to interleave pages for two separate bitstreams to be decoded concurrently. The serial number is the means by which pages physical pages are associated with a particular logical stream.
|
inline |
|
inline |
|
static |
Updates the checksum of the page read from the specified stream at the specified startOffset.
Definition at line 111 of file oggpage.cpp.