mkvparser: minor SeekHead::Entry clean up.
- Store actual element ID in SeekHead::Entry id field (instead of a decoded EBML int, which is completely _wrong_). - Add a SeekHead::Entry constructor so we get initialized values in SeekHead::Entry's when parsing an Entry fails. Change-Id: I152fae54628cb84918917139dba0cd0b42a44a57
This commit is contained in:
@@ -1476,6 +1476,8 @@ long Segment::Load() {
|
||||
}
|
||||
}
|
||||
|
||||
SeekHead::Entry::Entry() : id(0), pos(0), element_start(0), element_size(0) {}
|
||||
|
||||
SeekHead::SeekHead(Segment* pSegment, long long start, long long size_,
|
||||
long long element_start, long long element_size)
|
||||
: m_pSegment(pSegment),
|
||||
@@ -1767,18 +1769,7 @@ bool SeekHead::ParseEntry(IMkvReader* pReader, long long start, long long size_,
|
||||
if ((pos + seekIdSize) > stop)
|
||||
return false;
|
||||
|
||||
// Note that the SeekId payload really is serialized
|
||||
// as a "Matroska integer", not as a plain binary value.
|
||||
// In fact, Matroska requires that ID values in the
|
||||
// stream exactly match the binary representation as listed
|
||||
// in the Matroska specification.
|
||||
//
|
||||
// This parser is more liberal, and permits IDs to have
|
||||
// any width. (This could make the representation in the stream
|
||||
// different from what's in the spec, but it doesn't matter here,
|
||||
// since we always normalize "Matroska integer" values.)
|
||||
|
||||
pEntry->id = ReadUInt(pReader, pos, len); // payload
|
||||
pEntry->id = ReadID(pReader, pos, len); // payload
|
||||
|
||||
if (pEntry->id <= 0)
|
||||
return false;
|
||||
|
||||
@@ -844,6 +844,8 @@ class SeekHead {
|
||||
long Parse();
|
||||
|
||||
struct Entry {
|
||||
Entry();
|
||||
|
||||
// the SeekHead entry payload
|
||||
long long id;
|
||||
long long pos;
|
||||
|
||||
@@ -73,10 +73,7 @@ bool HasCuePoints(const mkvparser::Segment* segment,
|
||||
std::int64_t offset = 0;
|
||||
for (int i = 0; i < seek_head->GetCount(); ++i) {
|
||||
const SeekHead::Entry* const entry = seek_head->GetEntry(i);
|
||||
// TODO(tomfinegan): Cues ID is really 0x1C53BB6B, aka kMkvCues, but
|
||||
// mkvparser reads IDs as EBML unsigned ints in some cases, yielding magic
|
||||
// numbers like the following. Investigate fixing this behavior.
|
||||
if (entry->id == 0xC53BB6B) { // Cues ID as stored in Entry class.
|
||||
if (entry->id == libwebm::kMkvCues) {
|
||||
offset = entry->pos;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user