Compare commits
18 Commits
libwebm-1.
...
libwebm-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2f6bea0d8 | ||
|
|
16934eb76f | ||
|
|
9c15c0f40b | ||
|
|
43f77d54bd | ||
|
|
aec650fed7 | ||
|
|
024ad97571 | ||
|
|
8f2a2e04d7 | ||
|
|
9105d61514 | ||
|
|
77f61bdd68 | ||
|
|
485b6e8125 | ||
|
|
1d0c804fb9 | ||
|
|
b607880184 | ||
|
|
d2688d316d | ||
|
|
885d2e1ef8 | ||
|
|
1cf3a81c78 | ||
|
|
6efbd56948 | ||
|
|
f56533b30e | ||
|
|
ec2b951a78 |
1482
mkvparser.cpp
1482
mkvparser.cpp
File diff suppressed because it is too large
Load Diff
112
mkvparser.hpp
112
mkvparser.hpp
@@ -80,6 +80,7 @@ public:
|
||||
bool IsKey() const;
|
||||
void SetKey(bool);
|
||||
|
||||
long long GetOffset() const;
|
||||
long GetSize() const;
|
||||
long Read(IMkvReader*, unsigned char*) const;
|
||||
|
||||
@@ -333,14 +334,19 @@ private:
|
||||
char* m_pTitleAsUTF8;
|
||||
};
|
||||
|
||||
|
||||
class Cues;
|
||||
class CuePoint
|
||||
{
|
||||
public:
|
||||
CuePoint();
|
||||
friend class Cues;
|
||||
|
||||
CuePoint(size_t, long long);
|
||||
~CuePoint();
|
||||
|
||||
void Parse(IMkvReader*, long long start, long long size);
|
||||
CuePoint(const CuePoint&);
|
||||
CuePoint& operator=(const CuePoint&);
|
||||
|
||||
public:
|
||||
void Load(IMkvReader*);
|
||||
|
||||
long long GetTimeCode() const; //absolute but unscaled
|
||||
long long GetTime(Segment*) const; //absolute and scaled (ns units)
|
||||
@@ -360,6 +366,7 @@ public:
|
||||
const TrackPosition* Find(const Track*) const;
|
||||
|
||||
private:
|
||||
const size_t m_index;
|
||||
long long m_timecode;
|
||||
TrackPosition* m_track_positions;
|
||||
size_t m_track_positions_count;
|
||||
@@ -369,6 +376,11 @@ private:
|
||||
|
||||
class Cues
|
||||
{
|
||||
friend class Segment;
|
||||
|
||||
Cues(Segment*, long long start, long long size);
|
||||
~Cues();
|
||||
|
||||
Cues(const Cues&);
|
||||
Cues& operator=(const Cues&);
|
||||
|
||||
@@ -377,24 +389,35 @@ public:
|
||||
const long long m_start;
|
||||
const long long m_size;
|
||||
|
||||
Cues(Segment*, long long start, long long size);
|
||||
~Cues();
|
||||
|
||||
bool Find( //lower bound of time_ns
|
||||
long long time_ns,
|
||||
const Track*,
|
||||
const CuePoint*&,
|
||||
const CuePoint::TrackPosition*&) const;
|
||||
|
||||
#if 0
|
||||
bool FindNext( //upper_bound of time_ns
|
||||
long long time_ns,
|
||||
const Track*,
|
||||
const CuePoint*&,
|
||||
const CuePoint::TrackPosition*&) const;
|
||||
#endif
|
||||
|
||||
const CuePoint* GetNext(const CuePoint*) const;
|
||||
|
||||
const BlockEntry* GetBlock(
|
||||
const CuePoint*,
|
||||
const CuePoint::TrackPosition*) const;
|
||||
|
||||
private:
|
||||
CuePoint* m_cue_points;
|
||||
size_t m_cue_points_count;
|
||||
void Init() const;
|
||||
bool LoadCuePoint() const;
|
||||
void PreloadCuePoint(size_t&, long long) const;
|
||||
|
||||
mutable CuePoint** m_cue_points;
|
||||
mutable size_t m_count;
|
||||
mutable size_t m_preload_count;
|
||||
mutable long long m_pos;
|
||||
|
||||
};
|
||||
|
||||
@@ -406,10 +429,10 @@ class Cluster
|
||||
|
||||
public:
|
||||
Segment* const m_pSegment;
|
||||
const size_t m_index;
|
||||
long m_index;
|
||||
|
||||
public:
|
||||
static Cluster* Parse(Segment*, size_t, long long off);
|
||||
static Cluster* Parse(Segment*, long, long long off);
|
||||
|
||||
Cluster(); //EndOfStream
|
||||
~Cluster();
|
||||
@@ -430,7 +453,7 @@ public:
|
||||
const BlockEntry* GetMaxKey(const VideoTrack*);
|
||||
|
||||
protected:
|
||||
Cluster(Segment*, size_t, long long off);
|
||||
Cluster(Segment*, long, long long off);
|
||||
|
||||
public:
|
||||
long long m_pos;
|
||||
@@ -438,7 +461,7 @@ public:
|
||||
|
||||
private:
|
||||
long long m_timecode;
|
||||
BlockEntry** m_pEntries;
|
||||
BlockEntry** m_entries;
|
||||
size_t m_entriesCount;
|
||||
|
||||
void Load();
|
||||
@@ -451,6 +474,8 @@ private:
|
||||
|
||||
class Segment
|
||||
{
|
||||
friend class Cues;
|
||||
|
||||
Segment(const Segment&);
|
||||
Segment& operator=(const Segment&);
|
||||
|
||||
@@ -466,58 +491,55 @@ public:
|
||||
static long long CreateInstance(IMkvReader*, long long, Segment*&);
|
||||
~Segment();
|
||||
|
||||
//for big-bang loading (source filter)
|
||||
long Load();
|
||||
long Load(); //loads headers and all clusters
|
||||
|
||||
//for incremental loading (splitter)
|
||||
long long Unparsed() const;
|
||||
long long ParseHeaders();
|
||||
long long ParseHeaders(); //stops when first cluster is found
|
||||
long LoadCluster(); //loads one cluster
|
||||
|
||||
#if 0
|
||||
//This pair parses one cluster, but only changes the state of the
|
||||
//segment object when the cluster is actually added to the index.
|
||||
long ParseCluster(Cluster*&, long long& newpos) const;
|
||||
bool AddCluster(Cluster*, long long);
|
||||
#endif
|
||||
|
||||
Tracks* GetTracks() const;
|
||||
const SegmentInfo* GetInfo() const;
|
||||
long long GetDuration() const;
|
||||
|
||||
//NOTE: this turned out to be too inefficient.
|
||||
//long long Load(long long time_nanoseconds);
|
||||
|
||||
Cluster* GetFirst();
|
||||
Cluster* GetLast();
|
||||
unsigned long GetCount() const;
|
||||
|
||||
Cluster* GetNext(const Cluster*);
|
||||
Cluster* GetCluster(long long time_nanoseconds);
|
||||
|
||||
void GetCluster(
|
||||
long long time_nanoseconds,
|
||||
Track*,
|
||||
Cluster*&,
|
||||
const BlockEntry*&);
|
||||
|
||||
const Cues* GetCues() const;
|
||||
|
||||
long long GetDuration() const;
|
||||
|
||||
unsigned long GetCount() const;
|
||||
Cluster* GetFirst();
|
||||
Cluster* GetLast();
|
||||
Cluster* GetNext(const Cluster*);
|
||||
|
||||
Cluster* FindCluster(long long time_nanoseconds);
|
||||
const BlockEntry* Seek(long long time_nanoseconds, const Track*);
|
||||
|
||||
private:
|
||||
|
||||
long long m_pos; //absolute file posn; what has been consumed so far
|
||||
SegmentInfo* m_pInfo;
|
||||
Tracks* m_pTracks;
|
||||
Cues* m_pCues;
|
||||
Cluster** m_clusters;
|
||||
size_t m_clusterCount; //number of entries
|
||||
size_t m_clusterSize; //array size
|
||||
long m_clusterCount; //number of entries for which m_index >= 0
|
||||
long m_clusterPreloadCount; //number of entries for which m_index < 0
|
||||
long m_clusterSize; //array size
|
||||
|
||||
void AppendCluster(Cluster*);
|
||||
void PreloadCluster(Cluster*, ptrdiff_t);
|
||||
|
||||
//void ParseSeekHead(long long pos, long long size, size_t*);
|
||||
//void ParseSeekEntry(long long pos, long long size, size_t*);
|
||||
//void ParseSecondarySeekHead(long long off, size_t*);
|
||||
void ParseCues(long long off);
|
||||
void ParseSeekHead(long long pos, long long size);
|
||||
void ParseSeekEntry(long long pos, long long size);
|
||||
void ParseCues(long long);
|
||||
|
||||
bool SearchCues(
|
||||
long long time_ns,
|
||||
Track*,
|
||||
Cluster*&,
|
||||
const BlockEntry*&);
|
||||
const BlockEntry* GetBlock(
|
||||
const CuePoint&,
|
||||
const CuePoint::TrackPosition&);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user