Tag Parser
6.2.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
The AbstractTrack class parses and stores technical information about video, audio and other kinds of media tracks. More...
#include <abstracttrack.h>
Public Member Functions | |
virtual | ~AbstractTrack () |
Destroys the track. More... | |
virtual TrackType | type () const |
Returns the type of the track if known; otherwise returns TrackType::Unspecified. More... | |
std::istream & | inputStream () |
Returns the associated input stream. More... | |
void | setInputStream (std::istream &stream) |
Assigns an other input stream. More... | |
std::ostream & | outputStream () |
Returns the associated input stream. More... | |
void | setOutputStream (std::ostream &stream) |
Assigns an other output stream. More... | |
IoUtilities::BinaryReader & | reader () |
Returns a binary reader for the associated stream. More... | |
IoUtilities::BinaryWriter & | writer () |
Returns a binary writer for the associated stream. More... | |
uint64 | startOffset () const |
Returns the start offset of the track in the associated stream. More... | |
MediaFormat | format () const |
Returns the format of the track if known; otherwise returns MediaFormat::Unknown. More... | |
double | version () const |
Returns the version/level of the track if known; otherwise returns 0. More... | |
const char * | formatName () const |
Returns the format of the track as C-style string if known; otherwise returns the format abbreviation or an empty string. More... | |
const char * | formatAbbreviation () const |
Returns the a more or less common abbreviation for the format of the track as C-style string if known; otherwise returns an empty string. More... | |
const std::string & | formatId () const |
Returns the format/codec ID. More... | |
MediaType | mediaType () const |
Returns the media type if known; otherwise returns MediaType::Other. More... | |
const char * | mediaTypeName () const |
Returns the string representation of the media type of the track. More... | |
uint64 | size () const |
Returns the size in bytes if known; otherwise returns 0. More... | |
uint32 | trackNumber () const |
Returns the track number if known; otherwise returns 0. More... | |
uint64 | id () const |
Returns the track ID if known; otherwise returns 0. More... | |
const std::string | name () const |
Returns the track name if known; otherwise returns an empty string. More... | |
const ChronoUtilities::TimeSpan & | duration () const |
Returns the duration if known; otherwise returns a TimeSpan of zero ticks. More... | |
double | bitrate () const |
Returns the average bitrate in kbit/s if known; otherwise returns zero. More... | |
double | maxBitrate () const |
Returns the maximum bitrate in kbit/s if known; otherwise returns zero. More... | |
const ChronoUtilities::DateTime & | creationTime () const |
Returns the creation time if known; otherwise returns a DateTime of zero ticks. More... | |
const ChronoUtilities::DateTime & | modificationTime () const |
Returns the time of the last modification if known; otherwise returns a DateTime of zero ticks. More... | |
const std::string & | language () const |
Returns the language of the track if known; otherwise returns an empty string. More... | |
uint32 | samplingFrequency () const |
Returns the number of samples per second if known; otherwise returns 0. More... | |
uint32 | extensionSamplingFrequency () const |
Returns the number of samples per second if known; otherwise returns 0. More... | |
uint16 | bitsPerSample () const |
Returns the number of bits per sample; otherwise returns 0. More... | |
uint16 | channelCount () const |
Returns the number of channels if known; otherwise returns 0. More... | |
byte | channelConfig () const |
Returns the channel configuration. More... | |
const char * | channelConfigString () const |
Returns a string with the channel configuration if available; otherwise returns nullptr. More... | |
byte | extensionChannelConfig () const |
Returns the extension channel configuration if available; otherwise returns nullptr. More... | |
const char * | extensionChannelConfigString () const |
Returns a string with the extension channel configuration if available; otherwise returns nullptr. More... | |
uint64 | sampleCount () const |
Returns the number of samples if known; otherwise returns 0. More... | |
int | quality () const |
Returns the quality if known; otherwise returns 0. More... | |
const Size & | pixelSize () const |
Returns the size of the encoded video frames if known; otherwise returns a zero size. More... | |
const Size & | displaySize () const |
Returns the size of the video frames to display if known; otherwise returns a zero size. More... | |
const Size & | resolution () const |
Returns the resolution if known; otherwise returns a zero size. More... | |
const std::string & | compressorName () const |
Returns the compressor name if known; otherwise returns an empty string. More... | |
uint16 | depth () const |
Returns the bit depth if known; otherwise returns 0. More... | |
uint32 | fps () const |
Returns the number of frames per second if known; otherwise returns 0. More... | |
const char * | chromaFormat () const |
Returns the chroma subsampling format if known; otherwise returns nullptr. More... | |
const AspectRatio & | pixelAspectRatio () const |
Returns the pixel aspect ratio (PAR). More... | |
bool | isInterlaced () const |
Returns true if the video is denoted as interlaced; otherwise returns false. More... | |
uint32 | timeScale () const |
Returns the time scale if known; otherwise returns 0. More... | |
bool | isEnabled () const |
Returns true if the track is denoted as enabled; otherwise returns false. More... | |
bool | isDefault () const |
Returns true if the track is denoted as default; otherwise returns false. More... | |
bool | isForced () const |
Returns true if the track is denoted as forced; otherwise returns false. More... | |
bool | hasLacing () const |
Returns true if the track has lacing; otherwise returns false. More... | |
bool | isEncrypted () const |
Returns true if the track is denoted as encrypted; otherwise returns false. More... | |
uint32 | colorSpace () const |
Returns the color space if known; otherwise returns 0. More... | |
const Margin & | cropping () const |
Returns the cropping if known; otherwise returns zero margins. More... | |
std::string | label () const |
Returns a label for the track. More... | |
void | parseHeader () |
Parses technical information about the track from the header. More... | |
bool | isHeaderValid () const |
Returns an indication whether the track header is valid. More... | |
![]() | |
const NotificationList & | notifications () 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... | |
StatusProvider * | usedProvider () |
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 ¬ification) |
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 ¬ifications) |
This protected method is meant to be called by the derived class to add the specified notifications. More... | |
Protected Member Functions | |
AbstractTrack (std::istream &inputStream, std::ostream &outputStream, uint64 startOffset) | |
Constructs a new track. More... | |
AbstractTrack (std::iostream &stream, uint64 startOffset) | |
Constructs a new track. More... | |
virtual void | internalParseHeader ()=0 |
This method is internally called to parse header information. More... | |
![]() | |
StatusProvider () | |
Constructs a new StatusProvider. More... | |
Friends | |
class | MpegAudioFrameStream |
class | WaveAudioStream |
class | Mp4Track |
Additional Inherited Members | |
![]() | |
typedef std::function< void(StatusProvider &sender)> | CallbackFunction |
typedef std::vector< CallbackFunction > | CallbackVector |
typedef std::pair< int, CallbackFunction > | CallbackPair |
The AbstractTrack class parses and stores technical information about video, audio and other kinds of media tracks.
The tag class only provides the interface and common functionality. It is meant to be subclassed.
Definition at line 40 of file abstracttrack.h.
|
virtual |
Destroys the track.
Definition at line 85 of file abstracttrack.cpp.
|
protected |
Constructs a new track.
inputStream | Specifies the stream the track will read from to perform particular operations such as reading header information. |
outputStream | Specifies the stream the track will write to to perform particular operations such as updating or making header information. |
startOffset | The start offset of the track in the specified stream. |
Definition at line 32 of file abstracttrack.cpp.
|
protected |
Constructs a new track.
stream | Specifies the stream the track will read from or write to to perform particular operations such as reading header information. |
startOffset | The start offset of the track in the specified stream. |
Definition at line 78 of file abstracttrack.cpp.
|
inline |
Returns the average bitrate in kbit/s if known; otherwise returns zero.
Definition at line 347 of file abstracttrack.h.
|
inline |
Returns the number of bits per sample; otherwise returns 0.
Definition at line 406 of file abstracttrack.h.
|
inline |
Returns the channel configuration.
This is the MPEG-4 channel config for MPEG-4 audio.
Definition at line 427 of file abstracttrack.h.
const char * Media::AbstractTrack::channelConfigString | ( | ) | const |
Returns a string with the channel configuration if available; otherwise returns nullptr.
Definition at line 91 of file abstracttrack.cpp.
|
inline |
Returns the number of channels if known; otherwise returns 0.
This value only makes sense for audio tracks.
Definition at line 416 of file abstracttrack.h.
|
inline |
Returns the chroma subsampling format if known; otherwise returns nullptr.
This value only makes sense for video tracks.
Definition at line 511 of file abstracttrack.h.
|
inline |
Returns the color space if known; otherwise returns 0.
Definition at line 587 of file abstracttrack.h.
|
inline |
Returns the compressor name if known; otherwise returns an empty string.
Definition at line 483 of file abstracttrack.h.
|
inline |
Returns the creation time if known; otherwise returns a DateTime of zero ticks.
Definition at line 363 of file abstracttrack.h.
|
inline |
Returns the cropping if known; otherwise returns zero margins.
Definition at line 595 of file abstracttrack.h.
|
inline |
Returns the bit depth if known; otherwise returns 0.
Definition at line 491 of file abstracttrack.h.
|
inline |
Returns the size of the video frames to display if known; otherwise returns a zero size.
This value only makes sense for video tracks.
Definition at line 465 of file abstracttrack.h.
|
inline |
Returns the duration if known; otherwise returns a TimeSpan of zero ticks.
Definition at line 339 of file abstracttrack.h.
byte Media::AbstractTrack::extensionChannelConfig | ( | ) | const |
Returns the extension channel configuration if available; otherwise returns nullptr.
Definition at line 106 of file abstracttrack.cpp.
const char * Media::AbstractTrack::extensionChannelConfigString | ( | ) | const |
Returns a string with the extension channel configuration if available; otherwise returns nullptr.
Definition at line 114 of file abstracttrack.cpp.
|
inline |
Returns the number of samples per second if known; otherwise returns 0.
Definition at line 398 of file abstracttrack.h.
|
inline |
Returns the format of the track if known; otherwise returns MediaFormat::Unknown.
Definition at line 244 of file abstracttrack.h.
|
inline |
Returns the a more or less common abbreviation for the format of the track as C-style string if known; otherwise returns an empty string.
Definition at line 273 of file abstracttrack.h.
|
inline |
Returns the format/codec ID.
This is usually the raw format identifier extracted from the container) if known; otherwise returns an empty string.
Definition at line 283 of file abstracttrack.h.
|
inline |
Returns the format of the track as C-style string if known; otherwise returns the format abbreviation or an empty string.
Definition at line 264 of file abstracttrack.h.
|
inline |
Returns the number of frames per second if known; otherwise returns 0.
This value only makes sense for video tracks.
Definition at line 501 of file abstracttrack.h.
|
inline |
Returns true if the track has lacing; otherwise returns false.
Definition at line 571 of file abstracttrack.h.
|
inline |
Returns the track ID if known; otherwise returns 0.
Definition at line 323 of file abstracttrack.h.
|
inline |
Returns the associated input stream.
Definition at line 166 of file abstracttrack.h.
|
protectedpure virtual |
This method is internally called to parse header information.
It needs to be implemented when subclassing this class.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | Media::Failure or a derived exception when a parsing error occurs. |
Implemented in Media::Mp4Track, Media::WaveAudioStream, Media::FlacStream, Media::OggStream, Media::MpegAudioFrameStream, Media::MatroskaTrack, and Media::AdtsStream.
|
inline |
Returns true if the track is denoted as default; otherwise returns false.
Definition at line 555 of file abstracttrack.h.
|
inline |
Returns true if the track is denoted as enabled; otherwise returns false.
Definition at line 547 of file abstracttrack.h.
|
inline |
Returns true if the track is denoted as encrypted; otherwise returns false.
Definition at line 579 of file abstracttrack.h.
|
inline |
Returns true if the track is denoted as forced; otherwise returns false.
Definition at line 563 of file abstracttrack.h.
|
inline |
Returns an indication whether the track header is valid.
Definition at line 603 of file abstracttrack.h.
|
inline |
Returns true if the video is denoted as interlaced; otherwise returns false.
This value only makes sense for video tracks.
Definition at line 529 of file abstracttrack.h.
string Media::AbstractTrack::label | ( | ) | const |
Returns a label for the track.
Definition at line 127 of file abstracttrack.cpp.
|
inline |
Returns the language of the track if known; otherwise returns an empty string.
The format of the language denotation depends on the particular implementation.
Definition at line 381 of file abstracttrack.h.
|
inline |
Returns the maximum bitrate in kbit/s if known; otherwise returns zero.
Definition at line 355 of file abstracttrack.h.
|
inline |
Returns the media type if known; otherwise returns MediaType::Other.
Definition at line 291 of file abstracttrack.h.
|
inline |
Returns the string representation of the media type of the track.
Definition at line 299 of file abstracttrack.h.
|
inline |
Returns the time of the last modification if known; otherwise returns a DateTime of zero ticks.
Definition at line 371 of file abstracttrack.h.
|
inline |
Returns the track name if known; otherwise returns an empty string.
Definition at line 331 of file abstracttrack.h.
|
inline |
Returns the associated input stream.
Definition at line 186 of file abstracttrack.h.
void Media::AbstractTrack::parseHeader | ( | ) |
Parses technical information about the track from the header.
The information will be read from the associated stream. The stream and the start offset of the track have been specified when constructing the Track.
The parsed information can be accessed using the corresponding methods.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | Media::Failure or a derived exception when a parsing error occurs. |
Definition at line 153 of file abstracttrack.cpp.
|
inline |
Returns the pixel aspect ratio (PAR).
Definition at line 519 of file abstracttrack.h.
|
inline |
Returns the size of the encoded video frames if known; otherwise returns a zero size.
This value only makes sense for video tracks.
Definition at line 455 of file abstracttrack.h.
|
inline |
Returns the quality if known; otherwise returns 0.
The scale depends on the format.
Definition at line 445 of file abstracttrack.h.
|
inline |
Returns a binary reader for the associated stream.
Definition at line 209 of file abstracttrack.h.
|
inline |
Returns the resolution if known; otherwise returns a zero size.
This value only makes sense for video tracks.
Definition at line 475 of file abstracttrack.h.
|
inline |
Returns the number of samples if known; otherwise returns 0.
Definition at line 435 of file abstracttrack.h.
|
inline |
Returns the number of samples per second if known; otherwise returns 0.
Definition at line 389 of file abstracttrack.h.
|
inline |
Assigns an other input stream.
The track will read from the stream to perform particular operations such as reading header information.
Definition at line 177 of file abstracttrack.h.
|
inline |
Assigns an other output stream.
The track will write to the stream to perform particular operations such as updating or making header information.
Definition at line 197 of file abstracttrack.h.
|
inline |
Returns the size in bytes if known; otherwise returns 0.
Definition at line 307 of file abstracttrack.h.
|
inline |
Returns the start offset of the track in the associated stream.
Definition at line 236 of file abstracttrack.h.
|
inline |
Returns the time scale if known; otherwise returns 0.
The time scale depends on the format.
Definition at line 539 of file abstracttrack.h.
|
inline |
Returns the track number if known; otherwise returns 0.
Definition at line 315 of file abstracttrack.h.
|
inlinevirtual |
Returns the type of the track if known; otherwise returns TrackType::Unspecified.
Reimplemented in Media::Mp4Track, Media::WaveAudioStream, Media::OggStream, Media::FlacStream, Media::MpegAudioFrameStream, Media::MatroskaTrack, and Media::AdtsStream.
Definition at line 228 of file abstracttrack.h.
|
inline |
Returns the version/level of the track if known; otherwise returns 0.
Definition at line 252 of file abstracttrack.h.
|
inline |
Returns a binary writer for the associated stream.
Definition at line 220 of file abstracttrack.h.
|
friend |
Definition at line 44 of file abstracttrack.h.
|
friend |
Definition at line 42 of file abstracttrack.h.
|
friend |
Definition at line 43 of file abstracttrack.h.
|
protected |
Definition at line 127 of file abstracttrack.h.
|
protected |
Definition at line 134 of file abstracttrack.h.
|
protected |
Definition at line 135 of file abstracttrack.h.
|
protected |
Definition at line 137 of file abstracttrack.h.
|
protected |
Definition at line 136 of file abstracttrack.h.
|
protected |
Definition at line 148 of file abstracttrack.h.
|
protected |
Definition at line 139 of file abstracttrack.h.
|
protected |
Definition at line 159 of file abstracttrack.h.
|
protected |
Definition at line 145 of file abstracttrack.h.
|
protected |
Definition at line 129 of file abstracttrack.h.
|
protected |
Definition at line 160 of file abstracttrack.h.
|
protected |
Definition at line 153 of file abstracttrack.h.
|
protected |
Definition at line 146 of file abstracttrack.h.
|
protected |
Definition at line 143 of file abstracttrack.h.
|
protected |
Definition at line 126 of file abstracttrack.h.
|
protected |
Definition at line 152 of file abstracttrack.h.
|
protected |
Definition at line 156 of file abstracttrack.h.
|
protected |
Definition at line 138 of file abstracttrack.h.
|
protected |
Definition at line 133 of file abstracttrack.h.
|
protected |
Definition at line 154 of file abstracttrack.h.
|
protected |
Definition at line 117 of file abstracttrack.h.
|
protected |
Definition at line 118 of file abstracttrack.h.
|
protected |
Definition at line 119 of file abstracttrack.h.
|
protected |
Definition at line 147 of file abstracttrack.h.
|
protected |
Definition at line 116 of file abstracttrack.h.
|
protected |
Definition at line 124 of file abstracttrack.h.
|
protected |
Definition at line 150 of file abstracttrack.h.
|
protected |
Definition at line 111 of file abstracttrack.h.
|
protected |
Definition at line 155 of file abstracttrack.h.
|
protected |
Definition at line 131 of file abstracttrack.h.
|
protected |
Definition at line 128 of file abstracttrack.h.
|
protected |
Definition at line 120 of file abstracttrack.h.
|
protected |
Definition at line 130 of file abstracttrack.h.
|
protected |
Definition at line 125 of file abstracttrack.h.
|
protected |
Definition at line 112 of file abstracttrack.h.
|
protected |
Definition at line 149 of file abstracttrack.h.
|
protected |
Definition at line 142 of file abstracttrack.h.
|
protected |
Definition at line 141 of file abstracttrack.h.
|
protected |
Definition at line 113 of file abstracttrack.h.
|
protected |
Definition at line 144 of file abstracttrack.h.
|
protected |
Definition at line 140 of file abstracttrack.h.
|
protected |
Definition at line 132 of file abstracttrack.h.
|
protected |
Definition at line 122 of file abstracttrack.h.
|
protected |
Definition at line 115 of file abstracttrack.h.
|
protected |
Definition at line 151 of file abstracttrack.h.
|
protected |
Definition at line 123 of file abstracttrack.h.
|
protected |
Definition at line 157 of file abstracttrack.h.
|
protected |
Definition at line 158 of file abstracttrack.h.
|
protected |
Definition at line 121 of file abstracttrack.h.
|
protected |
Definition at line 114 of file abstracttrack.h.