Tag Parser  6.2.2
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Public Member Functions | Static Public Member Functions | List of all members
Media::MatroskaSeekInfo Class Reference

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

#include <matroskaseekinfo.h>

Inheritance diagram for Media::MatroskaSeekInfo:
[legend]
Collaboration diagram for Media::MatroskaSeekInfo:
[legend]

Public Member Functions

 MatroskaSeekInfo ()
 Constructs a new MatroskaSeekInfo. More...
 
EbmlElementseekHeadElement () const
 Returns a pointer to the seekHeadElement specified when the parse() method was called. More...
 
const std::vector< std::pair< EbmlElement::identifierType, uint64 > > & info () const
 Returns the seek information gathered when the parse() method was called. More...
 
std::vector< std::pair< EbmlElement::identifierType, uint64 > > & info ()
 Returns a mutable version of the seek information gathered when the parse() method was called. More...
 
void shift (uint64 start, int64 amount)
 Shifts all offsets greather or equal than start by amount bytes. More...
 
void parse (EbmlElement *seekHeadElement)
 Parses the specified seekHeadElement. More...
 
void make (std::ostream &stream)
 Writes a "SeekHead" element for the current instance to the specified stream. More...
 
uint64 minSize () const
 Returns the minimal number of bytes written when calling the make() method. More...
 
uint64 maxSize () const
 Returns the maximal number of bytes written when calling the make() method. More...
 
uint64 actualSize () const
 Returns the number of bytes which will be written when calling the make() method. More...
 
bool push (unsigned int index, EbmlElement::identifierType id, uint64 offset)
 Pushes the specified offset of an element with the specified id to the info. More...
 
void clear ()
 Resets the object to its initial state. More...
 
- Public Member Functions inherited from Media::StatusProvider
const NotificationListnotifications () const
 Returns notifications for the current object. More...
 
bool hasNotifications () const
 Returns an indication whether there are notifications for the current object. More...
 
bool hasCriticalNotifications () const
 Returns an indication whether there are critical notifications for the current object. More...
 
NotificationType worstNotificationType () const
 Returns the worst notification type. More...
 
const std::string & currentStatus () const
 Returns a status information for the current object. More...
 
double currentPercentage () const
 Returns the progress percentage of the current object. More...
 
size_t registerCallback (CallbackFunction callback)
 Registers a callback function. More...
 
void unregisterCallback (size_t id)
 Unregisters a previously registered callback function whith the specified id. More...
 
void unregisterAllCallbacks ()
 Unregisters all callback functions. More...
 
void forwardStatusUpdateCalls (StatusProvider *other=nullptr)
 Forwards all status updates calls to the specified statusProvider. More...
 
StatusProviderusedProvider ()
 Returns the provider which callback functions will be called when the status or the percentage is updated. More...
 
void tryToAbort ()
 Commands the object to abort the current operation. More...
 
bool isAborted () const
 Returns an indication whether the current operation should be aborted. More...
 
void invalidateStatus ()
 Invalidates the current status. More...
 
void invalidateNotifications ()
 Invalidates the object's notifications. More...
 
void updateStatus (const std::string &status)
 This method is meant to be called by the derived class to report updated status information. More...
 
void updateStatus (const std::string &status, double percentage)
 This method is meant to be called by the derived class to report updated status information. More...
 
void updatePercentage (double percentage)
 This method is meant to be called by the derived class to report updated progress percentage only. More...
 
void addNotification (const Notification &notification)
 This protected method is meant to be called by the derived class to add a notification. More...
 
void addNotification (NotificationType type, const std::string &message, const std::string &context)
 This protected method is meant to be called by the derived class to add a notification of the specified type, message and context. More...
 
void addNotifications (const StatusProvider &from)
 This protected method is meant to be called by the derived class to add all notifications from another StatusProvider instance. More...
 
void addNotifications (const std::string &higherContext, const StatusProvider &from)
 This protected method is meant to be called by the derived class to add all notifications from another StatusProvider instance. More...
 
void addNotifications (const NotificationList &notifications)
 This protected method is meant to be called by the derived class to add the specified notifications. More...
 

Static Public Member Functions

static std::pair< EbmlElement::identifierType, uint64 > * findSeekInfo (std::vector< MatroskaSeekInfo > &seekInfos, uint64 offset)
 Returns a pointer to the first pair with the specified offset or nullptr if no such pair could be found. More...
 
