Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't pass the EBML ID length anymore #169

Merged
merged 3 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions matroska/KaxDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ class MATROSKA_DLL_API MatroskaProfile : public libebml::EbmlDocVersion

#define DEFINE_MKX_CONTEXT(a) DEFINE_xxx_CONTEXT(a,GetKaxGlobal_Context)

#define DEFINE_MKX_MASTER_CONS(a,b,c,d,i,e,versions) DEFINE_xxx_MASTER_CONS(a,b,c,d,i,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER(a,b,c,d,i,e,versions) DEFINE_xxx_MASTER(a,b,c,d,i,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER_ORPHAN(a,b,c,i,d,versions) DEFINE_xxx_MASTER_ORPHAN(a,b,c,i,d,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_UINTEGER_DEF(a,b,c,d,e,versions,v) DEFINE_xxx_UINTEGER_DEF(a,b,c,d,e,versions,GetKaxGlobal_Context,v)
#define DEFINE_MKX_SINTEGER_DEF(a,b,c,d,e,versions,v) DEFINE_xxx_SINTEGER_DEF(a,b,c,d,e,versions,GetKaxGlobal_Context,v)
#define DEFINE_MKX_UINTEGER(a,b,c,d,e,versions) DEFINE_xxx_UINTEGER(a,b,c,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_SINTEGER(a,b,c,d,e,versions) DEFINE_xxx_SINTEGER(a,b,c,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_STRING_DEF(a,b,c,d,e,versions,v) DEFINE_xxx_STRING_DEF(a,b,c,d,e,versions,GetKaxGlobal_Context,v)
#define DEFINE_MKX_STRING(a,b,c,d,e,versions) DEFINE_xxx_STRING(a,b,c,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_UNISTRING(a,b,c,d,e,versions) DEFINE_xxx_UNISTRING(a,b,c,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_BINARY(a,b,c,d,e,versions) DEFINE_xxx_BINARY(a,b,c,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_FLOAT_DEF(a,b,c,d,e,versions,v) DEFINE_xxx_FLOAT_DEF(a,b,c,d,e,versions,GetKaxGlobal_Context,v)
#define DEFINE_MKX_FLOAT(a,b,c,d,e,versions) DEFINE_xxx_FLOAT(a,b,c,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_DATE(a,b,c,d,e,versions) DEFINE_xxx_DATE(a,b,c,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_BINARY_CONS(a,b,c,d,e,versions) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context) \
#define DEFINE_MKX_MASTER_CONS(a,b,d,i,e,versions) DEFINE_xxx_MASTER_CONS(a,b,d,i,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER(a,b,d,i,e,versions) DEFINE_xxx_MASTER(a,b,d,i,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER_ORPHAN(a,b,i,d,versions) DEFINE_xxx_MASTER_ORPHAN(a,b,i,d,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_UINTEGER_DEF(a,b,d,e,versions,v) DEFINE_xxx_UINTEGER_DEF(a,b,d,e,versions,GetKaxGlobal_Context,v)
#define DEFINE_MKX_SINTEGER_DEF(a,b,d,e,versions,v) DEFINE_xxx_SINTEGER_DEF(a,b,d,e,versions,GetKaxGlobal_Context,v)
#define DEFINE_MKX_UINTEGER(a,b,d,e,versions) DEFINE_xxx_UINTEGER(a,b,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_SINTEGER(a,b,d,e,versions) DEFINE_xxx_SINTEGER(a,b,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_STRING_DEF(a,b,d,e,versions,v) DEFINE_xxx_STRING_DEF(a,b,d,e,versions,GetKaxGlobal_Context,v)
#define DEFINE_MKX_STRING(a,b,d,e,versions) DEFINE_xxx_STRING(a,b,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_UNISTRING(a,b,d,e,versions) DEFINE_xxx_UNISTRING(a,b,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_BINARY(a,b,d,e,versions) DEFINE_xxx_BINARY(a,b,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_FLOAT_DEF(a,b,d,e,versions,v) DEFINE_xxx_FLOAT_DEF(a,b,d,e,versions,GetKaxGlobal_Context,v)
#define DEFINE_MKX_FLOAT(a,b,d,e,versions) DEFINE_xxx_FLOAT(a,b,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_DATE(a,b,d,e,versions) DEFINE_xxx_DATE(a,b,d,e,versions,GetKaxGlobal_Context)
#define DEFINE_MKX_BINARY_CONS(a,b,d,e,versions) DEFINE_xxx_CLASS_CONS(a,b,d,e,GetKaxGlobal_Context) \
const libebml::EbmlCallbacks a::ClassInfos(a::Create, Id_##a, false, e, Context_##a, versions);
#define DEFINE_MKX_SINTEGER_CONS(a,b,c,d,e,versions) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context) \
#define DEFINE_MKX_SINTEGER_CONS(a,b,d,e,versions) DEFINE_xxx_CLASS_CONS(a,b,d,e,GetKaxGlobal_Context) \
const libebml::EbmlCallbacksDefault<std::int64_t> a::ClassInfos(a::Create, Id_##a, e, Context_##a, versions);

#define MATROSKA_CLASS_BODY(x) \
Expand Down
6 changes: 3 additions & 3 deletions src/KaxBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender
if (mInvisible)
*cursor = 0x08;

if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) {
if ((const EbmlId&)(*this) == EBML_ID(KaxSimpleBlock)) {
auto *s = reinterpret_cast<const KaxSimpleBlock*>(this);
if (s->IsKeyframe())
*cursor |= 0x80;
Expand Down Expand Up @@ -517,7 +517,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
bLocalTimestampUsed = true;

const std::uint8_t Flags = Mem.GetUInt8();
if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) {
if ((const EbmlId&)(*this) == EBML_ID(KaxSimpleBlock)) {
auto *s = reinterpret_cast<KaxSimpleBlock*>(this);
s->SetKeyframe( (Flags & 0x80) != 0 );
s->SetDiscardable( (Flags & 0x01) != 0 );
Expand Down Expand Up @@ -643,7 +643,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
bLocalTimestampUsed = true;
cursor += 2;

if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) {
if ((const EbmlId&)(*this) == EBML_ID(KaxSimpleBlock)) {
auto *s = reinterpret_cast<KaxSimpleBlock*>(this);
s->SetKeyframe( (*cursor & 0x80) != 0 );
s->SetDiscardable( (*cursor & 0x01) != 0 );
Expand Down
8 changes: 4 additions & 4 deletions src/KaxSeekHead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ KaxSeek * KaxSeekHead::FindFirstOf(const EbmlCallbacks & Callbacks) const
{ return (EbmlId(*Elt) == EBML_ID(KaxSeekID)); });
if (it != aElt->end()) {
const auto aId = static_cast<KaxSeekID*>(*it);
const auto aEbmlId = EbmlId(aId->GetBuffer(), aId->GetSize());
const auto aEbmlId = EbmlId(EbmlId::FromBuffer(aId->GetBuffer(), aId->GetSize()));
if (aEbmlId == EBML_INFO_ID(Callbacks)) {
return aElt;
}
Expand Down Expand Up @@ -84,7 +84,7 @@ bool KaxSeek::IsEbmlId(const EbmlId & aId) const
auto _Id = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));
if (!_Id)
return false;
const auto aEbmlId = EbmlId(_Id->GetBuffer(), _Id->GetSize());
const auto aEbmlId = EbmlId(EbmlId::FromBuffer(_Id->GetBuffer(), _Id->GetSize()));
return (aId == aEbmlId);
}

Expand All @@ -96,8 +96,8 @@ bool KaxSeek::IsEbmlId(const KaxSeek & aPoint) const
auto _IdB = static_cast<KaxSeekID*>(aPoint.FindFirstElt(EBML_INFO(KaxSeekID)));
if (!_IdB)
return false;
const auto aEbmlIdA = EbmlId(_IdA->GetBuffer(), _IdA->GetSize());
const auto aEbmlIdB = EbmlId(_IdB->GetBuffer(), _IdB->GetSize());
const auto aEbmlIdA = EbmlId(EbmlId::FromBuffer(_IdA->GetBuffer(), _IdA->GetSize()));
const auto aEbmlIdB = EbmlId(EbmlId::FromBuffer(_IdB->GetBuffer(), _IdB->GetSize()));
return aEbmlIdA == aEbmlIdB;
}

Expand Down
Loading
Loading