xref: /aosp_15_r20/external/libaom/third_party/libwebm/mkvparser/mkvparser.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard Worker // Copyright (c) 2012 The WebM project authors. All Rights Reserved.
2*77c1e3ccSAndroid Build Coastguard Worker //
3*77c1e3ccSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license
4*77c1e3ccSAndroid Build Coastguard Worker // that can be found in the LICENSE file in the root of the source
5*77c1e3ccSAndroid Build Coastguard Worker // tree. An additional intellectual property rights grant can be found
6*77c1e3ccSAndroid Build Coastguard Worker // in the file PATENTS.  All contributing project authors may
7*77c1e3ccSAndroid Build Coastguard Worker // be found in the AUTHORS file in the root of the source tree.
8*77c1e3ccSAndroid Build Coastguard Worker #ifndef MKVPARSER_MKVPARSER_H_
9*77c1e3ccSAndroid Build Coastguard Worker #define MKVPARSER_MKVPARSER_H_
10*77c1e3ccSAndroid Build Coastguard Worker 
11*77c1e3ccSAndroid Build Coastguard Worker #include <cstddef>
12*77c1e3ccSAndroid Build Coastguard Worker 
13*77c1e3ccSAndroid Build Coastguard Worker namespace mkvparser {
14*77c1e3ccSAndroid Build Coastguard Worker 
15*77c1e3ccSAndroid Build Coastguard Worker const int E_PARSE_FAILED = -1;
16*77c1e3ccSAndroid Build Coastguard Worker const int E_FILE_FORMAT_INVALID = -2;
17*77c1e3ccSAndroid Build Coastguard Worker const int E_BUFFER_NOT_FULL = -3;
18*77c1e3ccSAndroid Build Coastguard Worker 
19*77c1e3ccSAndroid Build Coastguard Worker class IMkvReader {
20*77c1e3ccSAndroid Build Coastguard Worker  public:
21*77c1e3ccSAndroid Build Coastguard Worker   virtual int Read(long long pos, long len, unsigned char* buf) = 0;
22*77c1e3ccSAndroid Build Coastguard Worker   virtual int Length(long long* total, long long* available) = 0;
23*77c1e3ccSAndroid Build Coastguard Worker 
24*77c1e3ccSAndroid Build Coastguard Worker  protected:
~IMkvReader()25*77c1e3ccSAndroid Build Coastguard Worker   virtual ~IMkvReader() {}
26*77c1e3ccSAndroid Build Coastguard Worker };
27*77c1e3ccSAndroid Build Coastguard Worker 
28*77c1e3ccSAndroid Build Coastguard Worker template <typename Type>
29*77c1e3ccSAndroid Build Coastguard Worker Type* SafeArrayAlloc(unsigned long long num_elements,
30*77c1e3ccSAndroid Build Coastguard Worker                      unsigned long long element_size);
31*77c1e3ccSAndroid Build Coastguard Worker long long GetUIntLength(IMkvReader*, long long, long&);
32*77c1e3ccSAndroid Build Coastguard Worker long long ReadUInt(IMkvReader*, long long, long&);
33*77c1e3ccSAndroid Build Coastguard Worker long long ReadID(IMkvReader* pReader, long long pos, long& len);
34*77c1e3ccSAndroid Build Coastguard Worker long long UnserializeUInt(IMkvReader*, long long pos, long long size);
35*77c1e3ccSAndroid Build Coastguard Worker 
36*77c1e3ccSAndroid Build Coastguard Worker long UnserializeFloat(IMkvReader*, long long pos, long long size, double&);
37*77c1e3ccSAndroid Build Coastguard Worker long UnserializeInt(IMkvReader*, long long pos, long long size,
38*77c1e3ccSAndroid Build Coastguard Worker                     long long& result);
39*77c1e3ccSAndroid Build Coastguard Worker 
40*77c1e3ccSAndroid Build Coastguard Worker long UnserializeString(IMkvReader*, long long pos, long long size, char*& str);
41*77c1e3ccSAndroid Build Coastguard Worker 
42*77c1e3ccSAndroid Build Coastguard Worker long ParseElementHeader(IMkvReader* pReader,
43*77c1e3ccSAndroid Build Coastguard Worker                         long long& pos,  // consume id and size fields
44*77c1e3ccSAndroid Build Coastguard Worker                         long long stop,  // if you know size of element's parent
45*77c1e3ccSAndroid Build Coastguard Worker                         long long& id, long long& size);
46*77c1e3ccSAndroid Build Coastguard Worker 
47*77c1e3ccSAndroid Build Coastguard Worker bool Match(IMkvReader*, long long&, unsigned long, long long&);
48*77c1e3ccSAndroid Build Coastguard Worker bool Match(IMkvReader*, long long&, unsigned long, unsigned char*&, size_t&);
49*77c1e3ccSAndroid Build Coastguard Worker 
50*77c1e3ccSAndroid Build Coastguard Worker void GetVersion(int& major, int& minor, int& build, int& revision);
51*77c1e3ccSAndroid Build Coastguard Worker 
52*77c1e3ccSAndroid Build Coastguard Worker struct EBMLHeader {
53*77c1e3ccSAndroid Build Coastguard Worker   EBMLHeader();
54*77c1e3ccSAndroid Build Coastguard Worker   ~EBMLHeader();
55*77c1e3ccSAndroid Build Coastguard Worker   long long m_version;
56*77c1e3ccSAndroid Build Coastguard Worker   long long m_readVersion;
57*77c1e3ccSAndroid Build Coastguard Worker   long long m_maxIdLength;
58*77c1e3ccSAndroid Build Coastguard Worker   long long m_maxSizeLength;
59*77c1e3ccSAndroid Build Coastguard Worker   char* m_docType;
60*77c1e3ccSAndroid Build Coastguard Worker   long long m_docTypeVersion;
61*77c1e3ccSAndroid Build Coastguard Worker   long long m_docTypeReadVersion;
62*77c1e3ccSAndroid Build Coastguard Worker 
63*77c1e3ccSAndroid Build Coastguard Worker   long long Parse(IMkvReader*, long long&);
64*77c1e3ccSAndroid Build Coastguard Worker   void Init();
65*77c1e3ccSAndroid Build Coastguard Worker };
66*77c1e3ccSAndroid Build Coastguard Worker 
67*77c1e3ccSAndroid Build Coastguard Worker class Segment;
68*77c1e3ccSAndroid Build Coastguard Worker class Track;
69*77c1e3ccSAndroid Build Coastguard Worker class Cluster;
70*77c1e3ccSAndroid Build Coastguard Worker 
71*77c1e3ccSAndroid Build Coastguard Worker class Block {
72*77c1e3ccSAndroid Build Coastguard Worker   Block(const Block&);
73*77c1e3ccSAndroid Build Coastguard Worker   Block& operator=(const Block&);
74*77c1e3ccSAndroid Build Coastguard Worker 
75*77c1e3ccSAndroid Build Coastguard Worker  public:
76*77c1e3ccSAndroid Build Coastguard Worker   const long long m_start;
77*77c1e3ccSAndroid Build Coastguard Worker   const long long m_size;
78*77c1e3ccSAndroid Build Coastguard Worker 
79*77c1e3ccSAndroid Build Coastguard Worker   Block(long long start, long long size, long long discard_padding);
80*77c1e3ccSAndroid Build Coastguard Worker   ~Block();
81*77c1e3ccSAndroid Build Coastguard Worker 
82*77c1e3ccSAndroid Build Coastguard Worker   long Parse(const Cluster*);
83*77c1e3ccSAndroid Build Coastguard Worker 
84*77c1e3ccSAndroid Build Coastguard Worker   long long GetTrackNumber() const;
85*77c1e3ccSAndroid Build Coastguard Worker   long long GetTimeCode(const Cluster*) const;  // absolute, but not scaled
86*77c1e3ccSAndroid Build Coastguard Worker   long long GetTime(const Cluster*) const;  // absolute, and scaled (ns)
87*77c1e3ccSAndroid Build Coastguard Worker   bool IsKey() const;
88*77c1e3ccSAndroid Build Coastguard Worker   void SetKey(bool);
89*77c1e3ccSAndroid Build Coastguard Worker   bool IsInvisible() const;
90*77c1e3ccSAndroid Build Coastguard Worker 
91*77c1e3ccSAndroid Build Coastguard Worker   enum Lacing { kLacingNone, kLacingXiph, kLacingFixed, kLacingEbml };
92*77c1e3ccSAndroid Build Coastguard Worker   Lacing GetLacing() const;
93*77c1e3ccSAndroid Build Coastguard Worker 
94*77c1e3ccSAndroid Build Coastguard Worker   int GetFrameCount() const;  // to index frames: [0, count)
95*77c1e3ccSAndroid Build Coastguard Worker 
96*77c1e3ccSAndroid Build Coastguard Worker   struct Frame {
97*77c1e3ccSAndroid Build Coastguard Worker     long long pos;  // absolute offset
98*77c1e3ccSAndroid Build Coastguard Worker     long len;
99*77c1e3ccSAndroid Build Coastguard Worker 
100*77c1e3ccSAndroid Build Coastguard Worker     long Read(IMkvReader*, unsigned char*) const;
101*77c1e3ccSAndroid Build Coastguard Worker   };
102*77c1e3ccSAndroid Build Coastguard Worker 
103*77c1e3ccSAndroid Build Coastguard Worker   const Frame& GetFrame(int frame_index) const;
104*77c1e3ccSAndroid Build Coastguard Worker 
105*77c1e3ccSAndroid Build Coastguard Worker   long long GetDiscardPadding() const;
106*77c1e3ccSAndroid Build Coastguard Worker 
107*77c1e3ccSAndroid Build Coastguard Worker  private:
108*77c1e3ccSAndroid Build Coastguard Worker   long long m_track;  // Track::Number()
109*77c1e3ccSAndroid Build Coastguard Worker   short m_timecode;  // relative to cluster
110*77c1e3ccSAndroid Build Coastguard Worker   unsigned char m_flags;
111*77c1e3ccSAndroid Build Coastguard Worker 
112*77c1e3ccSAndroid Build Coastguard Worker   Frame* m_frames;
113*77c1e3ccSAndroid Build Coastguard Worker   int m_frame_count;
114*77c1e3ccSAndroid Build Coastguard Worker 
115*77c1e3ccSAndroid Build Coastguard Worker  protected:
116*77c1e3ccSAndroid Build Coastguard Worker   const long long m_discard_padding;
117*77c1e3ccSAndroid Build Coastguard Worker };
118*77c1e3ccSAndroid Build Coastguard Worker 
119*77c1e3ccSAndroid Build Coastguard Worker class BlockEntry {
120*77c1e3ccSAndroid Build Coastguard Worker   BlockEntry(const BlockEntry&);
121*77c1e3ccSAndroid Build Coastguard Worker   BlockEntry& operator=(const BlockEntry&);
122*77c1e3ccSAndroid Build Coastguard Worker 
123*77c1e3ccSAndroid Build Coastguard Worker  protected:
124*77c1e3ccSAndroid Build Coastguard Worker   BlockEntry(Cluster*, long index);
125*77c1e3ccSAndroid Build Coastguard Worker 
126*77c1e3ccSAndroid Build Coastguard Worker  public:
127*77c1e3ccSAndroid Build Coastguard Worker   virtual ~BlockEntry();
128*77c1e3ccSAndroid Build Coastguard Worker 
EOS()129*77c1e3ccSAndroid Build Coastguard Worker   bool EOS() const { return (GetKind() == kBlockEOS); }
130*77c1e3ccSAndroid Build Coastguard Worker   const Cluster* GetCluster() const;
131*77c1e3ccSAndroid Build Coastguard Worker   long GetIndex() const;
132*77c1e3ccSAndroid Build Coastguard Worker   virtual const Block* GetBlock() const = 0;
133*77c1e3ccSAndroid Build Coastguard Worker 
134*77c1e3ccSAndroid Build Coastguard Worker   enum Kind { kBlockEOS, kBlockSimple, kBlockGroup };
135*77c1e3ccSAndroid Build Coastguard Worker   virtual Kind GetKind() const = 0;
136*77c1e3ccSAndroid Build Coastguard Worker 
137*77c1e3ccSAndroid Build Coastguard Worker  protected:
138*77c1e3ccSAndroid Build Coastguard Worker   Cluster* const m_pCluster;
139*77c1e3ccSAndroid Build Coastguard Worker   const long m_index;
140*77c1e3ccSAndroid Build Coastguard Worker };
141*77c1e3ccSAndroid Build Coastguard Worker 
142*77c1e3ccSAndroid Build Coastguard Worker class SimpleBlock : public BlockEntry {
143*77c1e3ccSAndroid Build Coastguard Worker   SimpleBlock(const SimpleBlock&);
144*77c1e3ccSAndroid Build Coastguard Worker   SimpleBlock& operator=(const SimpleBlock&);
145*77c1e3ccSAndroid Build Coastguard Worker 
146*77c1e3ccSAndroid Build Coastguard Worker  public:
147*77c1e3ccSAndroid Build Coastguard Worker   SimpleBlock(Cluster*, long index, long long start, long long size);
148*77c1e3ccSAndroid Build Coastguard Worker   long Parse();
149*77c1e3ccSAndroid Build Coastguard Worker 
150*77c1e3ccSAndroid Build Coastguard Worker   Kind GetKind() const;
151*77c1e3ccSAndroid Build Coastguard Worker   const Block* GetBlock() const;
152*77c1e3ccSAndroid Build Coastguard Worker 
153*77c1e3ccSAndroid Build Coastguard Worker  protected:
154*77c1e3ccSAndroid Build Coastguard Worker   Block m_block;
155*77c1e3ccSAndroid Build Coastguard Worker };
156*77c1e3ccSAndroid Build Coastguard Worker 
157*77c1e3ccSAndroid Build Coastguard Worker class BlockGroup : public BlockEntry {
158*77c1e3ccSAndroid Build Coastguard Worker   BlockGroup(const BlockGroup&);
159*77c1e3ccSAndroid Build Coastguard Worker   BlockGroup& operator=(const BlockGroup&);
160*77c1e3ccSAndroid Build Coastguard Worker 
161*77c1e3ccSAndroid Build Coastguard Worker  public:
162*77c1e3ccSAndroid Build Coastguard Worker   BlockGroup(Cluster*, long index,
163*77c1e3ccSAndroid Build Coastguard Worker              long long block_start,  // absolute pos of block's payload
164*77c1e3ccSAndroid Build Coastguard Worker              long long block_size,  // size of block's payload
165*77c1e3ccSAndroid Build Coastguard Worker              long long prev, long long next, long long duration,
166*77c1e3ccSAndroid Build Coastguard Worker              long long discard_padding);
167*77c1e3ccSAndroid Build Coastguard Worker 
168*77c1e3ccSAndroid Build Coastguard Worker   long Parse();
169*77c1e3ccSAndroid Build Coastguard Worker 
170*77c1e3ccSAndroid Build Coastguard Worker   Kind GetKind() const;
171*77c1e3ccSAndroid Build Coastguard Worker   const Block* GetBlock() const;
172*77c1e3ccSAndroid Build Coastguard Worker 
173*77c1e3ccSAndroid Build Coastguard Worker   long long GetPrevTimeCode() const;  // relative to block's time
174*77c1e3ccSAndroid Build Coastguard Worker   long long GetNextTimeCode() const;  // as above
175*77c1e3ccSAndroid Build Coastguard Worker   long long GetDurationTimeCode() const;
176*77c1e3ccSAndroid Build Coastguard Worker 
177*77c1e3ccSAndroid Build Coastguard Worker  private:
178*77c1e3ccSAndroid Build Coastguard Worker   Block m_block;
179*77c1e3ccSAndroid Build Coastguard Worker   const long long m_prev;
180*77c1e3ccSAndroid Build Coastguard Worker   const long long m_next;
181*77c1e3ccSAndroid Build Coastguard Worker   const long long m_duration;
182*77c1e3ccSAndroid Build Coastguard Worker };
183*77c1e3ccSAndroid Build Coastguard Worker 
184*77c1e3ccSAndroid Build Coastguard Worker ///////////////////////////////////////////////////////////////
185*77c1e3ccSAndroid Build Coastguard Worker // ContentEncoding element
186*77c1e3ccSAndroid Build Coastguard Worker // Elements used to describe if the track data has been encrypted or
187*77c1e3ccSAndroid Build Coastguard Worker // compressed with zlib or header stripping.
188*77c1e3ccSAndroid Build Coastguard Worker class ContentEncoding {
189*77c1e3ccSAndroid Build Coastguard Worker  public:
190*77c1e3ccSAndroid Build Coastguard Worker   enum { kCTR = 1 };
191*77c1e3ccSAndroid Build Coastguard Worker 
192*77c1e3ccSAndroid Build Coastguard Worker   ContentEncoding();
193*77c1e3ccSAndroid Build Coastguard Worker   ~ContentEncoding();
194*77c1e3ccSAndroid Build Coastguard Worker 
195*77c1e3ccSAndroid Build Coastguard Worker   // ContentCompression element names
196*77c1e3ccSAndroid Build Coastguard Worker   struct ContentCompression {
197*77c1e3ccSAndroid Build Coastguard Worker     ContentCompression();
198*77c1e3ccSAndroid Build Coastguard Worker     ~ContentCompression();
199*77c1e3ccSAndroid Build Coastguard Worker 
200*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long algo;
201*77c1e3ccSAndroid Build Coastguard Worker     unsigned char* settings;
202*77c1e3ccSAndroid Build Coastguard Worker     long long settings_len;
203*77c1e3ccSAndroid Build Coastguard Worker   };
204*77c1e3ccSAndroid Build Coastguard Worker 
205*77c1e3ccSAndroid Build Coastguard Worker   // ContentEncAESSettings element names
206*77c1e3ccSAndroid Build Coastguard Worker   struct ContentEncAESSettings {
ContentEncAESSettingsContentEncAESSettings207*77c1e3ccSAndroid Build Coastguard Worker     ContentEncAESSettings() : cipher_mode(kCTR) {}
~ContentEncAESSettingsContentEncAESSettings208*77c1e3ccSAndroid Build Coastguard Worker     ~ContentEncAESSettings() {}
209*77c1e3ccSAndroid Build Coastguard Worker 
210*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long cipher_mode;
211*77c1e3ccSAndroid Build Coastguard Worker   };
212*77c1e3ccSAndroid Build Coastguard Worker 
213*77c1e3ccSAndroid Build Coastguard Worker   // ContentEncryption element names
214*77c1e3ccSAndroid Build Coastguard Worker   struct ContentEncryption {
215*77c1e3ccSAndroid Build Coastguard Worker     ContentEncryption();
216*77c1e3ccSAndroid Build Coastguard Worker     ~ContentEncryption();
217*77c1e3ccSAndroid Build Coastguard Worker 
218*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long algo;
219*77c1e3ccSAndroid Build Coastguard Worker     unsigned char* key_id;
220*77c1e3ccSAndroid Build Coastguard Worker     long long key_id_len;
221*77c1e3ccSAndroid Build Coastguard Worker     unsigned char* signature;
222*77c1e3ccSAndroid Build Coastguard Worker     long long signature_len;
223*77c1e3ccSAndroid Build Coastguard Worker     unsigned char* sig_key_id;
224*77c1e3ccSAndroid Build Coastguard Worker     long long sig_key_id_len;
225*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long sig_algo;
226*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long sig_hash_algo;
227*77c1e3ccSAndroid Build Coastguard Worker 
228*77c1e3ccSAndroid Build Coastguard Worker     ContentEncAESSettings aes_settings;
229*77c1e3ccSAndroid Build Coastguard Worker   };
230*77c1e3ccSAndroid Build Coastguard Worker 
231*77c1e3ccSAndroid Build Coastguard Worker   // Returns ContentCompression represented by |idx|. Returns NULL if |idx|
232*77c1e3ccSAndroid Build Coastguard Worker   // is out of bounds.
233*77c1e3ccSAndroid Build Coastguard Worker   const ContentCompression* GetCompressionByIndex(unsigned long idx) const;
234*77c1e3ccSAndroid Build Coastguard Worker 
235*77c1e3ccSAndroid Build Coastguard Worker   // Returns number of ContentCompression elements in this ContentEncoding
236*77c1e3ccSAndroid Build Coastguard Worker   // element.
237*77c1e3ccSAndroid Build Coastguard Worker   unsigned long GetCompressionCount() const;
238*77c1e3ccSAndroid Build Coastguard Worker 
239*77c1e3ccSAndroid Build Coastguard Worker   // Parses the ContentCompression element from |pReader|. |start| is the
240*77c1e3ccSAndroid Build Coastguard Worker   // starting offset of the ContentCompression payload. |size| is the size in
241*77c1e3ccSAndroid Build Coastguard Worker   // bytes of the ContentCompression payload. |compression| is where the parsed
242*77c1e3ccSAndroid Build Coastguard Worker   // values will be stored.
243*77c1e3ccSAndroid Build Coastguard Worker   long ParseCompressionEntry(long long start, long long size,
244*77c1e3ccSAndroid Build Coastguard Worker                              IMkvReader* pReader,
245*77c1e3ccSAndroid Build Coastguard Worker                              ContentCompression* compression);
246*77c1e3ccSAndroid Build Coastguard Worker 
247*77c1e3ccSAndroid Build Coastguard Worker   // Returns ContentEncryption represented by |idx|. Returns NULL if |idx|
248*77c1e3ccSAndroid Build Coastguard Worker   // is out of bounds.
249*77c1e3ccSAndroid Build Coastguard Worker   const ContentEncryption* GetEncryptionByIndex(unsigned long idx) const;
250*77c1e3ccSAndroid Build Coastguard Worker 
251*77c1e3ccSAndroid Build Coastguard Worker   // Returns number of ContentEncryption elements in this ContentEncoding
252*77c1e3ccSAndroid Build Coastguard Worker   // element.
253*77c1e3ccSAndroid Build Coastguard Worker   unsigned long GetEncryptionCount() const;
254*77c1e3ccSAndroid Build Coastguard Worker 
255*77c1e3ccSAndroid Build Coastguard Worker   // Parses the ContentEncAESSettings element from |pReader|. |start| is the
256*77c1e3ccSAndroid Build Coastguard Worker   // starting offset of the ContentEncAESSettings payload. |size| is the
257*77c1e3ccSAndroid Build Coastguard Worker   // size in bytes of the ContentEncAESSettings payload. |encryption| is
258*77c1e3ccSAndroid Build Coastguard Worker   // where the parsed values will be stored.
259*77c1e3ccSAndroid Build Coastguard Worker   long ParseContentEncAESSettingsEntry(long long start, long long size,
260*77c1e3ccSAndroid Build Coastguard Worker                                        IMkvReader* pReader,
261*77c1e3ccSAndroid Build Coastguard Worker                                        ContentEncAESSettings* aes);
262*77c1e3ccSAndroid Build Coastguard Worker 
263*77c1e3ccSAndroid Build Coastguard Worker   // Parses the ContentEncoding element from |pReader|. |start| is the
264*77c1e3ccSAndroid Build Coastguard Worker   // starting offset of the ContentEncoding payload. |size| is the size in
265*77c1e3ccSAndroid Build Coastguard Worker   // bytes of the ContentEncoding payload. Returns true on success.
266*77c1e3ccSAndroid Build Coastguard Worker   long ParseContentEncodingEntry(long long start, long long size,
267*77c1e3ccSAndroid Build Coastguard Worker                                  IMkvReader* pReader);
268*77c1e3ccSAndroid Build Coastguard Worker 
269*77c1e3ccSAndroid Build Coastguard Worker   // Parses the ContentEncryption element from |pReader|. |start| is the
270*77c1e3ccSAndroid Build Coastguard Worker   // starting offset of the ContentEncryption payload. |size| is the size in
271*77c1e3ccSAndroid Build Coastguard Worker   // bytes of the ContentEncryption payload. |encryption| is where the parsed
272*77c1e3ccSAndroid Build Coastguard Worker   // values will be stored.
273*77c1e3ccSAndroid Build Coastguard Worker   long ParseEncryptionEntry(long long start, long long size,
274*77c1e3ccSAndroid Build Coastguard Worker                             IMkvReader* pReader, ContentEncryption* encryption);
275*77c1e3ccSAndroid Build Coastguard Worker 
encoding_order()276*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long encoding_order() const { return encoding_order_; }
encoding_scope()277*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long encoding_scope() const { return encoding_scope_; }
encoding_type()278*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long encoding_type() const { return encoding_type_; }
279*77c1e3ccSAndroid Build Coastguard Worker 
280*77c1e3ccSAndroid Build Coastguard Worker  private:
281*77c1e3ccSAndroid Build Coastguard Worker   // Member variables for list of ContentCompression elements.
282*77c1e3ccSAndroid Build Coastguard Worker   ContentCompression** compression_entries_;
283*77c1e3ccSAndroid Build Coastguard Worker   ContentCompression** compression_entries_end_;
284*77c1e3ccSAndroid Build Coastguard Worker 
285*77c1e3ccSAndroid Build Coastguard Worker   // Member variables for list of ContentEncryption elements.
286*77c1e3ccSAndroid Build Coastguard Worker   ContentEncryption** encryption_entries_;
287*77c1e3ccSAndroid Build Coastguard Worker   ContentEncryption** encryption_entries_end_;
288*77c1e3ccSAndroid Build Coastguard Worker 
289*77c1e3ccSAndroid Build Coastguard Worker   // ContentEncoding element names
290*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long encoding_order_;
291*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long encoding_scope_;
292*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long encoding_type_;
293*77c1e3ccSAndroid Build Coastguard Worker 
294*77c1e3ccSAndroid Build Coastguard Worker   // LIBWEBM_DISALLOW_COPY_AND_ASSIGN(ContentEncoding);
295*77c1e3ccSAndroid Build Coastguard Worker   ContentEncoding(const ContentEncoding&);
296*77c1e3ccSAndroid Build Coastguard Worker   ContentEncoding& operator=(const ContentEncoding&);
297*77c1e3ccSAndroid Build Coastguard Worker };
298*77c1e3ccSAndroid Build Coastguard Worker 
299*77c1e3ccSAndroid Build Coastguard Worker class Track {
300*77c1e3ccSAndroid Build Coastguard Worker   Track(const Track&);
301*77c1e3ccSAndroid Build Coastguard Worker   Track& operator=(const Track&);
302*77c1e3ccSAndroid Build Coastguard Worker 
303*77c1e3ccSAndroid Build Coastguard Worker  public:
304*77c1e3ccSAndroid Build Coastguard Worker   class Info;
305*77c1e3ccSAndroid Build Coastguard Worker   static long Create(Segment*, const Info&, long long element_start,
306*77c1e3ccSAndroid Build Coastguard Worker                      long long element_size, Track*&);
307*77c1e3ccSAndroid Build Coastguard Worker 
308*77c1e3ccSAndroid Build Coastguard Worker   enum Type { kVideo = 1, kAudio = 2, kSubtitle = 0x11, kMetadata = 0x21 };
309*77c1e3ccSAndroid Build Coastguard Worker 
310*77c1e3ccSAndroid Build Coastguard Worker   Segment* const m_pSegment;
311*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_start;
312*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_size;
313*77c1e3ccSAndroid Build Coastguard Worker   virtual ~Track();
314*77c1e3ccSAndroid Build Coastguard Worker 
315*77c1e3ccSAndroid Build Coastguard Worker   long GetType() const;
316*77c1e3ccSAndroid Build Coastguard Worker   long GetNumber() const;
317*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long GetUid() const;
318*77c1e3ccSAndroid Build Coastguard Worker   const char* GetNameAsUTF8() const;
319*77c1e3ccSAndroid Build Coastguard Worker   const char* GetLanguage() const;
320*77c1e3ccSAndroid Build Coastguard Worker   const char* GetCodecNameAsUTF8() const;
321*77c1e3ccSAndroid Build Coastguard Worker   const char* GetCodecId() const;
322*77c1e3ccSAndroid Build Coastguard Worker   const unsigned char* GetCodecPrivate(size_t&) const;
323*77c1e3ccSAndroid Build Coastguard Worker   bool GetLacing() const;
324*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long GetDefaultDuration() const;
325*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long GetCodecDelay() const;
326*77c1e3ccSAndroid Build Coastguard Worker   unsigned long long GetSeekPreRoll() const;
327*77c1e3ccSAndroid Build Coastguard Worker 
328*77c1e3ccSAndroid Build Coastguard Worker   const BlockEntry* GetEOS() const;
329*77c1e3ccSAndroid Build Coastguard Worker 
330*77c1e3ccSAndroid Build Coastguard Worker   struct Settings {
331*77c1e3ccSAndroid Build Coastguard Worker     long long start;
332*77c1e3ccSAndroid Build Coastguard Worker     long long size;
333*77c1e3ccSAndroid Build Coastguard Worker   };
334*77c1e3ccSAndroid Build Coastguard Worker 
335*77c1e3ccSAndroid Build Coastguard Worker   class Info {
336*77c1e3ccSAndroid Build Coastguard Worker    public:
337*77c1e3ccSAndroid Build Coastguard Worker     Info();
338*77c1e3ccSAndroid Build Coastguard Worker     ~Info();
339*77c1e3ccSAndroid Build Coastguard Worker     int Copy(Info&) const;
340*77c1e3ccSAndroid Build Coastguard Worker     void Clear();
341*77c1e3ccSAndroid Build Coastguard Worker     long type;
342*77c1e3ccSAndroid Build Coastguard Worker     long number;
343*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long uid;
344*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long defaultDuration;
345*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long codecDelay;
346*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long seekPreRoll;
347*77c1e3ccSAndroid Build Coastguard Worker     char* nameAsUTF8;
348*77c1e3ccSAndroid Build Coastguard Worker     char* language;
349*77c1e3ccSAndroid Build Coastguard Worker     char* codecId;
350*77c1e3ccSAndroid Build Coastguard Worker     char* codecNameAsUTF8;
351*77c1e3ccSAndroid Build Coastguard Worker     unsigned char* codecPrivate;
352*77c1e3ccSAndroid Build Coastguard Worker     size_t codecPrivateSize;
353*77c1e3ccSAndroid Build Coastguard Worker     bool lacing;
354*77c1e3ccSAndroid Build Coastguard Worker     Settings settings;
355*77c1e3ccSAndroid Build Coastguard Worker 
356*77c1e3ccSAndroid Build Coastguard Worker    private:
357*77c1e3ccSAndroid Build Coastguard Worker     Info(const Info&);
358*77c1e3ccSAndroid Build Coastguard Worker     Info& operator=(const Info&);
359*77c1e3ccSAndroid Build Coastguard Worker     int CopyStr(char* Info::*str, Info&) const;
360*77c1e3ccSAndroid Build Coastguard Worker   };
361*77c1e3ccSAndroid Build Coastguard Worker 
362*77c1e3ccSAndroid Build Coastguard Worker   long GetFirst(const BlockEntry*&) const;
363*77c1e3ccSAndroid Build Coastguard Worker   long GetNext(const BlockEntry* pCurr, const BlockEntry*& pNext) const;
364*77c1e3ccSAndroid Build Coastguard Worker   virtual bool VetEntry(const BlockEntry*) const;
365*77c1e3ccSAndroid Build Coastguard Worker   virtual long Seek(long long time_ns, const BlockEntry*&) const;
366*77c1e3ccSAndroid Build Coastguard Worker 
367*77c1e3ccSAndroid Build Coastguard Worker   const ContentEncoding* GetContentEncodingByIndex(unsigned long idx) const;
368*77c1e3ccSAndroid Build Coastguard Worker   unsigned long GetContentEncodingCount() const;
369*77c1e3ccSAndroid Build Coastguard Worker 
370*77c1e3ccSAndroid Build Coastguard Worker   long ParseContentEncodingsEntry(long long start, long long size);
371*77c1e3ccSAndroid Build Coastguard Worker 
372*77c1e3ccSAndroid Build Coastguard Worker  protected:
373*77c1e3ccSAndroid Build Coastguard Worker   Track(Segment*, long long element_start, long long element_size);
374*77c1e3ccSAndroid Build Coastguard Worker 
375*77c1e3ccSAndroid Build Coastguard Worker   Info m_info;
376*77c1e3ccSAndroid Build Coastguard Worker 
377*77c1e3ccSAndroid Build Coastguard Worker   class EOSBlock : public BlockEntry {
378*77c1e3ccSAndroid Build Coastguard Worker    public:
379*77c1e3ccSAndroid Build Coastguard Worker     EOSBlock();
380*77c1e3ccSAndroid Build Coastguard Worker 
381*77c1e3ccSAndroid Build Coastguard Worker     Kind GetKind() const;
382*77c1e3ccSAndroid Build Coastguard Worker     const Block* GetBlock() const;
383*77c1e3ccSAndroid Build Coastguard Worker   };
384*77c1e3ccSAndroid Build Coastguard Worker 
385*77c1e3ccSAndroid Build Coastguard Worker   EOSBlock m_eos;
386*77c1e3ccSAndroid Build Coastguard Worker 
387*77c1e3ccSAndroid Build Coastguard Worker  private:
388*77c1e3ccSAndroid Build Coastguard Worker   ContentEncoding** content_encoding_entries_;
389*77c1e3ccSAndroid Build Coastguard Worker   ContentEncoding** content_encoding_entries_end_;
390*77c1e3ccSAndroid Build Coastguard Worker };
391*77c1e3ccSAndroid Build Coastguard Worker 
392*77c1e3ccSAndroid Build Coastguard Worker struct PrimaryChromaticity {
PrimaryChromaticityPrimaryChromaticity393*77c1e3ccSAndroid Build Coastguard Worker   PrimaryChromaticity() : x(0), y(0) {}
~PrimaryChromaticityPrimaryChromaticity394*77c1e3ccSAndroid Build Coastguard Worker   ~PrimaryChromaticity() {}
395*77c1e3ccSAndroid Build Coastguard Worker   static bool Parse(IMkvReader* reader, long long read_pos,
396*77c1e3ccSAndroid Build Coastguard Worker                     long long value_size, bool is_x,
397*77c1e3ccSAndroid Build Coastguard Worker                     PrimaryChromaticity** chromaticity);
398*77c1e3ccSAndroid Build Coastguard Worker   float x;
399*77c1e3ccSAndroid Build Coastguard Worker   float y;
400*77c1e3ccSAndroid Build Coastguard Worker };
401*77c1e3ccSAndroid Build Coastguard Worker 
402*77c1e3ccSAndroid Build Coastguard Worker struct MasteringMetadata {
403*77c1e3ccSAndroid Build Coastguard Worker   static const float kValueNotPresent;
404*77c1e3ccSAndroid Build Coastguard Worker 
MasteringMetadataMasteringMetadata405*77c1e3ccSAndroid Build Coastguard Worker   MasteringMetadata()
406*77c1e3ccSAndroid Build Coastguard Worker       : r(NULL),
407*77c1e3ccSAndroid Build Coastguard Worker         g(NULL),
408*77c1e3ccSAndroid Build Coastguard Worker         b(NULL),
409*77c1e3ccSAndroid Build Coastguard Worker         white_point(NULL),
410*77c1e3ccSAndroid Build Coastguard Worker         luminance_max(kValueNotPresent),
411*77c1e3ccSAndroid Build Coastguard Worker         luminance_min(kValueNotPresent) {}
~MasteringMetadataMasteringMetadata412*77c1e3ccSAndroid Build Coastguard Worker   ~MasteringMetadata() {
413*77c1e3ccSAndroid Build Coastguard Worker     delete r;
414*77c1e3ccSAndroid Build Coastguard Worker     delete g;
415*77c1e3ccSAndroid Build Coastguard Worker     delete b;
416*77c1e3ccSAndroid Build Coastguard Worker     delete white_point;
417*77c1e3ccSAndroid Build Coastguard Worker   }
418*77c1e3ccSAndroid Build Coastguard Worker 
419*77c1e3ccSAndroid Build Coastguard Worker   static bool Parse(IMkvReader* reader, long long element_start,
420*77c1e3ccSAndroid Build Coastguard Worker                     long long element_size,
421*77c1e3ccSAndroid Build Coastguard Worker                     MasteringMetadata** mastering_metadata);
422*77c1e3ccSAndroid Build Coastguard Worker 
423*77c1e3ccSAndroid Build Coastguard Worker   PrimaryChromaticity* r;
424*77c1e3ccSAndroid Build Coastguard Worker   PrimaryChromaticity* g;
425*77c1e3ccSAndroid Build Coastguard Worker   PrimaryChromaticity* b;
426*77c1e3ccSAndroid Build Coastguard Worker   PrimaryChromaticity* white_point;
427*77c1e3ccSAndroid Build Coastguard Worker   float luminance_max;
428*77c1e3ccSAndroid Build Coastguard Worker   float luminance_min;
429*77c1e3ccSAndroid Build Coastguard Worker };
430*77c1e3ccSAndroid Build Coastguard Worker 
431*77c1e3ccSAndroid Build Coastguard Worker struct Colour {
432*77c1e3ccSAndroid Build Coastguard Worker   static const long long kValueNotPresent;
433*77c1e3ccSAndroid Build Coastguard Worker 
434*77c1e3ccSAndroid Build Coastguard Worker   // Unless otherwise noted all values assigned upon construction are the
435*77c1e3ccSAndroid Build Coastguard Worker   // equivalent of unspecified/default.
ColourColour436*77c1e3ccSAndroid Build Coastguard Worker   Colour()
437*77c1e3ccSAndroid Build Coastguard Worker       : matrix_coefficients(kValueNotPresent),
438*77c1e3ccSAndroid Build Coastguard Worker         bits_per_channel(kValueNotPresent),
439*77c1e3ccSAndroid Build Coastguard Worker         chroma_subsampling_horz(kValueNotPresent),
440*77c1e3ccSAndroid Build Coastguard Worker         chroma_subsampling_vert(kValueNotPresent),
441*77c1e3ccSAndroid Build Coastguard Worker         cb_subsampling_horz(kValueNotPresent),
442*77c1e3ccSAndroid Build Coastguard Worker         cb_subsampling_vert(kValueNotPresent),
443*77c1e3ccSAndroid Build Coastguard Worker         chroma_siting_horz(kValueNotPresent),
444*77c1e3ccSAndroid Build Coastguard Worker         chroma_siting_vert(kValueNotPresent),
445*77c1e3ccSAndroid Build Coastguard Worker         range(kValueNotPresent),
446*77c1e3ccSAndroid Build Coastguard Worker         transfer_characteristics(kValueNotPresent),
447*77c1e3ccSAndroid Build Coastguard Worker         primaries(kValueNotPresent),
448*77c1e3ccSAndroid Build Coastguard Worker         max_cll(kValueNotPresent),
449*77c1e3ccSAndroid Build Coastguard Worker         max_fall(kValueNotPresent),
450*77c1e3ccSAndroid Build Coastguard Worker         mastering_metadata(NULL) {}
~ColourColour451*77c1e3ccSAndroid Build Coastguard Worker   ~Colour() {
452*77c1e3ccSAndroid Build Coastguard Worker     delete mastering_metadata;
453*77c1e3ccSAndroid Build Coastguard Worker     mastering_metadata = NULL;
454*77c1e3ccSAndroid Build Coastguard Worker   }
455*77c1e3ccSAndroid Build Coastguard Worker 
456*77c1e3ccSAndroid Build Coastguard Worker   static bool Parse(IMkvReader* reader, long long element_start,
457*77c1e3ccSAndroid Build Coastguard Worker                     long long element_size, Colour** colour);
458*77c1e3ccSAndroid Build Coastguard Worker 
459*77c1e3ccSAndroid Build Coastguard Worker   long long matrix_coefficients;
460*77c1e3ccSAndroid Build Coastguard Worker   long long bits_per_channel;
461*77c1e3ccSAndroid Build Coastguard Worker   long long chroma_subsampling_horz;
462*77c1e3ccSAndroid Build Coastguard Worker   long long chroma_subsampling_vert;
463*77c1e3ccSAndroid Build Coastguard Worker   long long cb_subsampling_horz;
464*77c1e3ccSAndroid Build Coastguard Worker   long long cb_subsampling_vert;
465*77c1e3ccSAndroid Build Coastguard Worker   long long chroma_siting_horz;
466*77c1e3ccSAndroid Build Coastguard Worker   long long chroma_siting_vert;
467*77c1e3ccSAndroid Build Coastguard Worker   long long range;
468*77c1e3ccSAndroid Build Coastguard Worker   long long transfer_characteristics;
469*77c1e3ccSAndroid Build Coastguard Worker   long long primaries;
470*77c1e3ccSAndroid Build Coastguard Worker   long long max_cll;
471*77c1e3ccSAndroid Build Coastguard Worker   long long max_fall;
472*77c1e3ccSAndroid Build Coastguard Worker 
473*77c1e3ccSAndroid Build Coastguard Worker   MasteringMetadata* mastering_metadata;
474*77c1e3ccSAndroid Build Coastguard Worker };
475*77c1e3ccSAndroid Build Coastguard Worker 
476*77c1e3ccSAndroid Build Coastguard Worker struct Projection {
477*77c1e3ccSAndroid Build Coastguard Worker   enum ProjectionType {
478*77c1e3ccSAndroid Build Coastguard Worker     kTypeNotPresent = -1,
479*77c1e3ccSAndroid Build Coastguard Worker     kRectangular = 0,
480*77c1e3ccSAndroid Build Coastguard Worker     kEquirectangular = 1,
481*77c1e3ccSAndroid Build Coastguard Worker     kCubeMap = 2,
482*77c1e3ccSAndroid Build Coastguard Worker     kMesh = 3,
483*77c1e3ccSAndroid Build Coastguard Worker   };
484*77c1e3ccSAndroid Build Coastguard Worker   static const float kValueNotPresent;
ProjectionProjection485*77c1e3ccSAndroid Build Coastguard Worker   Projection()
486*77c1e3ccSAndroid Build Coastguard Worker       : type(kTypeNotPresent),
487*77c1e3ccSAndroid Build Coastguard Worker         private_data(NULL),
488*77c1e3ccSAndroid Build Coastguard Worker         private_data_length(0),
489*77c1e3ccSAndroid Build Coastguard Worker         pose_yaw(kValueNotPresent),
490*77c1e3ccSAndroid Build Coastguard Worker         pose_pitch(kValueNotPresent),
491*77c1e3ccSAndroid Build Coastguard Worker         pose_roll(kValueNotPresent) {}
~ProjectionProjection492*77c1e3ccSAndroid Build Coastguard Worker   ~Projection() { delete[] private_data; }
493*77c1e3ccSAndroid Build Coastguard Worker   static bool Parse(IMkvReader* reader, long long element_start,
494*77c1e3ccSAndroid Build Coastguard Worker                     long long element_size, Projection** projection);
495*77c1e3ccSAndroid Build Coastguard Worker 
496*77c1e3ccSAndroid Build Coastguard Worker   ProjectionType type;
497*77c1e3ccSAndroid Build Coastguard Worker   unsigned char* private_data;
498*77c1e3ccSAndroid Build Coastguard Worker   size_t private_data_length;
499*77c1e3ccSAndroid Build Coastguard Worker   float pose_yaw;
500*77c1e3ccSAndroid Build Coastguard Worker   float pose_pitch;
501*77c1e3ccSAndroid Build Coastguard Worker   float pose_roll;
502*77c1e3ccSAndroid Build Coastguard Worker };
503*77c1e3ccSAndroid Build Coastguard Worker 
504*77c1e3ccSAndroid Build Coastguard Worker class VideoTrack : public Track {
505*77c1e3ccSAndroid Build Coastguard Worker   VideoTrack(const VideoTrack&);
506*77c1e3ccSAndroid Build Coastguard Worker   VideoTrack& operator=(const VideoTrack&);
507*77c1e3ccSAndroid Build Coastguard Worker 
508*77c1e3ccSAndroid Build Coastguard Worker   VideoTrack(Segment*, long long element_start, long long element_size);
509*77c1e3ccSAndroid Build Coastguard Worker 
510*77c1e3ccSAndroid Build Coastguard Worker  public:
511*77c1e3ccSAndroid Build Coastguard Worker   virtual ~VideoTrack();
512*77c1e3ccSAndroid Build Coastguard Worker   static long Parse(Segment*, const Info&, long long element_start,
513*77c1e3ccSAndroid Build Coastguard Worker                     long long element_size, VideoTrack*&);
514*77c1e3ccSAndroid Build Coastguard Worker 
515*77c1e3ccSAndroid Build Coastguard Worker   long long GetWidth() const;
516*77c1e3ccSAndroid Build Coastguard Worker   long long GetHeight() const;
517*77c1e3ccSAndroid Build Coastguard Worker   long long GetDisplayWidth() const;
518*77c1e3ccSAndroid Build Coastguard Worker   long long GetDisplayHeight() const;
519*77c1e3ccSAndroid Build Coastguard Worker   long long GetDisplayUnit() const;
520*77c1e3ccSAndroid Build Coastguard Worker   long long GetStereoMode() const;
521*77c1e3ccSAndroid Build Coastguard Worker   double GetFrameRate() const;
522*77c1e3ccSAndroid Build Coastguard Worker 
523*77c1e3ccSAndroid Build Coastguard Worker   bool VetEntry(const BlockEntry*) const;
524*77c1e3ccSAndroid Build Coastguard Worker   long Seek(long long time_ns, const BlockEntry*&) const;
525*77c1e3ccSAndroid Build Coastguard Worker 
526*77c1e3ccSAndroid Build Coastguard Worker   Colour* GetColour() const;
527*77c1e3ccSAndroid Build Coastguard Worker 
528*77c1e3ccSAndroid Build Coastguard Worker   Projection* GetProjection() const;
529*77c1e3ccSAndroid Build Coastguard Worker 
GetColourSpace()530*77c1e3ccSAndroid Build Coastguard Worker   const char* GetColourSpace() const { return m_colour_space; }
531*77c1e3ccSAndroid Build Coastguard Worker 
532*77c1e3ccSAndroid Build Coastguard Worker  private:
533*77c1e3ccSAndroid Build Coastguard Worker   long long m_width;
534*77c1e3ccSAndroid Build Coastguard Worker   long long m_height;
535*77c1e3ccSAndroid Build Coastguard Worker   long long m_display_width;
536*77c1e3ccSAndroid Build Coastguard Worker   long long m_display_height;
537*77c1e3ccSAndroid Build Coastguard Worker   long long m_display_unit;
538*77c1e3ccSAndroid Build Coastguard Worker   long long m_stereo_mode;
539*77c1e3ccSAndroid Build Coastguard Worker   char* m_colour_space;
540*77c1e3ccSAndroid Build Coastguard Worker   double m_rate;
541*77c1e3ccSAndroid Build Coastguard Worker 
542*77c1e3ccSAndroid Build Coastguard Worker   Colour* m_colour;
543*77c1e3ccSAndroid Build Coastguard Worker   Projection* m_projection;
544*77c1e3ccSAndroid Build Coastguard Worker };
545*77c1e3ccSAndroid Build Coastguard Worker 
546*77c1e3ccSAndroid Build Coastguard Worker class AudioTrack : public Track {
547*77c1e3ccSAndroid Build Coastguard Worker   AudioTrack(const AudioTrack&);
548*77c1e3ccSAndroid Build Coastguard Worker   AudioTrack& operator=(const AudioTrack&);
549*77c1e3ccSAndroid Build Coastguard Worker 
550*77c1e3ccSAndroid Build Coastguard Worker   AudioTrack(Segment*, long long element_start, long long element_size);
551*77c1e3ccSAndroid Build Coastguard Worker 
552*77c1e3ccSAndroid Build Coastguard Worker  public:
553*77c1e3ccSAndroid Build Coastguard Worker   static long Parse(Segment*, const Info&, long long element_start,
554*77c1e3ccSAndroid Build Coastguard Worker                     long long element_size, AudioTrack*&);
555*77c1e3ccSAndroid Build Coastguard Worker 
556*77c1e3ccSAndroid Build Coastguard Worker   double GetSamplingRate() const;
557*77c1e3ccSAndroid Build Coastguard Worker   long long GetChannels() const;
558*77c1e3ccSAndroid Build Coastguard Worker   long long GetBitDepth() const;
559*77c1e3ccSAndroid Build Coastguard Worker 
560*77c1e3ccSAndroid Build Coastguard Worker  private:
561*77c1e3ccSAndroid Build Coastguard Worker   double m_rate;
562*77c1e3ccSAndroid Build Coastguard Worker   long long m_channels;
563*77c1e3ccSAndroid Build Coastguard Worker   long long m_bitDepth;
564*77c1e3ccSAndroid Build Coastguard Worker };
565*77c1e3ccSAndroid Build Coastguard Worker 
566*77c1e3ccSAndroid Build Coastguard Worker class Tracks {
567*77c1e3ccSAndroid Build Coastguard Worker   Tracks(const Tracks&);
568*77c1e3ccSAndroid Build Coastguard Worker   Tracks& operator=(const Tracks&);
569*77c1e3ccSAndroid Build Coastguard Worker 
570*77c1e3ccSAndroid Build Coastguard Worker  public:
571*77c1e3ccSAndroid Build Coastguard Worker   Segment* const m_pSegment;
572*77c1e3ccSAndroid Build Coastguard Worker   const long long m_start;
573*77c1e3ccSAndroid Build Coastguard Worker   const long long m_size;
574*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_start;
575*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_size;
576*77c1e3ccSAndroid Build Coastguard Worker 
577*77c1e3ccSAndroid Build Coastguard Worker   Tracks(Segment*, long long start, long long size, long long element_start,
578*77c1e3ccSAndroid Build Coastguard Worker          long long element_size);
579*77c1e3ccSAndroid Build Coastguard Worker 
580*77c1e3ccSAndroid Build Coastguard Worker   ~Tracks();
581*77c1e3ccSAndroid Build Coastguard Worker 
582*77c1e3ccSAndroid Build Coastguard Worker   long Parse();
583*77c1e3ccSAndroid Build Coastguard Worker 
584*77c1e3ccSAndroid Build Coastguard Worker   unsigned long GetTracksCount() const;
585*77c1e3ccSAndroid Build Coastguard Worker 
586*77c1e3ccSAndroid Build Coastguard Worker   const Track* GetTrackByNumber(long tn) const;
587*77c1e3ccSAndroid Build Coastguard Worker   const Track* GetTrackByIndex(unsigned long idx) const;
588*77c1e3ccSAndroid Build Coastguard Worker 
589*77c1e3ccSAndroid Build Coastguard Worker  private:
590*77c1e3ccSAndroid Build Coastguard Worker   Track** m_trackEntries;
591*77c1e3ccSAndroid Build Coastguard Worker   Track** m_trackEntriesEnd;
592*77c1e3ccSAndroid Build Coastguard Worker 
593*77c1e3ccSAndroid Build Coastguard Worker   long ParseTrackEntry(long long payload_start, long long payload_size,
594*77c1e3ccSAndroid Build Coastguard Worker                        long long element_start, long long element_size,
595*77c1e3ccSAndroid Build Coastguard Worker                        Track*&) const;
596*77c1e3ccSAndroid Build Coastguard Worker };
597*77c1e3ccSAndroid Build Coastguard Worker 
598*77c1e3ccSAndroid Build Coastguard Worker class Chapters {
599*77c1e3ccSAndroid Build Coastguard Worker   Chapters(const Chapters&);
600*77c1e3ccSAndroid Build Coastguard Worker   Chapters& operator=(const Chapters&);
601*77c1e3ccSAndroid Build Coastguard Worker 
602*77c1e3ccSAndroid Build Coastguard Worker  public:
603*77c1e3ccSAndroid Build Coastguard Worker   Segment* const m_pSegment;
604*77c1e3ccSAndroid Build Coastguard Worker   const long long m_start;
605*77c1e3ccSAndroid Build Coastguard Worker   const long long m_size;
606*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_start;
607*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_size;
608*77c1e3ccSAndroid Build Coastguard Worker 
609*77c1e3ccSAndroid Build Coastguard Worker   Chapters(Segment*, long long payload_start, long long payload_size,
610*77c1e3ccSAndroid Build Coastguard Worker            long long element_start, long long element_size);
611*77c1e3ccSAndroid Build Coastguard Worker 
612*77c1e3ccSAndroid Build Coastguard Worker   ~Chapters();
613*77c1e3ccSAndroid Build Coastguard Worker 
614*77c1e3ccSAndroid Build Coastguard Worker   long Parse();
615*77c1e3ccSAndroid Build Coastguard Worker 
616*77c1e3ccSAndroid Build Coastguard Worker   class Atom;
617*77c1e3ccSAndroid Build Coastguard Worker   class Edition;
618*77c1e3ccSAndroid Build Coastguard Worker 
619*77c1e3ccSAndroid Build Coastguard Worker   class Display {
620*77c1e3ccSAndroid Build Coastguard Worker     friend class Atom;
621*77c1e3ccSAndroid Build Coastguard Worker     Display();
622*77c1e3ccSAndroid Build Coastguard Worker     Display(const Display&);
623*77c1e3ccSAndroid Build Coastguard Worker     ~Display();
624*77c1e3ccSAndroid Build Coastguard Worker     Display& operator=(const Display&);
625*77c1e3ccSAndroid Build Coastguard Worker 
626*77c1e3ccSAndroid Build Coastguard Worker    public:
627*77c1e3ccSAndroid Build Coastguard Worker     const char* GetString() const;
628*77c1e3ccSAndroid Build Coastguard Worker     const char* GetLanguage() const;
629*77c1e3ccSAndroid Build Coastguard Worker     const char* GetCountry() const;
630*77c1e3ccSAndroid Build Coastguard Worker 
631*77c1e3ccSAndroid Build Coastguard Worker    private:
632*77c1e3ccSAndroid Build Coastguard Worker     void Init();
633*77c1e3ccSAndroid Build Coastguard Worker     void ShallowCopy(Display&) const;
634*77c1e3ccSAndroid Build Coastguard Worker     void Clear();
635*77c1e3ccSAndroid Build Coastguard Worker     long Parse(IMkvReader*, long long pos, long long size);
636*77c1e3ccSAndroid Build Coastguard Worker 
637*77c1e3ccSAndroid Build Coastguard Worker     char* m_string;
638*77c1e3ccSAndroid Build Coastguard Worker     char* m_language;
639*77c1e3ccSAndroid Build Coastguard Worker     char* m_country;
640*77c1e3ccSAndroid Build Coastguard Worker   };
641*77c1e3ccSAndroid Build Coastguard Worker 
642*77c1e3ccSAndroid Build Coastguard Worker   class Atom {
643*77c1e3ccSAndroid Build Coastguard Worker     friend class Edition;
644*77c1e3ccSAndroid Build Coastguard Worker     Atom();
645*77c1e3ccSAndroid Build Coastguard Worker     Atom(const Atom&);
646*77c1e3ccSAndroid Build Coastguard Worker     ~Atom();
647*77c1e3ccSAndroid Build Coastguard Worker     Atom& operator=(const Atom&);
648*77c1e3ccSAndroid Build Coastguard Worker 
649*77c1e3ccSAndroid Build Coastguard Worker    public:
650*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long GetUID() const;
651*77c1e3ccSAndroid Build Coastguard Worker     const char* GetStringUID() const;
652*77c1e3ccSAndroid Build Coastguard Worker 
653*77c1e3ccSAndroid Build Coastguard Worker     long long GetStartTimecode() const;
654*77c1e3ccSAndroid Build Coastguard Worker     long long GetStopTimecode() const;
655*77c1e3ccSAndroid Build Coastguard Worker 
656*77c1e3ccSAndroid Build Coastguard Worker     long long GetStartTime(const Chapters*) const;
657*77c1e3ccSAndroid Build Coastguard Worker     long long GetStopTime(const Chapters*) const;
658*77c1e3ccSAndroid Build Coastguard Worker 
659*77c1e3ccSAndroid Build Coastguard Worker     int GetDisplayCount() const;
660*77c1e3ccSAndroid Build Coastguard Worker     const Display* GetDisplay(int index) const;
661*77c1e3ccSAndroid Build Coastguard Worker 
662*77c1e3ccSAndroid Build Coastguard Worker    private:
663*77c1e3ccSAndroid Build Coastguard Worker     void Init();
664*77c1e3ccSAndroid Build Coastguard Worker     void ShallowCopy(Atom&) const;
665*77c1e3ccSAndroid Build Coastguard Worker     void Clear();
666*77c1e3ccSAndroid Build Coastguard Worker     long Parse(IMkvReader*, long long pos, long long size);
667*77c1e3ccSAndroid Build Coastguard Worker     static long long GetTime(const Chapters*, long long timecode);
668*77c1e3ccSAndroid Build Coastguard Worker 
669*77c1e3ccSAndroid Build Coastguard Worker     long ParseDisplay(IMkvReader*, long long pos, long long size);
670*77c1e3ccSAndroid Build Coastguard Worker     bool ExpandDisplaysArray();
671*77c1e3ccSAndroid Build Coastguard Worker 
672*77c1e3ccSAndroid Build Coastguard Worker     char* m_string_uid;
673*77c1e3ccSAndroid Build Coastguard Worker     unsigned long long m_uid;
674*77c1e3ccSAndroid Build Coastguard Worker     long long m_start_timecode;
675*77c1e3ccSAndroid Build Coastguard Worker     long long m_stop_timecode;
676*77c1e3ccSAndroid Build Coastguard Worker 
677*77c1e3ccSAndroid Build Coastguard Worker     Display* m_displays;
678*77c1e3ccSAndroid Build Coastguard Worker     int m_displays_size;
679*77c1e3ccSAndroid Build Coastguard Worker     int m_displays_count;
680*77c1e3ccSAndroid Build Coastguard Worker   };
681*77c1e3ccSAndroid Build Coastguard Worker 
682*77c1e3ccSAndroid Build Coastguard Worker   class Edition {
683*77c1e3ccSAndroid Build Coastguard Worker     friend class Chapters;
684*77c1e3ccSAndroid Build Coastguard Worker     Edition();
685*77c1e3ccSAndroid Build Coastguard Worker     Edition(const Edition&);
686*77c1e3ccSAndroid Build Coastguard Worker     ~Edition();
687*77c1e3ccSAndroid Build Coastguard Worker     Edition& operator=(const Edition&);
688*77c1e3ccSAndroid Build Coastguard Worker 
689*77c1e3ccSAndroid Build Coastguard Worker    public:
690*77c1e3ccSAndroid Build Coastguard Worker     int GetAtomCount() const;
691*77c1e3ccSAndroid Build Coastguard Worker     const Atom* GetAtom(int index) const;
692*77c1e3ccSAndroid Build Coastguard Worker 
693*77c1e3ccSAndroid Build Coastguard Worker    private:
694*77c1e3ccSAndroid Build Coastguard Worker     void Init();
695*77c1e3ccSAndroid Build Coastguard Worker     void ShallowCopy(Edition&) const;
696*77c1e3ccSAndroid Build Coastguard Worker     void Clear();
697*77c1e3ccSAndroid Build Coastguard Worker     long Parse(IMkvReader*, long long pos, long long size);
698*77c1e3ccSAndroid Build Coastguard Worker 
699*77c1e3ccSAndroid Build Coastguard Worker     long ParseAtom(IMkvReader*, long long pos, long long size);
700*77c1e3ccSAndroid Build Coastguard Worker     bool ExpandAtomsArray();
701*77c1e3ccSAndroid Build Coastguard Worker 
702*77c1e3ccSAndroid Build Coastguard Worker     Atom* m_atoms;
703*77c1e3ccSAndroid Build Coastguard Worker     int m_atoms_size;
704*77c1e3ccSAndroid Build Coastguard Worker     int m_atoms_count;
705*77c1e3ccSAndroid Build Coastguard Worker   };
706*77c1e3ccSAndroid Build Coastguard Worker 
707*77c1e3ccSAndroid Build Coastguard Worker   int GetEditionCount() const;
708*77c1e3ccSAndroid Build Coastguard Worker   const Edition* GetEdition(int index) const;
709*77c1e3ccSAndroid Build Coastguard Worker 
710*77c1e3ccSAndroid Build Coastguard Worker  private:
711*77c1e3ccSAndroid Build Coastguard Worker   long ParseEdition(long long pos, long long size);
712*77c1e3ccSAndroid Build Coastguard Worker   bool ExpandEditionsArray();
713*77c1e3ccSAndroid Build Coastguard Worker 
714*77c1e3ccSAndroid Build Coastguard Worker   Edition* m_editions;
715*77c1e3ccSAndroid Build Coastguard Worker   int m_editions_size;
716*77c1e3ccSAndroid Build Coastguard Worker   int m_editions_count;
717*77c1e3ccSAndroid Build Coastguard Worker };
718*77c1e3ccSAndroid Build Coastguard Worker 
719*77c1e3ccSAndroid Build Coastguard Worker class Tags {
720*77c1e3ccSAndroid Build Coastguard Worker   Tags(const Tags&);
721*77c1e3ccSAndroid Build Coastguard Worker   Tags& operator=(const Tags&);
722*77c1e3ccSAndroid Build Coastguard Worker 
723*77c1e3ccSAndroid Build Coastguard Worker  public:
724*77c1e3ccSAndroid Build Coastguard Worker   Segment* const m_pSegment;
725*77c1e3ccSAndroid Build Coastguard Worker   const long long m_start;
726*77c1e3ccSAndroid Build Coastguard Worker   const long long m_size;
727*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_start;
728*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_size;
729*77c1e3ccSAndroid Build Coastguard Worker 
730*77c1e3ccSAndroid Build Coastguard Worker   Tags(Segment*, long long payload_start, long long payload_size,
731*77c1e3ccSAndroid Build Coastguard Worker        long long element_start, long long element_size);
732*77c1e3ccSAndroid Build Coastguard Worker 
733*77c1e3ccSAndroid Build Coastguard Worker   ~Tags();
734*77c1e3ccSAndroid Build Coastguard Worker 
735*77c1e3ccSAndroid Build Coastguard Worker   long Parse();
736*77c1e3ccSAndroid Build Coastguard Worker 
737*77c1e3ccSAndroid Build Coastguard Worker   class Tag;
738*77c1e3ccSAndroid Build Coastguard Worker   class SimpleTag;
739*77c1e3ccSAndroid Build Coastguard Worker 
740*77c1e3ccSAndroid Build Coastguard Worker   class SimpleTag {
741*77c1e3ccSAndroid Build Coastguard Worker     friend class Tag;
742*77c1e3ccSAndroid Build Coastguard Worker     SimpleTag();
743*77c1e3ccSAndroid Build Coastguard Worker     SimpleTag(const SimpleTag&);
744*77c1e3ccSAndroid Build Coastguard Worker     ~SimpleTag();
745*77c1e3ccSAndroid Build Coastguard Worker     SimpleTag& operator=(const SimpleTag&);
746*77c1e3ccSAndroid Build Coastguard Worker 
747*77c1e3ccSAndroid Build Coastguard Worker    public:
748*77c1e3ccSAndroid Build Coastguard Worker     const char* GetTagName() const;
749*77c1e3ccSAndroid Build Coastguard Worker     const char* GetTagString() const;
750*77c1e3ccSAndroid Build Coastguard Worker 
751*77c1e3ccSAndroid Build Coastguard Worker    private:
752*77c1e3ccSAndroid Build Coastguard Worker     void Init();
753*77c1e3ccSAndroid Build Coastguard Worker     void ShallowCopy(SimpleTag&) const;
754*77c1e3ccSAndroid Build Coastguard Worker     void Clear();
755*77c1e3ccSAndroid Build Coastguard Worker     long Parse(IMkvReader*, long long pos, long long size);
756*77c1e3ccSAndroid Build Coastguard Worker 
757*77c1e3ccSAndroid Build Coastguard Worker     char* m_tag_name;
758*77c1e3ccSAndroid Build Coastguard Worker     char* m_tag_string;
759*77c1e3ccSAndroid Build Coastguard Worker   };
760*77c1e3ccSAndroid Build Coastguard Worker 
761*77c1e3ccSAndroid Build Coastguard Worker   class Tag {
762*77c1e3ccSAndroid Build Coastguard Worker     friend class Tags;
763*77c1e3ccSAndroid Build Coastguard Worker     Tag();
764*77c1e3ccSAndroid Build Coastguard Worker     Tag(const Tag&);
765*77c1e3ccSAndroid Build Coastguard Worker     ~Tag();
766*77c1e3ccSAndroid Build Coastguard Worker     Tag& operator=(const Tag&);
767*77c1e3ccSAndroid Build Coastguard Worker 
768*77c1e3ccSAndroid Build Coastguard Worker    public:
769*77c1e3ccSAndroid Build Coastguard Worker     int GetSimpleTagCount() const;
770*77c1e3ccSAndroid Build Coastguard Worker     const SimpleTag* GetSimpleTag(int index) const;
771*77c1e3ccSAndroid Build Coastguard Worker 
772*77c1e3ccSAndroid Build Coastguard Worker    private:
773*77c1e3ccSAndroid Build Coastguard Worker     void Init();
774*77c1e3ccSAndroid Build Coastguard Worker     void ShallowCopy(Tag&) const;
775*77c1e3ccSAndroid Build Coastguard Worker     void Clear();
776*77c1e3ccSAndroid Build Coastguard Worker     long Parse(IMkvReader*, long long pos, long long size);
777*77c1e3ccSAndroid Build Coastguard Worker 
778*77c1e3ccSAndroid Build Coastguard Worker     long ParseSimpleTag(IMkvReader*, long long pos, long long size);
779*77c1e3ccSAndroid Build Coastguard Worker     bool ExpandSimpleTagsArray();
780*77c1e3ccSAndroid Build Coastguard Worker 
781*77c1e3ccSAndroid Build Coastguard Worker     SimpleTag* m_simple_tags;
782*77c1e3ccSAndroid Build Coastguard Worker     int m_simple_tags_size;
783*77c1e3ccSAndroid Build Coastguard Worker     int m_simple_tags_count;
784*77c1e3ccSAndroid Build Coastguard Worker   };
785*77c1e3ccSAndroid Build Coastguard Worker 
786*77c1e3ccSAndroid Build Coastguard Worker   int GetTagCount() const;
787*77c1e3ccSAndroid Build Coastguard Worker   const Tag* GetTag(int index) const;
788*77c1e3ccSAndroid Build Coastguard Worker 
789*77c1e3ccSAndroid Build Coastguard Worker  private:
790*77c1e3ccSAndroid Build Coastguard Worker   long ParseTag(long long pos, long long size);
791*77c1e3ccSAndroid Build Coastguard Worker   bool ExpandTagsArray();
792*77c1e3ccSAndroid Build Coastguard Worker 
793*77c1e3ccSAndroid Build Coastguard Worker   Tag* m_tags;
794*77c1e3ccSAndroid Build Coastguard Worker   int m_tags_size;
795*77c1e3ccSAndroid Build Coastguard Worker   int m_tags_count;
796*77c1e3ccSAndroid Build Coastguard Worker };
797*77c1e3ccSAndroid Build Coastguard Worker 
798*77c1e3ccSAndroid Build Coastguard Worker class SegmentInfo {
799*77c1e3ccSAndroid Build Coastguard Worker   SegmentInfo(const SegmentInfo&);
800*77c1e3ccSAndroid Build Coastguard Worker   SegmentInfo& operator=(const SegmentInfo&);
801*77c1e3ccSAndroid Build Coastguard Worker 
802*77c1e3ccSAndroid Build Coastguard Worker  public:
803*77c1e3ccSAndroid Build Coastguard Worker   Segment* const m_pSegment;
804*77c1e3ccSAndroid Build Coastguard Worker   const long long m_start;
805*77c1e3ccSAndroid Build Coastguard Worker   const long long m_size;
806*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_start;
807*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_size;
808*77c1e3ccSAndroid Build Coastguard Worker 
809*77c1e3ccSAndroid Build Coastguard Worker   SegmentInfo(Segment*, long long start, long long size,
810*77c1e3ccSAndroid Build Coastguard Worker               long long element_start, long long element_size);
811*77c1e3ccSAndroid Build Coastguard Worker 
812*77c1e3ccSAndroid Build Coastguard Worker   ~SegmentInfo();
813*77c1e3ccSAndroid Build Coastguard Worker 
814*77c1e3ccSAndroid Build Coastguard Worker   long Parse();
815*77c1e3ccSAndroid Build Coastguard Worker 
816*77c1e3ccSAndroid Build Coastguard Worker   long long GetTimeCodeScale() const;
817*77c1e3ccSAndroid Build Coastguard Worker   long long GetDuration() const;  // scaled
818*77c1e3ccSAndroid Build Coastguard Worker   const char* GetMuxingAppAsUTF8() const;
819*77c1e3ccSAndroid Build Coastguard Worker   const char* GetWritingAppAsUTF8() const;
820*77c1e3ccSAndroid Build Coastguard Worker   const char* GetTitleAsUTF8() const;
821*77c1e3ccSAndroid Build Coastguard Worker 
822*77c1e3ccSAndroid Build Coastguard Worker  private:
823*77c1e3ccSAndroid Build Coastguard Worker   long long m_timecodeScale;
824*77c1e3ccSAndroid Build Coastguard Worker   double m_duration;
825*77c1e3ccSAndroid Build Coastguard Worker   char* m_pMuxingAppAsUTF8;
826*77c1e3ccSAndroid Build Coastguard Worker   char* m_pWritingAppAsUTF8;
827*77c1e3ccSAndroid Build Coastguard Worker   char* m_pTitleAsUTF8;
828*77c1e3ccSAndroid Build Coastguard Worker };
829*77c1e3ccSAndroid Build Coastguard Worker 
830*77c1e3ccSAndroid Build Coastguard Worker class SeekHead {
831*77c1e3ccSAndroid Build Coastguard Worker   SeekHead(const SeekHead&);
832*77c1e3ccSAndroid Build Coastguard Worker   SeekHead& operator=(const SeekHead&);
833*77c1e3ccSAndroid Build Coastguard Worker 
834*77c1e3ccSAndroid Build Coastguard Worker  public:
835*77c1e3ccSAndroid Build Coastguard Worker   Segment* const m_pSegment;
836*77c1e3ccSAndroid Build Coastguard Worker   const long long m_start;
837*77c1e3ccSAndroid Build Coastguard Worker   const long long m_size;
838*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_start;
839*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_size;
840*77c1e3ccSAndroid Build Coastguard Worker 
841*77c1e3ccSAndroid Build Coastguard Worker   SeekHead(Segment*, long long start, long long size, long long element_start,
842*77c1e3ccSAndroid Build Coastguard Worker            long long element_size);
843*77c1e3ccSAndroid Build Coastguard Worker 
844*77c1e3ccSAndroid Build Coastguard Worker   ~SeekHead();
845*77c1e3ccSAndroid Build Coastguard Worker 
846*77c1e3ccSAndroid Build Coastguard Worker   long Parse();
847*77c1e3ccSAndroid Build Coastguard Worker 
848*77c1e3ccSAndroid Build Coastguard Worker   struct Entry {
849*77c1e3ccSAndroid Build Coastguard Worker     Entry();
850*77c1e3ccSAndroid Build Coastguard Worker 
851*77c1e3ccSAndroid Build Coastguard Worker     // the SeekHead entry payload
852*77c1e3ccSAndroid Build Coastguard Worker     long long id;
853*77c1e3ccSAndroid Build Coastguard Worker     long long pos;
854*77c1e3ccSAndroid Build Coastguard Worker 
855*77c1e3ccSAndroid Build Coastguard Worker     // absolute pos of SeekEntry ID
856*77c1e3ccSAndroid Build Coastguard Worker     long long element_start;
857*77c1e3ccSAndroid Build Coastguard Worker 
858*77c1e3ccSAndroid Build Coastguard Worker     // SeekEntry ID size + size size + payload
859*77c1e3ccSAndroid Build Coastguard Worker     long long element_size;
860*77c1e3ccSAndroid Build Coastguard Worker   };
861*77c1e3ccSAndroid Build Coastguard Worker 
862*77c1e3ccSAndroid Build Coastguard Worker   int GetCount() const;
863*77c1e3ccSAndroid Build Coastguard Worker   const Entry* GetEntry(int idx) const;
864*77c1e3ccSAndroid Build Coastguard Worker 
865*77c1e3ccSAndroid Build Coastguard Worker   struct VoidElement {
866*77c1e3ccSAndroid Build Coastguard Worker     // absolute pos of Void ID
867*77c1e3ccSAndroid Build Coastguard Worker     long long element_start;
868*77c1e3ccSAndroid Build Coastguard Worker 
869*77c1e3ccSAndroid Build Coastguard Worker     // ID size + size size + payload size
870*77c1e3ccSAndroid Build Coastguard Worker     long long element_size;
871*77c1e3ccSAndroid Build Coastguard Worker   };
872*77c1e3ccSAndroid Build Coastguard Worker 
873*77c1e3ccSAndroid Build Coastguard Worker   int GetVoidElementCount() const;
874*77c1e3ccSAndroid Build Coastguard Worker   const VoidElement* GetVoidElement(int idx) const;
875*77c1e3ccSAndroid Build Coastguard Worker 
876*77c1e3ccSAndroid Build Coastguard Worker  private:
877*77c1e3ccSAndroid Build Coastguard Worker   Entry* m_entries;
878*77c1e3ccSAndroid Build Coastguard Worker   int m_entry_count;
879*77c1e3ccSAndroid Build Coastguard Worker 
880*77c1e3ccSAndroid Build Coastguard Worker   VoidElement* m_void_elements;
881*77c1e3ccSAndroid Build Coastguard Worker   int m_void_element_count;
882*77c1e3ccSAndroid Build Coastguard Worker 
883*77c1e3ccSAndroid Build Coastguard Worker   static bool ParseEntry(IMkvReader*,
884*77c1e3ccSAndroid Build Coastguard Worker                          long long pos,  // payload
885*77c1e3ccSAndroid Build Coastguard Worker                          long long size, Entry*);
886*77c1e3ccSAndroid Build Coastguard Worker };
887*77c1e3ccSAndroid Build Coastguard Worker 
888*77c1e3ccSAndroid Build Coastguard Worker class Cues;
889*77c1e3ccSAndroid Build Coastguard Worker class CuePoint {
890*77c1e3ccSAndroid Build Coastguard Worker   friend class Cues;
891*77c1e3ccSAndroid Build Coastguard Worker 
892*77c1e3ccSAndroid Build Coastguard Worker   CuePoint(long, long long);
893*77c1e3ccSAndroid Build Coastguard Worker   ~CuePoint();
894*77c1e3ccSAndroid Build Coastguard Worker 
895*77c1e3ccSAndroid Build Coastguard Worker   CuePoint(const CuePoint&);
896*77c1e3ccSAndroid Build Coastguard Worker   CuePoint& operator=(const CuePoint&);
897*77c1e3ccSAndroid Build Coastguard Worker 
898*77c1e3ccSAndroid Build Coastguard Worker  public:
899*77c1e3ccSAndroid Build Coastguard Worker   long long m_element_start;
900*77c1e3ccSAndroid Build Coastguard Worker   long long m_element_size;
901*77c1e3ccSAndroid Build Coastguard Worker 
902*77c1e3ccSAndroid Build Coastguard Worker   bool Load(IMkvReader*);
903*77c1e3ccSAndroid Build Coastguard Worker 
904*77c1e3ccSAndroid Build Coastguard Worker   long long GetTimeCode() const;  // absolute but unscaled
905*77c1e3ccSAndroid Build Coastguard Worker   long long GetTime(const Segment*) const;  // absolute and scaled (ns units)
906*77c1e3ccSAndroid Build Coastguard Worker 
907*77c1e3ccSAndroid Build Coastguard Worker   struct TrackPosition {
908*77c1e3ccSAndroid Build Coastguard Worker     long long m_track;
909*77c1e3ccSAndroid Build Coastguard Worker     long long m_pos;  // of cluster
910*77c1e3ccSAndroid Build Coastguard Worker     long long m_block;
911*77c1e3ccSAndroid Build Coastguard Worker     // codec_state  //defaults to 0
912*77c1e3ccSAndroid Build Coastguard Worker     // reference = clusters containing req'd referenced blocks
913*77c1e3ccSAndroid Build Coastguard Worker     //  reftime = timecode of the referenced block
914*77c1e3ccSAndroid Build Coastguard Worker 
915*77c1e3ccSAndroid Build Coastguard Worker     bool Parse(IMkvReader*, long long, long long);
916*77c1e3ccSAndroid Build Coastguard Worker   };
917*77c1e3ccSAndroid Build Coastguard Worker 
918*77c1e3ccSAndroid Build Coastguard Worker   const TrackPosition* Find(const Track*) const;
919*77c1e3ccSAndroid Build Coastguard Worker 
920*77c1e3ccSAndroid Build Coastguard Worker  private:
921*77c1e3ccSAndroid Build Coastguard Worker   const long m_index;
922*77c1e3ccSAndroid Build Coastguard Worker   long long m_timecode;
923*77c1e3ccSAndroid Build Coastguard Worker   TrackPosition* m_track_positions;
924*77c1e3ccSAndroid Build Coastguard Worker   size_t m_track_positions_count;
925*77c1e3ccSAndroid Build Coastguard Worker };
926*77c1e3ccSAndroid Build Coastguard Worker 
927*77c1e3ccSAndroid Build Coastguard Worker class Cues {
928*77c1e3ccSAndroid Build Coastguard Worker   friend class Segment;
929*77c1e3ccSAndroid Build Coastguard Worker 
930*77c1e3ccSAndroid Build Coastguard Worker   Cues(Segment*, long long start, long long size, long long element_start,
931*77c1e3ccSAndroid Build Coastguard Worker        long long element_size);
932*77c1e3ccSAndroid Build Coastguard Worker   ~Cues();
933*77c1e3ccSAndroid Build Coastguard Worker 
934*77c1e3ccSAndroid Build Coastguard Worker   Cues(const Cues&);
935*77c1e3ccSAndroid Build Coastguard Worker   Cues& operator=(const Cues&);
936*77c1e3ccSAndroid Build Coastguard Worker 
937*77c1e3ccSAndroid Build Coastguard Worker  public:
938*77c1e3ccSAndroid Build Coastguard Worker   Segment* const m_pSegment;
939*77c1e3ccSAndroid Build Coastguard Worker   const long long m_start;
940*77c1e3ccSAndroid Build Coastguard Worker   const long long m_size;
941*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_start;
942*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_size;
943*77c1e3ccSAndroid Build Coastguard Worker 
944*77c1e3ccSAndroid Build Coastguard Worker   bool Find(  // lower bound of time_ns
945*77c1e3ccSAndroid Build Coastguard Worker       long long time_ns, const Track*, const CuePoint*&,
946*77c1e3ccSAndroid Build Coastguard Worker       const CuePoint::TrackPosition*&) const;
947*77c1e3ccSAndroid Build Coastguard Worker 
948*77c1e3ccSAndroid Build Coastguard Worker   const CuePoint* GetFirst() const;
949*77c1e3ccSAndroid Build Coastguard Worker   const CuePoint* GetLast() const;
950*77c1e3ccSAndroid Build Coastguard Worker   const CuePoint* GetNext(const CuePoint*) const;
951*77c1e3ccSAndroid Build Coastguard Worker 
952*77c1e3ccSAndroid Build Coastguard Worker   const BlockEntry* GetBlock(const CuePoint*,
953*77c1e3ccSAndroid Build Coastguard Worker                              const CuePoint::TrackPosition*) const;
954*77c1e3ccSAndroid Build Coastguard Worker 
955*77c1e3ccSAndroid Build Coastguard Worker   bool LoadCuePoint() const;
956*77c1e3ccSAndroid Build Coastguard Worker   long GetCount() const;  // loaded only
957*77c1e3ccSAndroid Build Coastguard Worker   // long GetTotal() const;  //loaded + preloaded
958*77c1e3ccSAndroid Build Coastguard Worker   bool DoneParsing() const;
959*77c1e3ccSAndroid Build Coastguard Worker 
960*77c1e3ccSAndroid Build Coastguard Worker  private:
961*77c1e3ccSAndroid Build Coastguard Worker   bool Init() const;
962*77c1e3ccSAndroid Build Coastguard Worker   bool PreloadCuePoint(long&, long long) const;
963*77c1e3ccSAndroid Build Coastguard Worker 
964*77c1e3ccSAndroid Build Coastguard Worker   mutable CuePoint** m_cue_points;
965*77c1e3ccSAndroid Build Coastguard Worker   mutable long m_count;
966*77c1e3ccSAndroid Build Coastguard Worker   mutable long m_preload_count;
967*77c1e3ccSAndroid Build Coastguard Worker   mutable long long m_pos;
968*77c1e3ccSAndroid Build Coastguard Worker };
969*77c1e3ccSAndroid Build Coastguard Worker 
970*77c1e3ccSAndroid Build Coastguard Worker class Cluster {
971*77c1e3ccSAndroid Build Coastguard Worker   friend class Segment;
972*77c1e3ccSAndroid Build Coastguard Worker 
973*77c1e3ccSAndroid Build Coastguard Worker   Cluster(const Cluster&);
974*77c1e3ccSAndroid Build Coastguard Worker   Cluster& operator=(const Cluster&);
975*77c1e3ccSAndroid Build Coastguard Worker 
976*77c1e3ccSAndroid Build Coastguard Worker  public:
977*77c1e3ccSAndroid Build Coastguard Worker   Segment* const m_pSegment;
978*77c1e3ccSAndroid Build Coastguard Worker 
979*77c1e3ccSAndroid Build Coastguard Worker  public:
980*77c1e3ccSAndroid Build Coastguard Worker   static Cluster* Create(Segment*,
981*77c1e3ccSAndroid Build Coastguard Worker                          long index,  // index in segment
982*77c1e3ccSAndroid Build Coastguard Worker                          long long off);  // offset relative to segment
983*77c1e3ccSAndroid Build Coastguard Worker   // long long element_size);
984*77c1e3ccSAndroid Build Coastguard Worker 
985*77c1e3ccSAndroid Build Coastguard Worker   Cluster();  // EndOfStream
986*77c1e3ccSAndroid Build Coastguard Worker   ~Cluster();
987*77c1e3ccSAndroid Build Coastguard Worker 
988*77c1e3ccSAndroid Build Coastguard Worker   bool EOS() const;
989*77c1e3ccSAndroid Build Coastguard Worker 
990*77c1e3ccSAndroid Build Coastguard Worker   long long GetTimeCode() const;  // absolute, but not scaled
991*77c1e3ccSAndroid Build Coastguard Worker   long long GetTime() const;  // absolute, and scaled (nanosecond units)
992*77c1e3ccSAndroid Build Coastguard Worker   long long GetFirstTime() const;  // time (ns) of first (earliest) block
993*77c1e3ccSAndroid Build Coastguard Worker   long long GetLastTime() const;  // time (ns) of last (latest) block
994*77c1e3ccSAndroid Build Coastguard Worker 
995*77c1e3ccSAndroid Build Coastguard Worker   long GetFirst(const BlockEntry*&) const;
996*77c1e3ccSAndroid Build Coastguard Worker   long GetLast(const BlockEntry*&) const;
997*77c1e3ccSAndroid Build Coastguard Worker   long GetNext(const BlockEntry* curr, const BlockEntry*& next) const;
998*77c1e3ccSAndroid Build Coastguard Worker 
999*77c1e3ccSAndroid Build Coastguard Worker   const BlockEntry* GetEntry(const Track*, long long ns = -1) const;
1000*77c1e3ccSAndroid Build Coastguard Worker   const BlockEntry* GetEntry(const CuePoint&,
1001*77c1e3ccSAndroid Build Coastguard Worker                              const CuePoint::TrackPosition&) const;
1002*77c1e3ccSAndroid Build Coastguard Worker   // const BlockEntry* GetMaxKey(const VideoTrack*) const;
1003*77c1e3ccSAndroid Build Coastguard Worker 
1004*77c1e3ccSAndroid Build Coastguard Worker   //    static bool HasBlockEntries(const Segment*, long long);
1005*77c1e3ccSAndroid Build Coastguard Worker 
1006*77c1e3ccSAndroid Build Coastguard Worker   static long HasBlockEntries(const Segment*, long long idoff, long long& pos,
1007*77c1e3ccSAndroid Build Coastguard Worker                               long& size);
1008*77c1e3ccSAndroid Build Coastguard Worker 
1009*77c1e3ccSAndroid Build Coastguard Worker   long GetEntryCount() const;
1010*77c1e3ccSAndroid Build Coastguard Worker 
1011*77c1e3ccSAndroid Build Coastguard Worker   long Load(long long& pos, long& size) const;
1012*77c1e3ccSAndroid Build Coastguard Worker 
1013*77c1e3ccSAndroid Build Coastguard Worker   long Parse(long long& pos, long& size) const;
1014*77c1e3ccSAndroid Build Coastguard Worker   long GetEntry(long index, const mkvparser::BlockEntry*&) const;
1015*77c1e3ccSAndroid Build Coastguard Worker 
1016*77c1e3ccSAndroid Build Coastguard Worker  protected:
1017*77c1e3ccSAndroid Build Coastguard Worker   Cluster(Segment*, long index, long long element_start);
1018*77c1e3ccSAndroid Build Coastguard Worker   // long long element_size);
1019*77c1e3ccSAndroid Build Coastguard Worker 
1020*77c1e3ccSAndroid Build Coastguard Worker  public:
1021*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_start;
1022*77c1e3ccSAndroid Build Coastguard Worker   long long GetPosition() const;  // offset relative to segment
1023*77c1e3ccSAndroid Build Coastguard Worker 
1024*77c1e3ccSAndroid Build Coastguard Worker   long GetIndex() const;
1025*77c1e3ccSAndroid Build Coastguard Worker   long long GetElementSize() const;
1026*77c1e3ccSAndroid Build Coastguard Worker   // long long GetPayloadSize() const;
1027*77c1e3ccSAndroid Build Coastguard Worker 
1028*77c1e3ccSAndroid Build Coastguard Worker   // long long Unparsed() const;
1029*77c1e3ccSAndroid Build Coastguard Worker 
1030*77c1e3ccSAndroid Build Coastguard Worker  private:
1031*77c1e3ccSAndroid Build Coastguard Worker   long m_index;
1032*77c1e3ccSAndroid Build Coastguard Worker   mutable long long m_pos;
1033*77c1e3ccSAndroid Build Coastguard Worker   // mutable long long m_size;
1034*77c1e3ccSAndroid Build Coastguard Worker   mutable long long m_element_size;
1035*77c1e3ccSAndroid Build Coastguard Worker   mutable long long m_timecode;
1036*77c1e3ccSAndroid Build Coastguard Worker   mutable BlockEntry** m_entries;
1037*77c1e3ccSAndroid Build Coastguard Worker   mutable long m_entries_size;
1038*77c1e3ccSAndroid Build Coastguard Worker   mutable long m_entries_count;
1039*77c1e3ccSAndroid Build Coastguard Worker 
1040*77c1e3ccSAndroid Build Coastguard Worker   long ParseSimpleBlock(long long, long long&, long&);
1041*77c1e3ccSAndroid Build Coastguard Worker   long ParseBlockGroup(long long, long long&, long&);
1042*77c1e3ccSAndroid Build Coastguard Worker 
1043*77c1e3ccSAndroid Build Coastguard Worker   long CreateBlock(long long id, long long pos, long long size,
1044*77c1e3ccSAndroid Build Coastguard Worker                    long long discard_padding);
1045*77c1e3ccSAndroid Build Coastguard Worker   long CreateBlockGroup(long long start_offset, long long size,
1046*77c1e3ccSAndroid Build Coastguard Worker                         long long discard_padding);
1047*77c1e3ccSAndroid Build Coastguard Worker   long CreateSimpleBlock(long long, long long);
1048*77c1e3ccSAndroid Build Coastguard Worker };
1049*77c1e3ccSAndroid Build Coastguard Worker 
1050*77c1e3ccSAndroid Build Coastguard Worker class Segment {
1051*77c1e3ccSAndroid Build Coastguard Worker   friend class Cues;
1052*77c1e3ccSAndroid Build Coastguard Worker   friend class Track;
1053*77c1e3ccSAndroid Build Coastguard Worker   friend class VideoTrack;
1054*77c1e3ccSAndroid Build Coastguard Worker 
1055*77c1e3ccSAndroid Build Coastguard Worker   Segment(const Segment&);
1056*77c1e3ccSAndroid Build Coastguard Worker   Segment& operator=(const Segment&);
1057*77c1e3ccSAndroid Build Coastguard Worker 
1058*77c1e3ccSAndroid Build Coastguard Worker  private:
1059*77c1e3ccSAndroid Build Coastguard Worker   Segment(IMkvReader*, long long elem_start,
1060*77c1e3ccSAndroid Build Coastguard Worker           // long long elem_size,
1061*77c1e3ccSAndroid Build Coastguard Worker           long long pos, long long size);
1062*77c1e3ccSAndroid Build Coastguard Worker 
1063*77c1e3ccSAndroid Build Coastguard Worker  public:
1064*77c1e3ccSAndroid Build Coastguard Worker   IMkvReader* const m_pReader;
1065*77c1e3ccSAndroid Build Coastguard Worker   const long long m_element_start;
1066*77c1e3ccSAndroid Build Coastguard Worker   // const long long m_element_size;
1067*77c1e3ccSAndroid Build Coastguard Worker   const long long m_start;  // posn of segment payload
1068*77c1e3ccSAndroid Build Coastguard Worker   const long long m_size;  // size of segment payload
1069*77c1e3ccSAndroid Build Coastguard Worker   Cluster m_eos;  // TODO: make private?
1070*77c1e3ccSAndroid Build Coastguard Worker 
1071*77c1e3ccSAndroid Build Coastguard Worker   static long long CreateInstance(IMkvReader*, long long, Segment*&);
1072*77c1e3ccSAndroid Build Coastguard Worker   ~Segment();
1073*77c1e3ccSAndroid Build Coastguard Worker 
1074*77c1e3ccSAndroid Build Coastguard Worker   long Load();  // loads headers and all clusters
1075*77c1e3ccSAndroid Build Coastguard Worker 
1076*77c1e3ccSAndroid Build Coastguard Worker   // for incremental loading
1077*77c1e3ccSAndroid Build Coastguard Worker   // long long Unparsed() const;
1078*77c1e3ccSAndroid Build Coastguard Worker   bool DoneParsing() const;
1079*77c1e3ccSAndroid Build Coastguard Worker   long long ParseHeaders();  // stops when first cluster is found
1080*77c1e3ccSAndroid Build Coastguard Worker   // long FindNextCluster(long long& pos, long& size) const;
1081*77c1e3ccSAndroid Build Coastguard Worker   long LoadCluster(long long& pos, long& size);  // load one cluster
1082*77c1e3ccSAndroid Build Coastguard Worker   long LoadCluster();
1083*77c1e3ccSAndroid Build Coastguard Worker 
1084*77c1e3ccSAndroid Build Coastguard Worker   long ParseNext(const Cluster* pCurr, const Cluster*& pNext, long long& pos,
1085*77c1e3ccSAndroid Build Coastguard Worker                  long& size);
1086*77c1e3ccSAndroid Build Coastguard Worker 
1087*77c1e3ccSAndroid Build Coastguard Worker   const SeekHead* GetSeekHead() const;
1088*77c1e3ccSAndroid Build Coastguard Worker   const Tracks* GetTracks() const;
1089*77c1e3ccSAndroid Build Coastguard Worker   const SegmentInfo* GetInfo() const;
1090*77c1e3ccSAndroid Build Coastguard Worker   const Cues* GetCues() const;
1091*77c1e3ccSAndroid Build Coastguard Worker   const Chapters* GetChapters() const;
1092*77c1e3ccSAndroid Build Coastguard Worker   const Tags* GetTags() const;
1093*77c1e3ccSAndroid Build Coastguard Worker 
1094*77c1e3ccSAndroid Build Coastguard Worker   long long GetDuration() const;
1095*77c1e3ccSAndroid Build Coastguard Worker 
1096*77c1e3ccSAndroid Build Coastguard Worker   unsigned long GetCount() const;
1097*77c1e3ccSAndroid Build Coastguard Worker   const Cluster* GetFirst() const;
1098*77c1e3ccSAndroid Build Coastguard Worker   const Cluster* GetLast() const;
1099*77c1e3ccSAndroid Build Coastguard Worker   const Cluster* GetNext(const Cluster*);
1100*77c1e3ccSAndroid Build Coastguard Worker 
1101*77c1e3ccSAndroid Build Coastguard Worker   const Cluster* FindCluster(long long time_nanoseconds) const;
1102*77c1e3ccSAndroid Build Coastguard Worker   // const BlockEntry* Seek(long long time_nanoseconds, const Track*) const;
1103*77c1e3ccSAndroid Build Coastguard Worker 
1104*77c1e3ccSAndroid Build Coastguard Worker   const Cluster* FindOrPreloadCluster(long long pos);
1105*77c1e3ccSAndroid Build Coastguard Worker 
1106*77c1e3ccSAndroid Build Coastguard Worker   long ParseCues(long long cues_off,  // offset relative to start of segment
1107*77c1e3ccSAndroid Build Coastguard Worker                  long long& parse_pos, long& parse_len);
1108*77c1e3ccSAndroid Build Coastguard Worker 
1109*77c1e3ccSAndroid Build Coastguard Worker  private:
1110*77c1e3ccSAndroid Build Coastguard Worker   long long m_pos;  // absolute file posn; what has been consumed so far
1111*77c1e3ccSAndroid Build Coastguard Worker   Cluster* m_pUnknownSize;
1112*77c1e3ccSAndroid Build Coastguard Worker 
1113*77c1e3ccSAndroid Build Coastguard Worker   SeekHead* m_pSeekHead;
1114*77c1e3ccSAndroid Build Coastguard Worker   SegmentInfo* m_pInfo;
1115*77c1e3ccSAndroid Build Coastguard Worker   Tracks* m_pTracks;
1116*77c1e3ccSAndroid Build Coastguard Worker   Cues* m_pCues;
1117*77c1e3ccSAndroid Build Coastguard Worker   Chapters* m_pChapters;
1118*77c1e3ccSAndroid Build Coastguard Worker   Tags* m_pTags;
1119*77c1e3ccSAndroid Build Coastguard Worker   Cluster** m_clusters;
1120*77c1e3ccSAndroid Build Coastguard Worker   long m_clusterCount;  // number of entries for which m_index >= 0
1121*77c1e3ccSAndroid Build Coastguard Worker   long m_clusterPreloadCount;  // number of entries for which m_index < 0
1122*77c1e3ccSAndroid Build Coastguard Worker   long m_clusterSize;  // array size
1123*77c1e3ccSAndroid Build Coastguard Worker 
1124*77c1e3ccSAndroid Build Coastguard Worker   long DoLoadCluster(long long&, long&);
1125*77c1e3ccSAndroid Build Coastguard Worker   long DoLoadClusterUnknownSize(long long&, long&);
1126*77c1e3ccSAndroid Build Coastguard Worker   long DoParseNext(const Cluster*&, long long&, long&);
1127*77c1e3ccSAndroid Build Coastguard Worker 
1128*77c1e3ccSAndroid Build Coastguard Worker   bool AppendCluster(Cluster*);
1129*77c1e3ccSAndroid Build Coastguard Worker   bool PreloadCluster(Cluster*, ptrdiff_t);
1130*77c1e3ccSAndroid Build Coastguard Worker 
1131*77c1e3ccSAndroid Build Coastguard Worker   // void ParseSeekHead(long long pos, long long size);
1132*77c1e3ccSAndroid Build Coastguard Worker   // void ParseSeekEntry(long long pos, long long size);
1133*77c1e3ccSAndroid Build Coastguard Worker   // void ParseCues(long long);
1134*77c1e3ccSAndroid Build Coastguard Worker 
1135*77c1e3ccSAndroid Build Coastguard Worker   const BlockEntry* GetBlock(const CuePoint&, const CuePoint::TrackPosition&);
1136*77c1e3ccSAndroid Build Coastguard Worker };
1137*77c1e3ccSAndroid Build Coastguard Worker 
1138*77c1e3ccSAndroid Build Coastguard Worker }  // namespace mkvparser
1139*77c1e3ccSAndroid Build Coastguard Worker 
LoadCluster()1140*77c1e3ccSAndroid Build Coastguard Worker inline long mkvparser::Segment::LoadCluster() {
1141*77c1e3ccSAndroid Build Coastguard Worker   long long pos;
1142*77c1e3ccSAndroid Build Coastguard Worker   long size;
1143*77c1e3ccSAndroid Build Coastguard Worker 
1144*77c1e3ccSAndroid Build Coastguard Worker   return LoadCluster(pos, size);
1145*77c1e3ccSAndroid Build Coastguard Worker }
1146*77c1e3ccSAndroid Build Coastguard Worker 
1147*77c1e3ccSAndroid Build Coastguard Worker #endif  // MKVPARSER_MKVPARSER_H_
1148