Compare commits

...

24 Commits

Author SHA1 Message Date
matthewjheaney
9203d2dcd1 set version to 1.0.0.8
Change-Id: If4bd0d73f72cb819dee9d985fe8f64490c3ab206
2010-11-19 14:55:56 -05:00
matthewjheaney
be2f81abca filter out empty clusters
Change-Id: Iad4da9d55c1cfc332042d0017bd5d77e9ad511b6
2010-11-18 19:28:50 -05:00
matthewjheaney
cb5414a42a changed semantics of m_entries_count
Change-Id: I114b1482239cced838932f35ca4b5ae380f0d022
2010-11-18 17:30:12 -05:00
matthewjheaney
2ce6965b2d GetEntry now accepts a time
Change-Id: I850cfa1deaae465b91c9f65b774ad49cce9e8b8d
2010-11-17 14:27:55 -05:00
Hwasoo Lee
8db600e1c9 handled unknown size of segment for live stream
Change-Id: I7dcc08e38c6cd31a55693b39ace414c14399d1b5
2010-11-16 16:17:10 -05:00
Hwasoo Lee
85353469f8 updated the project files
Change-Id: Ia949818a03663b4b4e3595e60183213de8e98100
2010-11-16 14:56:55 -05:00
Hwasoo Lee
d97f236f81 fixed the issue 234
Change-Id: Ie527263ae2862426e8c58fce13b34da4c792cc01
2010-11-16 14:54:14 -05:00
matthewjheaney
790f639f2f ignore empty clusters when getting first block
Change-Id: I9278efcacc3ea5dcfa584cb0937e39a4004e6947
2010-11-15 21:22:57 -05:00
matthewjheaney
91dbee4b6e set version to 1.0.0.7
Change-Id: I09444586c0b1ed6fd5002631a9eece890644d278
2010-11-12 15:01:57 -05:00
matthewjheaney
1e6c5cbaf7 ignore empty clusters when finding next one
Change-Id: I7478e6428c8383a1d05a91e9a44b6d1ee1335da7
2010-11-12 13:30:47 -05:00
matthewjheaney
c62b9f8a21 relax block value check
Change-Id: Ifaf4cbc4176dde8e2653cb9da9888551a872da7b
2010-11-11 22:30:42 -05:00
Hwasoo Lee
5dd6000dc7 updated to handle a laced webm 2010-11-09 09:54:31 -05:00
Hwasoo Lee
3ea595b132 Merge "Updated RELEASE.TXT" 2010-11-08 14:22:15 -08:00
Ryan Thompson
14e42cf98b Made getcluster call const
As Inherited from the super class this call should also be const.
2010-11-08 16:14:04 -05:00
matthewjheaney
6c9f4d11a1 set version to 1.0.0.6
Change-Id: I259171d7bce7f670cb937707a9864aa0b9eb0d22
2010-11-05 15:21:28 -04:00
matthewjheaney
95c134ad53 ensure const correctness
Change-Id: Ia401d66519d1d663e9630ad1e70f18adec0f0bb5
2010-11-04 19:15:16 -04:00
Hwasoo Lee
30bf3472bf Updated RELEASE.TXT 2010-11-03 13:46:44 -04:00
matthewjheaney
7adec5248a added lacing support
Change-Id: I79ce0b6820f62846b05edbc8a0cb381aa2bc32a6
2010-11-02 11:44:31 -04:00
matthewjheaney
093b78faf2 set version to 1.0.0.5
Change-Id: I3643a0019110b1ff7359a8d414bf0cd2ba9b5d54
2010-10-29 14:31:47 -04:00
matthewjheaney
ed90de0d52 check lacing bits
Change-Id: Iaa3a65429b7f3211868a86bbb83ce8018350554a
2010-10-29 14:04:43 -04:00
matthewjheaney
a01e568293 removed IsBFrame selector
Change-Id: Iae51165c318997a9131e9af5c667cfac1f37e773
2010-10-28 17:28:59 -04:00
matthewjheaney
d7ce23a019 handle empty clusters when seeking
Change-Id: I9bb39ff95e308639402e1c7f9aec59c81350d091
2010-10-28 14:45:27 -04:00
matthewjheaney
acf7ddb273 handle empty clusters
Change-Id: I57b085367e1b900acb0ddd6ee419e317f261718a
2010-10-27 16:47:14 -04:00
matthewjheaney
fc12207e15 handle case when no duration
Change-Id: I694f6ce6ae9ecc6fc3b90b954dd7041e82fb9ac0
2010-10-22 13:46:39 -04:00
6 changed files with 787 additions and 246 deletions