static bool updateSeekInfo (const std::vector< MatroskaSeekInfo > &oldSeekInfos, std::vector< MatroskaSeekInfo > &newSeekInfos, uint64 oldOffset, uint64 newOffset)
 Sets the offset of all entires in newSeekInfos to newOffset where the corresponding entry in oldSeekInfos has the offset oldOffset. More...
 
static bool updateSeekInfo (std::vector< MatroskaSeekInfo > &newSeekInfos, uint64 oldOffset, uint64 newOffset)
 Sets the offset of all entires in newSeekInfos to newOffset where the offset is oldOffset. More...
 

Additional Inherited Members

- Public Types inherited from Media::StatusProvider
typedef std::function< void(StatusProvider &sender)> CallbackFunction
 
typedef std::vector< CallbackFunctionCallbackVector
 
typedef std::pair< int, CallbackFunctionCallbackPair
 
- Protected Member Functions inherited from Media::StatusProvider
 StatusProvider ()
 Constructs a new StatusProvider. More...
 

Detailed Description

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

Definition at line 12 of file matroskaseekinfo.h.

Constructor & Destructor Documentation

◆ MatroskaSeekInfo()

Media::MatroskaSeekInfo::MatroskaSeekInfo ( )
inline

Constructs a new MatroskaSeekInfo.

Definition at line 42 of file matroskaseekinfo.h.

Member Function Documentation

◆ actualSize()

uint64 Media::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 165 of file matroskaseekinfo.cpp.

◆ clear()

void Media::MatroskaSeekInfo::clear ( )

Resets the object to its initial state.

Definition at line 203 of file matroskaseekinfo.cpp.

◆ findSeekInfo()

std::pair< EbmlElement::identifierType, uint64 > * Media::MatroskaSeekInfo::findSeekInfo ( std::vector< MatroskaSeekInfo > &  seekInfos,
uint64  offset 
)
static

Returns a pointer to the first pair with the specified offset or nullptr if no such pair could be found.

Definition at line 212 of file matroskaseekinfo.cpp.

◆ info() [1/2]

const std::vector< std::pair< EbmlElement::identifierType, uint64 > > & Media::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 58 of file matroskaseekinfo.h.

◆ info() [2/2]

std::vector< std::pair< EbmlElement::identifierType, uint64 > > & Media::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 67 of file matroskaseekinfo.h.

◆ make()

void Media::MatroskaSeekInfo::make ( std::ostream &  stream)

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 102 of file matroskaseekinfo.cpp.

◆ maxSize()

uint64 Media::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 155 of file matroskaseekinfo.cpp.

◆ minSize()

uint64 Media::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 145 of file matroskaseekinfo.cpp.

◆ parse()

void Media::MatroskaSeekInfo::parse ( EbmlElement seekHeadElement)

Parses the specified seekHeadElement.

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.

Definition at line 39 of file matroskaseekinfo.cpp.

◆ push()

bool Media::MatroskaSeekInfo::push ( unsigned int  index,
EbmlElement::identifierType  id,
uint64  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 183 of file matroskaseekinfo.cpp.

◆ seekHeadElement()

EbmlElement * Media::MatroskaSeekInfo::seekHeadElement ( ) const
inline

Returns a pointer to the seekHeadElement specified when the parse() method was called.

Definition at line 49 of file matroskaseekinfo.h.

◆ shift()

void Media::MatroskaSeekInfo::shift ( uint64  start,
int64  amount 
)

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

Definition at line 24 of file matroskaseekinfo.cpp.

◆ updateSeekInfo() [1/2]

bool Media::MatroskaSeekInfo::updateSeekInfo ( const std::vector< MatroskaSeekInfo > &  oldSeekInfos,
std::vector< MatroskaSeekInfo > &  newSeekInfos,
uint64  oldOffset,
uint64  newOffset 
)
static

Sets the offset of all entires in newSeekInfos to newOffset where the corresponding entry in oldSeekInfos has the offset oldOffset.

Returns
Returns an indication whether the update altered the offset length.

Definition at line 228 of file matroskaseekinfo.cpp.

◆ updateSeekInfo() [2/2]

bool Media::MatroskaSeekInfo::updateSeekInfo ( std::vector< MatroskaSeekInfo > &  newSeekInfos,
uint64  oldOffset,
uint64  newOffset 
)
static

Sets the offset of all entires in newSeekInfos to newOffset where the offset is oldOffset.

Returns
Returns an whether at least one offset has been updated.

Definition at line 252 of file matroskaseekinfo.cpp.


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