Tag Parser 12.5.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
matroskatrack.h
Go to the documentation of this file.
1#ifndef TAG_PARSER_MATROSKATRACK_H
2#define TAG_PARSER_MATROSKATRACK_H
3
4#include "../abstracttrack.h"
5
6namespace TagParser {
7
8class EbmlElement;
10class MatroskaTrack;
11class MatroskaTag;
12
13class TAG_PARSER_EXPORT MatroskaTrackHeaderMaker {
14 friend class MatroskaTrack;
15
16public:
17 void make(std::ostream &stream) const;
18 const MatroskaTrack &track() const;
19 std::uint64_t requiredSize() const;
20
21private:
22 MatroskaTrackHeaderMaker(const MatroskaTrack &track, Diagnostics &diag);
23
24 const MatroskaTrack &m_track;
25 const std::string &m_language;
26 const std::string &m_languageIETF;
27 std::uint64_t m_dataSize;
28 std::uint64_t m_requiredSize;
29 std::uint8_t m_sizeDenotationLength;
30};
31
36{
37 return m_track;
38}
39
43inline std::uint64_t MatroskaTrackHeaderMaker::requiredSize() const
44{
45 return m_requiredSize;
46}
47
49 friend class MatroskaContainer;
51
52public:
53 MatroskaTrack(EbmlElement &trackElement);
54 ~MatroskaTrack() override;
55
56 TrackType type() const override;
57
58 static MediaFormat codecIdToMediaFormat(const std::string &codecId);
59 void readStatisticsFromTags(const std::vector<std::unique_ptr<MatroskaTag>> &tags, Diagnostics &diag);
61 void makeHeader(std::ostream &stream, Diagnostics &diag) const;
62
63protected:
64 void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress) override;
65
66private:
67 template <typename PropertyType, typename ConversionFunction>
68 void assignPropertyFromTagValue(const std::unique_ptr<MatroskaTag> &tag, std::string_view fieldId, PropertyType &integer,
69 const ConversionFunction &conversionFunction, Diagnostics &diag);
70
71 EbmlElement *m_trackElement;
72};
73
90
98inline void MatroskaTrack::makeHeader(std::ostream &stream, Diagnostics &diag) const
99{
100 prepareMakingHeader(diag).make(stream);
101}
102
103} // namespace TagParser
104
105#endif // TAG_PARSER_MATROSKATRACK_H
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
AbstractTrack(std::istream &inputStream, std::ostream &outputStream, std::uint64_t startOffset)
Constructs a new track.
The Diagnostics class is a container for DiagMessage.
The EbmlElement class helps to parse EBML files such as Matroska files.
Definition ebmlelement.h:32
Implementation of GenericContainer<MediaFileInfo, MatroskaTag, MatroskaTrack, EbmlElement>.
Implementation of TagParser::Tag for the Matroska container.
Definition matroskatag.h:72
std::uint64_t requiredSize() const
Returns the number of bytes which will be written when calling make().
const MatroskaTrack & track() const
Returns the number of bytes which will be written when making the track.
void make(std::ostream &stream) const
Saves the header for the track (specified when constructing the object) to the specified stream (make...
Implementation of TagParser::AbstractTrack for the Matroska container.
static MediaFormat codecIdToMediaFormat(const std::string &codecId)
Returns the MediaFormat for the specified Matroska codec ID.
TrackType type() const override
Returns the type of the track if known; otherwise returns TrackType::Unspecified.
MatroskaTrackHeaderMaker prepareMakingHeader(Diagnostics &diag) const
Prepares making header.
void makeHeader(std::ostream &stream, Diagnostics &diag) const
Writes header information to the specified stream (makes a "TrackEntry"-element).
void readStatisticsFromTags(const std::vector< std::unique_ptr< MatroskaTag > > &tags, Diagnostics &diag)
Reads track-specific statistics from the specified tags.
MatroskaTrack(EbmlElement &trackElement)
Constructs a new track for the specified trackElement.
void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress) override
This method is internally called to parse header information.
friend class MatroskaTrackHeaderMaker
friend class MatroskaContainer
The MediaFormat class specifies the format of media data.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
TrackType
The TrackType enum specifies the underlying file type of a track and the concrete class of the track ...