View File

@@ -1,3 +1,29 @@
1.0.0.5
* Handled case when no duration
* Handled empty clusters
* Handled empty clusters when seeking
* Implemented check lacing bits
1.0.0.4
* Made Cues member variables mutables
* Defined against badly-formatted cue points
* Segment::GetCluster returns CuePoint too
* Separated cue-based searches
1.0.0.3
* Added Block::GetOffset() to get a frame's offset in a block
* Changed cluster count type from size_t to long
* Parsed SeekHead to find cues
* Allowed seeking beyond end of cluster cache
* Added not to attempt to reparse cues element
* Restructured Segment::LoadCluster
* Marked position of cues without parsing cues element
* Allowed cue points to be loaded incrementally
* Implemented to load lazily cue points as they're searched
* Merged Cues::LoadCuePoint into Cues::Find
* Lazy init cues
* Loaded cue point during find
1.0.0.2 1.0.0.2
* added support for Cues element * added support for Cues element
* seeking was improved * seeking was improved

File diff suppressed because it is too large Load Diff

View File

@@ -37,7 +37,7 @@ short Unserialize2SInt(IMkvReader*, long long);
signed char Unserialize1SInt(IMkvReader*, long long); signed char Unserialize1SInt(IMkvReader*, long long);
bool Match(IMkvReader*, long long&, unsigned long, long long&); bool Match(IMkvReader*, long long&, unsigned long, long long&);
bool Match(IMkvReader*, long long&, unsigned long, char*&); bool Match(IMkvReader*, long long&, unsigned long, char*&);
bool Match(IMkvReader*, long long&, unsigned long,unsigned char*&, size_t&); bool Match(IMkvReader*, long long&, unsigned long, unsigned char*&, size_t&);
bool Match(IMkvReader*, long long&, unsigned long, double&); bool Match(IMkvReader*, long long&, unsigned long, double&);
bool Match(IMkvReader*, long long&, unsigned long, short&); bool Match(IMkvReader*, long long&, unsigned long, short&);
@@ -73,23 +73,44 @@ public:
const long long m_size; const long long m_size;
Block(long long start, long long size, IMkvReader*); Block(long long start, long long size, IMkvReader*);
~Block();
long long GetTrackNumber() const; long long GetTrackNumber() const;
long long GetTimeCode(Cluster*) const; //absolute, but not scaled long long GetTimeCode(const Cluster*) const; //absolute, but not scaled
long long GetTime(Cluster*) const; //absolute, and scaled (ns units) long long GetTime(const Cluster*) const; //absolute, and scaled (ns)
bool IsKey() const; bool IsKey() const;
void SetKey(bool); void SetKey(bool);
int GetFrameCount() const; //to index frames: [0, count)
struct Frame
{
long long pos; //absolute offset
long len;
long Read(IMkvReader*, unsigned char*) const;
};
#if 0
long long GetOffset() const; long long GetOffset() const;
long GetSize() const; long GetSize() const;
long Read(IMkvReader*, unsigned char*) const; long Read(IMkvReader*, unsigned char*) const;
#else
const Frame& GetFrame(int frame_index) const;
#endif
private: private:
long long m_track; //Track::Number() long long m_track; //Track::Number()
short m_timecode; //relative to cluster short m_timecode; //relative to cluster
unsigned char m_flags; unsigned char m_flags;
#if 0
long long m_frameOff; long long m_frameOff;
long m_frameSize; long m_frameSize;
#else
Frame* m_frames;
int m_frame_count;
#endif
}; };
@@ -102,10 +123,10 @@ class BlockEntry
public: public:
virtual ~BlockEntry(); virtual ~BlockEntry();
virtual bool EOS() const = 0; virtual bool EOS() const = 0;
virtual Cluster* GetCluster() const = 0; virtual const Cluster* GetCluster() const = 0;
virtual size_t GetIndex() const = 0; virtual size_t GetIndex() const = 0;
virtual const Block* GetBlock() const = 0; virtual const Block* GetBlock() const = 0;
virtual bool IsBFrame() const = 0; //virtual bool IsBFrame() const = 0;
protected: protected:
BlockEntry(); BlockEntry();
@@ -122,10 +143,10 @@ public:
SimpleBlock(Cluster*, size_t, long long start, long long size); SimpleBlock(Cluster*, size_t, long long start, long long size);
bool EOS() const; bool EOS() const;
Cluster* GetCluster() const; const Cluster* GetCluster() const;
size_t GetIndex() const; size_t GetIndex() const;
const Block* GetBlock() const; const Block* GetBlock() const;
bool IsBFrame() const; //bool IsBFrame() const;
protected: protected:
Cluster* const m_pCluster; Cluster* const m_pCluster;
@@ -145,10 +166,10 @@ public:
~BlockGroup(); ~BlockGroup();
bool EOS() const; bool EOS() const;
Cluster* GetCluster() const; const Cluster* GetCluster() const;
size_t GetIndex() const; size_t GetIndex() const;
const Block* GetBlock() const; const Block* GetBlock() const;
bool IsBFrame() const; //bool IsBFrame() const;
short GetPrevTimeCode() const; //relative to block's time short GetPrevTimeCode() const; //relative to block's time
short GetNextTimeCode() const; //as above short GetNextTimeCode() const; //as above
@@ -188,10 +209,12 @@ public:
long long GetType() const; long long GetType() const;
long long GetNumber() const; long long GetNumber() const;
unsigned long long GetUid() const;
const char* GetNameAsUTF8() const; const char* GetNameAsUTF8() const;
const char* GetCodecNameAsUTF8() const; const char* GetCodecNameAsUTF8() const;
const char* GetCodecId() const; const char* GetCodecId() const;
const unsigned char* GetCodecPrivate(size_t&) const; const unsigned char* GetCodecPrivate(size_t&) const;
bool GetLacing() const;
const BlockEntry* GetEOS() const; const BlockEntry* GetEOS() const;
@@ -205,13 +228,15 @@ public:
{ {
long long type; long long type;
long long number; long long number;
long long uid; unsigned long long uid;
char* nameAsUTF8; char* nameAsUTF8;
char* codecId; char* codecId;
unsigned char* codecPrivate; unsigned char* codecPrivate;
size_t codecPrivateSize; size_t codecPrivateSize;
char* codecNameAsUTF8; char* codecNameAsUTF8;
bool lacing;
Settings settings; Settings settings;
Info(); Info();
void Clear(); void Clear();
}; };
@@ -230,7 +255,7 @@ protected:
EOSBlock(); EOSBlock();
bool EOS() const; bool EOS() const;
Cluster* GetCluster() const; const Cluster* GetCluster() const;
size_t GetIndex() const; size_t GetIndex() const;
const Block* GetBlock() const; const Block* GetBlock() const;
bool IsBFrame() const; bool IsBFrame() const;
@@ -294,8 +319,8 @@ public:
Tracks(Segment*, long long start, long long size); Tracks(Segment*, long long start, long long size);
virtual ~Tracks(); virtual ~Tracks();
Track* GetTrackByNumber(unsigned long tn) const; const Track* GetTrackByNumber(unsigned long tn) const;
Track* GetTrackByIndex(unsigned long idx) const; const Track* GetTrackByIndex(unsigned long idx) const;
private: private:
Track** m_trackEntries; Track** m_trackEntries;
@@ -403,6 +428,8 @@ public:
const CuePoint::TrackPosition*&) const; const CuePoint::TrackPosition*&) const;
#endif #endif
const CuePoint* GetFirst() const;
const CuePoint* GetLast() const;
const CuePoint* GetNext(const CuePoint*) const; const CuePoint* GetNext(const CuePoint*) const;
const BlockEntry* GetBlock( const BlockEntry* GetBlock(
@@ -429,7 +456,6 @@ class Cluster
public: public:
Segment* const m_pSegment; Segment* const m_pSegment;
long m_index;
public: public:
static Cluster* Parse(Segment*, long, long long off); static Cluster* Parse(Segment*, long, long long off);
@@ -439,35 +465,40 @@ public:
bool EOS() const; bool EOS() const;
long long GetTimeCode(); //absolute, but not scaled long long GetTimeCode() const; //absolute, but not scaled
long long GetTime(); //absolute, and scaled (nanosecond units) long long GetTime() const; //absolute, and scaled (nanosecond units)
long long GetFirstTime(); //time (ns) of first (earliest) block long long GetFirstTime() const; //time (ns) of first (earliest) block
long long GetLastTime() const; //time (ns) of last (latest) block
const BlockEntry* GetFirst(); const BlockEntry* GetFirst() const;
const BlockEntry* GetLast(); const BlockEntry* GetLast() const;
const BlockEntry* GetNext(const BlockEntry*) const; const BlockEntry* GetNext(const BlockEntry*) const;
const BlockEntry* GetEntry(const Track*); const BlockEntry* GetEntry(const Track*, long long ns = -1) const;
const BlockEntry* GetEntry( const BlockEntry* GetEntry(
const CuePoint&, const CuePoint&,
const CuePoint::TrackPosition&); const CuePoint::TrackPosition&) const;
const BlockEntry* GetMaxKey(const VideoTrack*); const BlockEntry* GetMaxKey(const VideoTrack*) const;
static bool HasBlockEntries(const Segment*, long long);
protected: protected:
Cluster(Segment*, long, long long off); Cluster(Segment*, long, long long off);
public: public:
long long m_pos; //TODO: these should all be private, with public selector functions
long long m_size; long m_index;
mutable long long m_pos;
mutable long long m_size;
private: private:
long long m_timecode; mutable long long m_timecode;
BlockEntry** m_entries; mutable BlockEntry** m_entries;
size_t m_entriesCount; mutable long m_entries_count;
void Load(); void Load() const;
void LoadBlockEntries(); void LoadBlockEntries() const;
void ParseBlockGroup(long long, long long, size_t); void ParseBlockGroup(long long, long long, size_t) const;
void ParseSimpleBlock(long long, long long, size_t); void ParseSimpleBlock(long long, long long, size_t) const;
}; };
@@ -498,12 +529,10 @@ public:
long long ParseHeaders(); //stops when first cluster is found long long ParseHeaders(); //stops when first cluster is found
long LoadCluster(); //loads one cluster long LoadCluster(); //loads one cluster
#if 0
//This pair parses one cluster, but only changes the state of the //This pair parses one cluster, but only changes the state of the
//segment object when the cluster is actually added to the index. //segment object when the cluster is actually added to the index.
long ParseCluster(Cluster*&, long long& newpos) const; long ParseCluster(long long& cluster_pos, long long& new_pos) const;
bool AddCluster(Cluster*, long long); bool AddCluster(long long cluster_pos, long long new_pos);
#endif
Tracks* GetTracks() const; Tracks* GetTracks() const;
const SegmentInfo* GetInfo() const; const SegmentInfo* GetInfo() const;
@@ -512,12 +541,12 @@ public:
long long GetDuration() const; long long GetDuration() const;
unsigned long GetCount() const; unsigned long GetCount() const;
Cluster* GetFirst(); const Cluster* GetFirst() const;
Cluster* GetLast(); const Cluster* GetLast() const;
Cluster* GetNext(const Cluster*); const Cluster* GetNext(const Cluster*);
Cluster* FindCluster(long long time_nanoseconds); const Cluster* FindCluster(long long time_nanoseconds) const;
const BlockEntry* Seek(long long time_nanoseconds, const Track*); const BlockEntry* Seek(long long time_nanoseconds, const Track*) const;
private: private:

View File

@@ -43,13 +43,13 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="1"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"
DebugInformationFormat="4" DebugInformationFormat="1"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"

View File

@@ -148,14 +148,14 @@ int main(int argc, char* argv[])
if (pTrack == NULL) if (pTrack == NULL)
continue; continue;
const long long trackType_ = pTrack->GetType(); const long long trackType = pTrack->GetType();
unsigned long trackType = static_cast<unsigned long>(trackType_); const long long trackNumber = pTrack->GetNumber();
const unsigned long long trackUid = pTrack->GetUid();
unsigned long trackNumber = pTrack->GetNumber();
const wchar_t* const pTrackName = utf8towcs(pTrack->GetNameAsUTF8()); const wchar_t* const pTrackName = utf8towcs(pTrack->GetNameAsUTF8());
printf("\t\tTrack Type\t\t: %ld\n", trackType); printf("\t\tTrack Type\t\t: %ld\n", trackType);
printf("\t\tTrack Number\t\t: %ld\n", trackNumber); printf("\t\tTrack Number\t\t: %ld\n", trackNumber);
printf("\t\tTrack Uid\t\t: %lld\n", trackUid);
if (pTrackName == NULL) if (pTrackName == NULL)
printf("\t\tTrack Name\t\t: NULL\n"); printf("\t\tTrack Name\t\t: NULL\n");
@@ -220,7 +220,7 @@ int main(int argc, char* argv[])
return -1; return -1;
} }
mkvparser::Cluster* pCluster = pSegment->GetFirst(); const mkvparser::Cluster* pCluster = pSegment->GetFirst();
while ((pCluster != NULL) && !pCluster->EOS()) while ((pCluster != NULL) && !pCluster->EOS())
{ {
@@ -235,18 +235,26 @@ int main(int argc, char* argv[])
while ((pBlockEntry != NULL) && !pBlockEntry->EOS()) while ((pBlockEntry != NULL) && !pBlockEntry->EOS())
{ {
const Block* const pBlock = pBlockEntry->GetBlock(); const Block* const pBlock = pBlockEntry->GetBlock();
const unsigned long trackNum = pBlock->GetTrackNumber(); const long long trackNum = pBlock->GetTrackNumber();
const Track* const pTrack = pTracks->GetTrackByNumber(trackNum); const unsigned long tn = static_cast<unsigned long>(trackNum);
const Track* const pTrack = pTracks->GetTrackByNumber(tn);
const long long trackType = pTrack->GetType(); const long long trackType = pTrack->GetType();
const long size = pBlock->GetSize(); const int frameCount = pBlock->GetFrameCount();
const long long time_ns = pBlock->GetTime(pCluster); const long long time_ns = pBlock->GetTime(pCluster);
printf("\t\t\tBlock\t\t:%s,%15ld,%s,%15lld\n", printf("\t\t\tBlock\t\t:%s,%s,%15lld\n",
(trackType == VIDEO_TRACK) ? "V" : "A", (trackType == VIDEO_TRACK) ? "V" : "A",
size,
pBlock->IsKey() ? "I" : "P", pBlock->IsKey() ? "I" : "P",
time_ns); time_ns);
for (int i = 0; i < frameCount; ++i)
{
const Block::Frame& theFrame = pBlock->GetFrame(i);
const long size = theFrame.len;
const long long offset = theFrame.pos;
printf("\t\t\t %15ld,%15lx\n", size, offset);
}
pBlockEntry = pCluster->GetNext(pBlockEntry); pBlockEntry = pCluster->GetNext(pBlockEntry);
} }

View File

@@ -43,13 +43,13 @@
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\" AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="1"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"
DebugInformationFormat="4" DebugInformationFormat="1"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"