check lacing bits
Change-Id: Iaa3a65429b7f3211868a86bbb83ce8018350554a
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
#include <climits>
|
||||||
//#include <windows.h>
|
//#include <windows.h>
|
||||||
//#include "odbgstream.hpp"
|
//#include "odbgstream.hpp"
|
||||||
//using std::endl;
|
//using std::endl;
|
||||||
@@ -2348,8 +2349,8 @@ void CuePoint::TrackPosition::Parse(
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(m_pos >= 0);
|
assert(m_pos >= 0);
|
||||||
//assert(m_track > 0);
|
assert(m_track > 0);
|
||||||
//assert(m_block > 0);
|
assert(m_block > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2999,6 +3000,7 @@ Track::Info::Info():
|
|||||||
codecPrivate(NULL),
|
codecPrivate(NULL),
|
||||||
codecPrivateSize(0),
|
codecPrivateSize(0),
|
||||||
codecNameAsUTF8(NULL)
|
codecNameAsUTF8(NULL)
|
||||||
|
//lacing(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3058,6 +3060,12 @@ const unsigned char* Track::GetCodecPrivate(size_t& size) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Track::GetLacing() const
|
||||||
|
{
|
||||||
|
return m_info.lacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
long Track::GetFirst(const BlockEntry*& pBlockEntry) const
|
long Track::GetFirst(const BlockEntry*& pBlockEntry) const
|
||||||
{
|
{
|
||||||
Cluster* pCluster = m_pSegment->GetFirst();
|
Cluster* pCluster = m_pSegment->GetFirst();
|
||||||
@@ -3461,7 +3469,13 @@ Tracks::Tracks(Segment* pSegment, long long start, long long size_) :
|
|||||||
//pos now desinates start of element
|
//pos now desinates start of element
|
||||||
|
|
||||||
if (id == 0x2E) //TrackEntry ID
|
if (id == 0x2E) //TrackEntry ID
|
||||||
ParseTrackEntry(pos, size1, *m_trackEntriesEnd++);
|
{
|
||||||
|
Track*& pTrack = *m_trackEntriesEnd;
|
||||||
|
ParseTrackEntry(pos, size1, pTrack);
|
||||||
|
|
||||||
|
if (pTrack)
|
||||||
|
++m_trackEntriesEnd;
|
||||||
|
}
|
||||||
|
|
||||||
pos += size1; //consume payload
|
pos += size1; //consume payload
|
||||||
assert(pos <= stop);
|
assert(pos <= stop);
|
||||||
@@ -3496,6 +3510,8 @@ void Tracks::ParseTrackEntry(
|
|||||||
Track::Settings audioSettings;
|
Track::Settings audioSettings;
|
||||||
audioSettings.start = -1;
|
audioSettings.start = -1;
|
||||||
|
|
||||||
|
long long lacing = 1; //default is true
|
||||||
|
|
||||||
while (pos < stop)
|
while (pos < stop)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@@ -3514,6 +3530,8 @@ void Tracks::ParseTrackEntry(
|
|||||||
assert(i.nameAsUTF8);
|
assert(i.nameAsUTF8);
|
||||||
else if (Match(pReader, pos, 0x06, i.codecId))
|
else if (Match(pReader, pos, 0x06, i.codecId))
|
||||||
;
|
;
|
||||||
|
else if (Match(pReader, pos, 0x1C, lacing))
|
||||||
|
assert(lacing <= 1);
|
||||||
else if (Match(pReader,
|
else if (Match(pReader,
|
||||||
pos,
|
pos,
|
||||||
0x23A2,
|
0x23A2,
|
||||||
@@ -3560,6 +3578,8 @@ void Tracks::ParseTrackEntry(
|
|||||||
//and that it is unique among all tracks.
|
//and that it is unique among all tracks.
|
||||||
assert(i.number > 0);
|
assert(i.number > 0);
|
||||||
|
|
||||||
|
i.lacing = (lacing > 0) ? true : false;
|
||||||
|
|
||||||
//TODO: vet settings, to ensure that video settings (0x60)
|
//TODO: vet settings, to ensure that video settings (0x60)
|
||||||
//were specified when type = 1, and that audio settings (0x61)
|
//were specified when type = 1, and that audio settings (0x61)
|
||||||
//were specified when type = 2.
|
//were specified when type = 2.
|
||||||
@@ -4130,6 +4150,11 @@ Cluster::GetEntry(
|
|||||||
|
|
||||||
while (i != j)
|
while (i != j)
|
||||||
{
|
{
|
||||||
|
#ifdef _DEBUG
|
||||||
|
const ptrdiff_t idx = i - m_entries;
|
||||||
|
idx;
|
||||||
|
#endif
|
||||||
|
|
||||||
const BlockEntry* const pEntry = *i++;
|
const BlockEntry* const pEntry = *i++;
|
||||||
assert(pEntry);
|
assert(pEntry);
|
||||||
assert(!pEntry->EOS());
|
assert(!pEntry->EOS());
|
||||||
@@ -4425,14 +4450,21 @@ Block::Block(long long start, long long size_, IMkvReader* pReader) :
|
|||||||
const long hr = pReader->Read(pos, 1, &m_flags);
|
const long hr = pReader->Read(pos, 1, &m_flags);
|
||||||
assert(hr == 0L);
|
assert(hr == 0L);
|
||||||
|
|
||||||
|
const int invisible = int(m_flags & 0x08);
|
||||||
|
invisible;
|
||||||
|
assert(!invisible);
|
||||||
|
|
||||||
|
const int lacing = int(m_flags & 0x06);
|
||||||
|
lacing;
|
||||||
|
assert(!lacing);
|
||||||
|
|
||||||
++pos;
|
++pos;
|
||||||
assert(pos <= stop);
|
assert(pos <= stop);
|
||||||
|
|
||||||
m_frameOff = pos;
|
m_frameOff = pos;
|
||||||
|
|
||||||
const long long frame_size = stop - pos;
|
const long long frame_size = stop - pos;
|
||||||
|
assert(frame_size <= LONG_MAX);
|
||||||
assert(frame_size <= 2147483647L);
|
|
||||||
|
|
||||||
m_frameSize = static_cast<long>(frame_size);
|
m_frameSize = static_cast<long>(frame_size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ public:
|
|||||||
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;
|
||||||
|
|
||||||
@@ -211,7 +212,9 @@ public:
|
|||||||
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();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user