Tag Parser 11.3.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
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;
9class MatroskaContainer;
10class MatroskaTrack;
11class MatroskaTag;
12
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:
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);
60 MatroskaTrackHeaderMaker prepareMakingHeader(Diagnostics &diag) const;
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
87{
88 return MatroskaTrackHeaderMaker(*this, diag);
89}
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.
The AbstractTrack class parses and stores technical information about video, audio and other kinds of...
The Diagnostics class is a container for DiagMessage.
Definition: diagnostics.h:156
The EbmlElement class helps to parse EBML files such as Matroska files.
Definition: ebmlelement.h:32
Implementation of GenericContainer<MediaFileInfo, MatroskaTag, MatroskaTrack, EbmlElement>.
The MatroskaTrackHeaderMaker class helps writing Matroska "TrackEntry"-elements storing track header ...
Definition: matroskatrack.h:13
std::uint64_t requiredSize() const
Returns the number of bytes which will be written when calling make().
Definition: matroskatrack.h:43
const MatroskaTrack & track() const
Returns the number of bytes which will be written when making the track.
Definition: matroskatrack.h:35
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.
Definition: matroskatrack.h:48
MatroskaTrackHeaderMaker prepareMakingHeader(Diagnostics &diag) const
Prepares making header.
Definition: matroskatrack.h:86
void makeHeader(std::ostream &stream, Diagnostics &diag) const
Writes header information to the specified stream (makes a "TrackEntry"-element).
Definition: matroskatrack.h:98
friend class MatroskaTrackHeaderMaker
Definition: matroskatrack.h:50
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:246
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
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 ...
Definition: abstracttrack.h:31