Tag Parser 12.3.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
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
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:
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
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.
The EbmlElement class helps to parse EBML files such as Matroska files.
Implementation of GenericContainer<MediaFileInfo, MatroskaTag, MatroskaTrack, EbmlElement>.
The MatroskaTrackHeaderMaker class helps writing Matroska "TrackEntry"-elements storing track header ...
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.
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).
friend class MatroskaTrackHeaderMaker
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 ...