1#ifndef TAG_PARSER_ABSTRACTTRACK_H
2#define TAG_PARSER_ABSTRACTTRACK_H
11#include <c++utilities/chrono/datetime.h>
12#include <c++utilities/chrono/timespan.h>
13#include <c++utilities/io/binaryreader.h>
14#include <c++utilities/io/binarywriter.h>
15#include <c++utilities/misc/flagenumclass.h>
23class AbortableProgressFeedback;
76 Unknown = std::numeric_limits<std::uint64_t>::max(),
83 Unknown = std::numeric_limits<std::uint64_t>::max(),
98 Unknown = std::numeric_limits<std::uint64_t>::max(),
116 std::istream &inputStream();
117 void setInputStream(std::istream &stream);
118 std::ostream &outputStream();
119 void setOutputStream(std::ostream &stream);
120 CppUtilities::BinaryReader &reader();
121 CppUtilities::BinaryWriter &writer();
122 std::uint64_t startOffset()
const;
125 double version()
const;
126 std::string_view formatName()
const;
127 std::string_view formatAbbreviation()
const;
128 const std::string &formatId()
const;
131 std::uint64_t size()
const;
132 std::uint32_t trackNumber()
const;
133 void setTrackNumber(std::uint32_t trackNumber);
134 std::uint64_t id()
const;
135 void setId(std::uint64_t
id);
136 const std::string name()
const;
137 void setName(std::string_view name);
138 const CppUtilities::TimeSpan &duration()
const;
139 double bitrate()
const;
140 double maxBitrate()
const;
141 const CppUtilities::DateTime &creationTime()
const;
142 const CppUtilities::DateTime &modificationTime()
const;
143 const Locale &locale()
const;
144 void setLocale(
const Locale &locale);
145 std::uint32_t samplingFrequency()
const;
146 std::uint32_t extensionSamplingFrequency()
const;
147 std::uint16_t bitsPerSample()
const;
148 std::uint16_t channelCount()
const;
149 std::uint8_t channelConfig()
const;
150 std::string_view channelConfigString()
const;
151 std::uint8_t extensionChannelConfig()
const;
152 std::string_view extensionChannelConfigString()
const;
153 std::uint64_t sampleCount()
const;
155 const Size &pixelSize()
const;
156 const Size &displaySize()
const;
157 const Size &resolution()
const;
158 const std::string &compressorName()
const;
159 void setCompressorName(std::string_view compressorName);
160 std::uint16_t depth()
const;
161 std::uint32_t fps()
const;
162 std::string_view chromaFormat()
const;
164 bool isInterlaced()
const;
165 std::uint32_t timeScale()
const;
166 bool isEnabled()
const;
167 void setEnabled(
bool enabled);
168 bool isDefault()
const;
169 void setDefault(
bool isDefault);
170 bool isForced()
const;
171 void setForced(
bool forced);
172 bool hasLacing()
const;
173 bool isEncrypted()
const;
174 std::uint32_t colorSpace()
const;
175 const Margin &cropping()
const;
176 std::string label()
const;
177 std::string description()
const;
178 std::string shortDescription()
const;
181 bool isHeaderValid()
const;
184 AbstractTrack(std::istream &inputStream, std::ostream &outputStream, std::uint64_t startOffset);
185 AbstractTrack(std::iostream &stream, std::uint64_t startOffset);
237 std::string makeDescription(
bool verbose)
const;
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
The AbstractTrack class parses and stores technical information about video, audio and other kinds of...
std::uint64_t id() const
Returns the track ID if known; otherwise returns 0.
std::string_view formatAbbreviation() const
Returns the a more or less common abbreviation for the format of the track if known; otherwise return...
std::uint64_t size() const
Returns the size in bytes if known; otherwise returns 0.
std::uint32_t m_colorSpace
std::uint32_t timeScale() const
Returns the time scale if known; otherwise returns 0.
const CppUtilities::DateTime & modificationTime() const
Returns the time of the last modification if known; otherwise returns a DateTime of zero ticks.
std::uint8_t m_extensionChannelConfig
std::uint32_t extensionSamplingFrequency() const
Returns the number of samples per second if known; otherwise returns 0.
std::string_view m_chromaFormat
std::uint64_t m_sampleCount
std::uint16_t depth() const
Returns the bit depth if known; otherwise returns 0.
std::uint64_t startOffset() const
Returns the start offset of the track in the associated stream.
const Locale & locale() const
Returns the locale of the track if known; otherwise returns an empty locale.
std::uint32_t m_bytesPerSecond
const std::string & compressorName() const
Returns the compressor name if known; otherwise returns an empty string.
const CppUtilities::DateTime & creationTime() const
Returns the creation time if known; otherwise returns a DateTime of zero ticks.
double bitrate() const
Returns the average bitrate in kbit/s if known; otherwise returns zero.
AspectRatioType m_aspectRatioType
std::string_view formatName() const
Returns the format of the track as C-style string if known; otherwise returns the format abbreviation...
AspectRatio m_pixelAspectRatio
const Size & displaySize() const
Returns the size of the video frames to display if known; otherwise returns a zero size.
void setEnabled(bool enabled)
Sets whether the track is enabled.
double version() const
Returns the version/level of the track if known; otherwise returns 0.
const Size & pixelSize() const
Returns the size of the encoded video frames if known; otherwise returns a zero size.
std::uint16_t m_bitsPerSample
void setDefault(bool isDefault)
Sets whether the track is a default track.
std::uint32_t m_trackNumber
void setId(std::uint64_t id)
Sets the track ID.
std::istream & inputStream()
Returns the associated input stream.
virtual TrackType type() const
Returns the type of the track if known; otherwise returns TrackType::Unspecified.
void setCompressorName(std::string_view compressorName)
Returns the compressor name if known; otherwise returns an empty string.
bool isEnabled() const
Returns true if the track is marked as enabled; otherwise returns false.
std::uint16_t m_channelCount
bool hasLacing() const
Returns true if the track has lacing; otherwise returns false.
std::uint64_t sampleCount() const
Returns the number of samples/frames if known; otherwise returns 0.
std::uint8_t m_channelConfig
std::uint32_t samplingFrequency() const
Returns the number of samples per second if known; otherwise returns 0.
const AspectRatio & pixelAspectRatio() const
Returns the pixel aspect ratio (PAR).
CppUtilities::BinaryReader & reader()
Returns a binary reader for the associated stream.
CppUtilities::TimeSpan m_duration
std::uint32_t trackNumber() const
Returns the track number if known; otherwise returns 0.
const std::string & formatId() const
Returns the format/codec ID.
CppUtilities::BinaryReader m_reader
int quality() const
Returns the quality if known; otherwise returns 0.
std::uint32_t fps() const
Returns the number of frames per second if known; otherwise returns 0.
void setName(std::string_view name)
Sets the name.
std::uint16_t m_chunkSize
std::string_view mediaTypeName() const
Returns the string representation of the media type of the track.
std::uint64_t m_startOffset
std::uint32_t colorSpace() const
Returns the color space if known; otherwise returns 0.
TrackFlags flags() const
Returns flags (various boolean properties) of this track.
std::uint32_t m_timeScale
MediaType mediaType() const
Returns the media type if known; otherwise returns MediaType::Other.
CppUtilities::DateTime m_modificationTime
void setTrackNumber(std::uint32_t trackNumber)
Sets the track number.
CppUtilities::BinaryWriter m_writer
std::uint16_t channelCount() const
Returns the number of channels if known; otherwise returns 0.
std::uint16_t bitsPerSample() const
Returns the number of bits per sample; otherwise returns 0.
bool isHeaderValid() const
Returns an indication whether the track header is valid.
void setOutputStream(std::ostream &stream)
Assigns another output stream.
std::ostream & outputStream()
Returns the associated output stream.
void setForced(bool forced)
Sets whether the track is forced.
void setInputStream(std::istream &stream)
Assigns another input stream.
double maxBitrate() const
Returns the maximum bitrate in kbit/s if known; otherwise returns zero.
const CppUtilities::TimeSpan & duration() const
Returns the duration if known; otherwise returns a TimeSpan of zero ticks.
std::uint32_t m_extensionSamplingFrequency
virtual void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress)=0
This method is internally called to parse header information.
std::string_view chromaFormat() const
Returns the chroma subsampling format if known; otherwise returns nullptr.
bool isForced() const
Returns true if the track is marked as forced; otherwise returns false.
bool isEncrypted() const
Returns true if the track is marked as encrypted; otherwise returns false.
std::uint8_t channelConfig() const
Returns the channel configuration.
const Size & resolution() const
Returns the resolution if known; otherwise returns a zero size.
const std::string name() const
Returns the track name if known; otherwise returns an empty string.
bool isDefault() const
Returns true if the track is marked as default; otherwise returns false.
CppUtilities::DateTime m_creationTime
void setLocale(const Locale &locale)
Sets the locale of the track.
std::string m_compressorName
std::uint32_t m_samplingFrequency
bool isInterlaced() const
Returns true if the video is interlaced; otherwise returns false.
const Margin & cropping() const
Returns the cropping if known; otherwise returns zero margins.
CppUtilities::BinaryWriter & writer()
Returns a binary writer for the associated stream.
DisplayUnit m_displayUnit
MediaFormat format() const
Returns the format of the track if known; otherwise returns MediaFormat::Unknown.
Implementation of TagParser::AbstractTrack for ADTS streams.
The Diagnostics class is a container for DiagMessage.
Implementation of TagParser::AbstractTrack for raw FLAC streams.
Implementation of TagParser::AbstractTrack for ADTS streams.
The Margin class defines the four margins of a rectangle.
Implementation of TagParser::AbstractTrack for the Matroska container.
Implementation of TagParser::AbstractTrack for the MP4 container.
Implementation of TagParser::AbstractTrack MPEG audio streams.
Implementation of TagParser::AbstractTrack for OGG streams.
The Size class defines the size of a two-dimensional object using integer point precision.
Implementation of TagParser::AbstractTrack for the RIFF WAVE container format.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.
AspectRatioType
The AspectRatioType enum specifies the possible modifications to the aspect ratio.
StereoMode
The StereoMode enum specifies the Stereo-3D video mode.
DisplayUnit
The DisplayUnit enum specifies how display width and heigh are interpreted.
AlphaMode
The AlphaMode enum specifies the alpha video mode.
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
FieldOrder
The FieldOrder enum declares the field ordering of the video.
TrackType
The TrackType enum specifies the underlying file type of a track and the concrete class of the track ...
TAG_PARSER_EXPORT std::string_view mediaTypeName(MediaType mediaType)
Returns the string representation for the specified mediaType.
TrackFlags
The TrackFlags enum specifies miscellaneous boolean properties of a track.
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::TagCreationFlags)
The AspectRatio struct defines an aspect ratio.
The Locale struct specifies a language and/or a country using one or more LocaleDetail objects.