Tag Parser
9.1.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
Go to the documentation of this file. 1 #ifndef TAG_PARSER_ABSTRACTTRACK_H
2 #define TAG_PARSER_ABSTRACTTRACK_H
10 #include <c++utilities/chrono/datetime.h>
11 #include <c++utilities/chrono/timespan.h>
12 #include <c++utilities/io/binaryreader.h>
13 #include <c++utilities/io/binarywriter.h>
48 std::istream &inputStream();
49 void setInputStream(std::istream &stream);
50 std::ostream &outputStream();
51 void setOutputStream(std::ostream &stream);
52 CppUtilities::BinaryReader &reader();
53 CppUtilities::BinaryWriter &writer();
54 std::uint64_t startOffset()
const;
57 const char *formatName()
const;
58 const char *formatAbbreviation()
const;
59 const std::string &formatId()
const;
62 std::uint64_t size()
const;
65 std::uint64_t id()
const;
66 void setId(std::uint64_t
id);
67 const std::string name()
const;
68 void setName(
const std::string &name);
71 double maxBitrate()
const;
75 void setLanguage(
const std::string &
language);
76 std::uint32_t samplingFrequency()
const;
77 std::uint32_t extensionSamplingFrequency()
const;
78 std::uint16_t bitsPerSample()
const;
80 std::uint8_t channelConfig()
const;
82 std::uint8_t extensionChannelConfig()
const;
83 const char *extensionChannelConfigString()
const;
84 std::uint64_t sampleCount()
const;
86 const Size &pixelSize()
const;
87 const Size &displaySize()
const;
88 const Size &resolution()
const;
89 const std::string &compressorName()
const;
90 void setCompressorName(
const std::string &compressorName);
91 std::uint16_t depth()
const;
92 std::uint32_t
fps()
const;
93 const char *chromaFormat()
const;
95 bool isInterlaced()
const;
96 std::uint32_t timeScale()
const;
97 bool isEnabled()
const;
98 void setEnabled(
bool enabled);
99 bool isDefault()
const;
100 void setDefault(
bool isDefault);
101 bool isForced()
const;
102 void setForced(
bool forced);
103 bool hasLacing()
const;
104 bool isEncrypted()
const;
105 std::uint32_t colorSpace()
const;
106 const Margin &cropping()
const;
107 std::string
label()
const;
111 bool isHeaderValid()
const;
114 AbstractTrack(std::istream &inputStream, std::ostream &outputStream, std::uint64_t startOffset);
115 AbstractTrack(std::iostream &stream, std::uint64_t startOffset);
116 virtual void internalParseHeader(
Diagnostics &diag) = 0;
687 #endif // TAG_PARSER_ABSTRACTTRACK_H
std::uint32_t m_trackNumber
std::uint32_t samplingFrequency() const
Returns the number of samples per second if known; otherwise returns 0.
std::uint32_t m_colorSpace
std::uint32_t m_samplingFrequency
double maxBitrate() const
Returns the maximum bitrate in kbit/s if known; otherwise returns zero.
std::uint32_t colorSpace() const
Returns the color space if known; otherwise returns 0.
void setId(std::uint64_t id)
Sets the track ID.
std::uint32_t fps() const
Returns the number of frames per second if known; otherwise returns 0.
bool isEnabled() const
Returns true if the track is denoted as enabled; otherwise returns false.
const char * formatAbbreviation() const
Returns the a more or less common abbreviation for the format of the track as C-style string if known...
const char * chromaFormat() const
Returns the chroma subsampling format if known; otherwise returns nullptr.
std::uint16_t depth() const
Returns the bit depth if known; otherwise returns 0.
The Margin class defines the four margins of a rectangle.
bool hasLacing() const
Returns true if the track has lacing; otherwise returns false.
std::uint16_t channelCount() const
Returns the number of channels if known; otherwise returns 0.
const Margin & cropping() const
Returns the cropping if known; otherwise returns zero margins.
bool isInterlaced() const
Returns true if the video is denoted as interlaced; otherwise returns false.
bool isEncrypted() const
Returns true if the track is denoted as encrypted; otherwise returns false.
const char * m_chromaFormat
std::uint32_t m_timeScale
void setTrackNumber(std::uint32_t trackNumber)
Sets the track number.
The Diagnostics class is a container for DiagMessage.
const CppUtilities::DateTime & modificationTime() const
Returns the time of the last modification if known; otherwise returns a DateTime of zero ticks.
Contains all classes and functions of the TagInfo library.
void setForced(bool forced)
Sets whether the track is forced.
std::uint64_t m_sampleCount
CppUtilities::BinaryReader m_reader
bool isForced() const
Returns true if the track is denoted as forced; otherwise returns false.
std::uint16_t m_chunkSize
constexpr const TAG_PARSER_EXPORT char * language()
std::ostream & outputStream()
Returns the associated output stream.
constexpr const TAG_PARSER_EXPORT char * duration()
void setEnabled(bool enabled)
Sets whether the track is enabled.
MediaFormat format() const
Returns the format of the track if known; otherwise returns MediaFormat::Unknown.
std::uint64_t size() const
Returns the size in bytes if known; otherwise returns 0.
CppUtilities::TimeSpan m_duration
void setOutputStream(std::ostream &stream)
Assigns another output stream.
TrackType
Specifies the track type.
TAG_PARSER_EXPORT std::uint8_t channelCount(std::uint8_t config)
Returns the channel count for the specified MPEG-4 channel config.
const CppUtilities::TimeSpan & duration() const
Returns the duration if known; otherwise returns a TimeSpan of zero ticks.
bool m_usedWhenPreviewing
std::uint32_t m_extensionSamplingFrequency
void setInputStream(std::istream &stream)
Assigns another input stream.
const Size & resolution() const
Returns the resolution if known; otherwise returns a zero size.
std::istream & inputStream()
Returns the associated input stream.
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
MediaType mediaType() const
Returns the media type if known; otherwise returns MediaType::Other.
double bitrate() const
Returns the average bitrate in kbit/s if known; otherwise returns zero.
The Size class defines the size of a two-dimensional object using integer point precision.
virtual TrackType type() const
Returns the type of the track if known; otherwise returns TrackType::Unspecified.
std::uint64_t sampleCount() const
Returns the number of samples/frames if known; otherwise returns 0.
double version() const
Returns the version/level of the track if known; otherwise returns 0.
const char * formatName() const
Returns the format of the track as C-style string if known; otherwise returns the format abbreviation...
Implementation of TagParser::AbstractTrack for the MP4 container.
The AbstractTrack class parses and stores technical information about video, audio and other kinds of...
std::uint16_t m_channelCount
CppUtilities::DateTime m_modificationTime
constexpr const TAG_PARSER_EXPORT char * fps()
Implementation of TagParser::AbstractTrack for the RIFF WAVE container format.
CppUtilities::BinaryWriter m_writer
std::uint32_t m_bytesPerSecond
std::uint16_t m_bitsPerSample
int quality() const
Returns the quality if known; otherwise returns 0.
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.
bool isHeaderValid() const
Returns an indication whether the track header is valid.
const TAG_PARSER_EXPORT char * mediaTypeName(MediaType mediaType)
Returns the string representation for the specified mediaType.
std::uint64_t m_startOffset
void setDefault(bool isDefault)
Sets whether the track is a default track.
std::string m_compressorName
The AspectRatio struct defines an aspect ratio.
const std::string & language() const
Returns the language of the track if known; otherwise returns an empty string.
void setName(const std::string &name)
Sets the name.
constexpr const TAG_PARSER_EXPORT char * bitrate()
The track's bit rate in bits per second.
std::uint64_t id() const
Returns the track ID if known; otherwise returns 0.
CppUtilities::BinaryReader & reader()
Returns a binary reader for the associated stream.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
std::uint64_t startOffset() const
Returns the start offset of the track in the associated stream.
bool isDefault() const
Returns true if the track is denoted as default; otherwise returns false.
const AspectRatio & pixelAspectRatio() const
Returns the pixel aspect ratio (PAR).
std::uint8_t m_channelConfig
AspectRatio m_pixelAspectRatio
std::uint16_t bitsPerSample() const
Returns the number of bits per sample; otherwise returns 0.
bool m_usedInPresentation
const Size & displaySize() const
Returns the size of the video frames to display if known; otherwise returns a zero size.
const Size & pixelSize() const
Returns the size of the encoded video frames if known; otherwise returns a zero size.
Implementation of TagParser::AbstractTrack MPEG audio streams.
const std::string & formatId() const
Returns the format/codec ID.
std::uint32_t extensionSamplingFrequency() const
Returns the number of samples per second if known; otherwise returns 0.
std::uint32_t timeScale() const
Returns the time scale if known; otherwise returns 0.
const char * mediaTypeName() const
Returns the string representation of the media type of the track.
const TAG_PARSER_EXPORT char * channelConfigString(std::uint8_t config)
Returns the string representation for the specified MPEG-4 channel config.
std::uint8_t channelConfig() const
Returns the channel configuration.
CppUtilities::DateTime m_creationTime
const std::string name() const
Returns the track name if known; otherwise returns an empty string.
void setCompressorName(const std::string &compressorName)
Returns the compressor name if known; otherwise returns an empty string.
CppUtilities::BinaryWriter & writer()
Returns a binary writer for the associated stream.
std::uint8_t m_extensionChannelConfig
void setLanguage(const std::string &language)
Sets the language of the track.
constexpr const TAG_PARSER_EXPORT char * description()
std::uint32_t trackNumber() const
Returns the track number if known; otherwise returns 0.