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>
24class AbortableProgressFeedback;
77 Unknown = std::numeric_limits<std::uint64_t>::max(),
84 Unknown = std::numeric_limits<std::uint64_t>::max(),
99 Unknown = std::numeric_limits<std::uint64_t>::max(),
108struct AbstractTrackPrivate;
119 std::istream &inputStream();
120 void setInputStream(std::istream &stream);
121 std::ostream &outputStream();
122 void setOutputStream(std::ostream &stream);
123 CppUtilities::BinaryReader &reader();
124 CppUtilities::BinaryWriter &writer();
125 std::uint64_t startOffset()
const;
128 double version()
const;
129 std::string_view formatName()
const;
130 std::string_view formatAbbreviation()
const;
131 const std::string &formatId()
const;
134 std::uint64_t size()
const;
135 void setSize(std::uint64_t size);
136 std::uint32_t trackNumber()
const;
137 void setTrackNumber(std::uint32_t trackNumber);
138 std::uint64_t id()
const;
139 void setId(std::uint64_t
id);
140 const std::string name()
const;
141 void setName(std::string_view name);
142 const CppUtilities::TimeSpan &duration()
const;
143 double bitrate()
const;
144 double maxBitrate()
const;
145 const CppUtilities::DateTime &creationTime()
const;
146 const CppUtilities::DateTime &modificationTime()
const;
147 const Locale &locale()
const;
148 void setLocale(
const Locale &locale);
149 std::uint32_t samplingFrequency()
const;
150 std::uint32_t extensionSamplingFrequency()
const;
151 std::uint16_t bitsPerSample()
const;
152 std::uint16_t channelCount()
const;
153 std::uint8_t channelConfig()
const;
154 std::string_view channelConfigString()
const;
155 std::uint8_t extensionChannelConfig()
const;
156 std::string_view extensionChannelConfigString()
const;
157 std::uint64_t sampleCount()
const;
159 const Size &pixelSize()
const;
160 const Size &displaySize()
const;
161 const Size &resolution()
const;
162 const std::string &compressorName()
const;
163 void setCompressorName(std::string_view compressorName);
164 std::uint16_t depth()
const;
165 std::uint32_t fps()
const;
166 std::string_view chromaFormat()
const;
168 bool isInterlaced()
const;
169 std::uint32_t timeScale()
const;
170 bool isEnabled()
const;
171 void setEnabled(
bool enabled);
172 bool isDefault()
const;
173 void setDefault(
bool isDefault);
174 bool isForced()
const;
175 void setForced(
bool forced);
176 bool hasLacing()
const;
177 bool isEncrypted()
const;
178 std::uint32_t colorSpace()
const;
179 const Margin &cropping()
const;
180 std::string label()
const;
181 std::string description()
const;
182 std::string shortDescription()
const;
185 bool isHeaderValid()
const;
188 AbstractTrack(std::istream &inputStream, std::ostream &outputStream, std::uint64_t startOffset);
189 AbstractTrack(std::iostream &stream, std::uint64_t startOffset);
239 std::unique_ptr<AbstractTrackPrivate>
m_p;
242 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.
virtual void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress)=0
This method is internally called to parse header information.
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
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.
std::unique_ptr< AbstractTrackPrivate > m_p
void setSize(std::uint64_t size)
Sets the size in bytes.
DisplayUnit m_displayUnit
MediaFormat format() const
Returns the format of the track if known; otherwise returns MediaFormat::Unknown.
The Diagnostics class is a container for DiagMessage.
The Margin class defines the four margins of a rectangle.
Implementation of TagParser::AbstractTrack for the MP4 container.
Implementation of TagParser::AbstractTrack MPEG audio 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.