Tag Parser  6.5.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 MEDIA_MATROSKATRACK_H
2 #define MEDIA_MATROSKATRACK_H
3 
4 #include "../abstracttrack.h"
5 
6 namespace Media {
7 
8 class EbmlElement;
9 class MatroskaContainer;
10 class MatroskaTrack;
11 class MatroskaTag;
12 
14 {
15  friend class MatroskaTrack;
16 
17 public:
18  void make(std::ostream &stream) const;
19  const MatroskaTrack &track() const;
20  uint64 requiredSize() const;
21 
22 private:
24 
25  const MatroskaTrack &m_track;
26  uint64 m_dataSize;
27  uint64 m_requiredSize;
28  byte m_sizeDenotationLength;
29 };
30 
35 {
36  return m_track;
37 }
38 
43 {
44  return m_requiredSize;
45 }
46 
48 {
49  friend class MatroskaContainer;
51 
52 public:
53  MatroskaTrack(EbmlElement &trackElement);
54  ~MatroskaTrack();
55 
56  TrackType type() const;
57 
58  static MediaFormat codecIdToMediaFormat(const std::string &codecId);
59  void readStatisticsFromTags(const std::vector<std::unique_ptr<MatroskaTag> > &tags);
60  MatroskaTrackHeaderMaker prepareMakingHeader() const;
61  void makeHeader(std::ostream &stream) const;
62 
63 protected:
64  void internalParseHeader();
65 
66 private:
67  template<typename PropertyType, typename ConversionFunction>
68  void assignPropertyFromTagValue(const std::unique_ptr<MatroskaTag> &tag, const char *fieldId, PropertyType &integer, const ConversionFunction &conversionFunction);
69 
70  EbmlElement *m_trackElement;
71 };
72 
87 {
88  return MatroskaTrackHeaderMaker(*this);
89 }
90 
99 inline void MatroskaTrack::makeHeader(std::ostream &stream) const
100 {
101  prepareMakingHeader().make(stream);
102 }
103 
104 }
105 
106 #endif // MEDIA_MATROSKATRACK_H
Implementation of GenericContainer<MediaFileInfo, MatroskaTag, MatroskaTrack, EbmlElement>.
The EbmlElement class helps to parse EBML files such as Matroska files.
Definition: ebmlelement.h:50
MatroskaTrackHeaderMaker prepareMakingHeader() const
Prepares making header.
Definition: matroskatrack.h:86
TrackType
Specifies the track type.
Definition: abstracttrack.h:28
The AbstractTrack class parses and stores technical information about video, audio and other kinds of...
Definition: abstracttrack.h:40
const MatroskaTrack & track() const
Returns the number of bytes which will be written when making the track.
Definition: matroskatrack.h:34
uint64 requiredSize() const
Returns the number of bytes which will be written when calling make().
Definition: matroskatrack.h:42
Implementation of Media::AbstractTrack for the Matroska container.
Definition: matroskatrack.h:47
void makeHeader(std::ostream &stream) const
Writes header information to the specified stream (makes a "TrackEntry"-element). ...
Definition: matroskatrack.h:99
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:260
The MatroskaTrackHeaderMaker class helps writing Matroska "TrackEntry"-elements storing track header ...
Definition: matroskatrack.h:13