Tag Parser 12.1.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
Public Member Functions | List of all members
TagParser::MatroskaSeekInfo Class Reference

The MatroskaSeekInfo class helps parsing and making "SeekHead"-elements. More...

#include <matroskaseekinfo.h>

Public Member Functions

 MatroskaSeekInfo ()
 Constructs a new MatroskaSeekInfo.
 
const std::vector< EbmlElement * > & seekHeadElements () const
 Returns a pointer to the seek head elements the seek information is composed of.
 
const std::vector< std::pair< EbmlElement::IdentifierType, std::uint64_t > > & info () const
 Returns the seek information gathered when the parse() method was called.
 
std::vector< std::pair< EbmlElement::IdentifierType, std::uint64_t > > & info ()
 Returns a mutable version of the seek information gathered when the parse() method was called.
 
void shift (std::uint64_t start, std::int64_t amount)
 Shifts all offsets greater or equal than start by amount bytes.
 
void parse (EbmlElement *seekHeadElements, Diagnostics &diag, std::size_t maxIndirection=1)
 Parses the specified seekHeadElement and populates info() with the gathered information.
 
void make (std::ostream &stream, Diagnostics &diag)
 Writes a "SeekHead" element for the current instance to the specified stream.
 
std::uint64_t minSize () const
 Returns the minimal number of bytes written when calling the make() method.
 
std::uint64_t maxSize () const
 Returns the maximal number of bytes written when calling the make() method.
 
std::uint64_t actualSize () const
 Returns the number of bytes which will be written when calling the make() method.
 
bool push (unsigned int index, EbmlElement::IdentifierType id, std::uint64_t offset)
 Pushes the specified offset of an element with the specified id to the info.
 
void clear ()
 Resets the object to its initial state.
 

Detailed Description

The MatroskaSeekInfo class helps parsing and making "SeekHead"-elements.

Definition at line 12 of file matroskaseekinfo.h.

Constructor & Destructor Documentation

◆ MatroskaSeekInfo()

TagParser::MatroskaSeekInfo::MatroskaSeekInfo ( )
inline

Constructs a new MatroskaSeekInfo.

Definition at line 37 of file matroskaseekinfo.h.

Member Function Documentation

◆ actualSize()

std::uint64_t TagParser::MatroskaSeekInfo::actualSize ( ) const

Returns the number of bytes which will be written when calling the make() method.

Remarks
The returned value gets invalidated when the object is mutated.

Definition at line 212 of file matroskaseekinfo.cpp.

◆ clear()

void TagParser::MatroskaSeekInfo::clear ( )

Resets the object to its initial state.

Definition at line 251 of file matroskaseekinfo.cpp.

◆ info() [1/2]

std::vector< std::pair< EbmlElement::IdentifierType, std::uint64_t > > & TagParser::MatroskaSeekInfo::info ( )
inline

Returns a mutable version of the seek information gathered when the parse() method was called.

Returns
Returns the seek information as pairs of element IDs and the associated offsets (relative to the beginning of the file).

Definition at line 64 of file matroskaseekinfo.h.

◆ info() [2/2]

const std::vector< std::pair< EbmlElement::IdentifierType, std::uint64_t > > & TagParser::MatroskaSeekInfo::info ( ) const
inline

Returns the seek information gathered when the parse() method was called.

Returns
Returns the seek information as pairs of element IDs and the associated offsets (relative to the beginning of the file).

Definition at line 55 of file matroskaseekinfo.h.

◆ make()

void TagParser::MatroskaSeekInfo::make ( std::ostream &  stream,
Diagnostics diag 
)

Writes a "SeekHead" element for the current instance to the specified stream.

Parameters
streamSpecifies the stream to write the "SeekHead" element to.
Exceptions
Throwsios_base::failure when an IO error occurs.
ThrowsFailure or a derived exception when a making error occurs.

Definition at line 147 of file matroskaseekinfo.cpp.

◆ maxSize()

std::uint64_t TagParser::MatroskaSeekInfo::maxSize ( ) const

Returns the maximal number of bytes written when calling the make() method.

Remarks
The returned value gets invalidated when the object is mutated.

Definition at line 202 of file matroskaseekinfo.cpp.

◆ minSize()

std::uint64_t TagParser::MatroskaSeekInfo::minSize ( ) const

Returns the minimal number of bytes written when calling the make() method.

Remarks
The returned value gets invalidated when the object is mutated.

Definition at line 192 of file matroskaseekinfo.cpp.

◆ parse()

void TagParser::MatroskaSeekInfo::parse ( EbmlElement seekHeadElements,
Diagnostics diag,
std::size_t  maxIndirection = 1 
)

Parses the specified seekHeadElement and populates info() with the gathered information.

Exceptions
Throwsios_base::failure when an IO error occurs.
ThrowsFailure or a derived exception when a parsing error occurs.
Remarks
  • The object does not take ownership over the specified seekHeadElement.
  • Possibly previously parsed info() is not cleared. So subsequent calls can be used to gather seek information from multiple seek head elements. Use clear() manually if that is not wanted.
  • If the specified seekHeadElement references another seek head element the referenced seek head element is parsed as well. One can set maxIndirection to 0 to prevent that or even increase the value to allow following references even more deeply. References to elements which have already been visited are never followed, though.

Definition at line 51 of file matroskaseekinfo.cpp.

◆ push()

bool TagParser::MatroskaSeekInfo::push ( unsigned int  index,
EbmlElement::IdentifierType  id,
std::uint64_t  offset 
)

Pushes the specified offset of an element with the specified id to the info.

If there is an existing entry with the same id and index the existing entry will be updated and no new entry created.

Returns
Returns an indication whether the actualSize() has changed.

Definition at line 231 of file matroskaseekinfo.cpp.

◆ seekHeadElements()

const std::vector< EbmlElement * > & TagParser::MatroskaSeekInfo::seekHeadElements ( ) const
inline

Returns a pointer to the seek head elements the seek information is composed of.

Remarks
This list is initially empty. When calling parse() it is at least populated with the specified seek head element (ownership remains by the caller). In case that seek table references another seek table those elements are also returned (the MatroskaSeekInfo has ownership).

Definition at line 46 of file matroskaseekinfo.h.

◆ shift()

void TagParser::MatroskaSeekInfo::shift ( std::uint64_t  start,
std::int64_t  amount 
)

Shifts all offsets greater or equal than start by amount bytes.

Definition at line 25 of file matroskaseekinfo.cpp.


The documentation for this class was generated from the following files: