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

Keep information about elements that can have an infinite size #128

Merged
merged 2 commits into from
Dec 23, 2023
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
8 changes: 5 additions & 3 deletions matroska/KaxBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ DECLARE_MKX_MASTER(KaxBlockGroup)

class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary {
public:
KaxInternalBlock(bool bSimple) :bIsSimple(bSimple)
KaxInternalBlock(const EbmlCallbacks & classInfo, bool bSimple)
:EbmlBinary(classInfo),
bIsSimple(bSimple)
{}
KaxInternalBlock(const KaxInternalBlock & ElementToClone);
~KaxInternalBlock() override;
Expand Down Expand Up @@ -267,13 +269,13 @@ class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary {

class MATROSKA_DLL_API KaxBlock : public KaxInternalBlock {
public:
KaxBlock() :KaxInternalBlock(false) {}
KaxBlock() :KaxInternalBlock(KaxBlock::ClassInfos, false) {}
EBML_CONCRETE_CLASS(KaxBlock)
};

class MATROSKA_DLL_API KaxSimpleBlock : public KaxInternalBlock {
public:
KaxSimpleBlock() :KaxInternalBlock(true) {}
KaxSimpleBlock() :KaxInternalBlock(KaxSimpleBlock::ClassInfos, true) {}

void SetKeyframe(bool b_keyframe) { bIsKeyframe = b_keyframe; }
void SetDiscardable(bool b_discard) { bIsDiscardable = b_discard; }
Expand Down
27 changes: 17 additions & 10 deletions matroska/KaxDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,27 @@
#include <ebml/EbmlElement.h>

#define DEFINE_MKX_CONTEXT(a) DEFINE_xxx_CONTEXT(a,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER_CONS(a,b,c,d,e) DEFINE_xxx_MASTER_CONS(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER(a,b,c,d,e) DEFINE_xxx_MASTER(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER_ORPHAN(a,b,c,d) DEFINE_xxx_MASTER_ORPHAN(a,b,c,d,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER_CONS(a,b,c,d,i,e) DEFINE_xxx_MASTER_CONS(a,b,c,d,i,e,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER(a,b,c,d,i,e) DEFINE_xxx_MASTER(a,b,c,d,i,e,GetKaxGlobal_Context)
#define DEFINE_MKX_MASTER_ORPHAN(a,b,c,i,d) DEFINE_xxx_MASTER_ORPHAN(a,b,c,i,d,GetKaxGlobal_Context)
#define DEFINE_MKX_UINTEGER_DEF(a,b,c,d,e,v) DEFINE_xxx_UINTEGER_DEF(a,b,c,d,e,GetKaxGlobal_Context,v)
#define DEFINE_MKX_SINTEGER_DEF(a,b,c,d,e,v) DEFINE_xxx_SINTEGER_DEF(a,b,c,d,e,GetKaxGlobal_Context,v)
#define DEFINE_MKX_UINTEGER(a,b,c,d,e) DEFINE_xxx_CLASS(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_SINTEGER(a,b,c,d,e) DEFINE_xxx_CLASS(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_UINTEGER(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context) \
a::a() :EbmlUInteger(a::ClassInfos) {}
#define DEFINE_MKX_SINTEGER(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context) \
a::a() :EbmlSInteger(a::ClassInfos) {}
#define DEFINE_MKX_STRING_DEF(a,b,c,d,e,v) DEFINE_xxx_STRING_DEF(a,b,c,d,e,GetKaxGlobal_Context,v)
#define DEFINE_MKX_STRING(a,b,c,d,e) DEFINE_xxx_CLASS(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_UNISTRING(a,b,c,d,e) DEFINE_xxx_CLASS(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_BINARY(a,b,c,d,e) DEFINE_xxx_CLASS(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_STRING(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context) \
a::a() :EbmlString(a::ClassInfos) {}
#define DEFINE_MKX_UNISTRING(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context) \
a::a() :EbmlUnicodeString(a::ClassInfos) {}
#define DEFINE_MKX_BINARY(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context) \
a::a() :EbmlBinary(a::ClassInfos) {}
#define DEFINE_MKX_FLOAT_DEF(a,b,c,d,e,v) DEFINE_xxx_FLOAT_DEF(a,b,c,d,e,GetKaxGlobal_Context,v)
#define DEFINE_MKX_FLOAT(a,b,c,d,e) DEFINE_xxx_CLASS(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_DATE(a,b,c,d,e) DEFINE_xxx_CLASS(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_FLOAT(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context) \
a::a() :EbmlFloat(a::ClassInfos) {}
#define DEFINE_MKX_DATE(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context) \
a::a() :EbmlDate(a::ClassInfos) {}
#define DEFINE_MKX_BINARY_CONS(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context)
#define DEFINE_MKX_SINTEGER_CONS(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context)

Expand Down
2 changes: 1 addition & 1 deletion src/KaxAttached.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace libebml;
namespace libmatroska {

KaxAttached::KaxAttached()
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttached))
:EbmlMaster(KaxAttached::ClassInfos, EBML_CLASS_SEMCONTEXT(KaxAttached))
{
SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko)
}
Expand Down
2 changes: 1 addition & 1 deletion src/KaxAttachments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using namespace libebml;
namespace libmatroska {

KaxAttachments::KaxAttachments()
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttachments))
:EbmlMaster(KaxAttachments::ClassInfos, EBML_CLASS_SEMCONTEXT(KaxAttachments))
{
SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko)
}
Expand Down
3 changes: 2 additions & 1 deletion src/KaxBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ KaxInternalBlock::KaxInternalBlock(const KaxInternalBlock & ElementToClone)
} */

KaxBlockGroup::KaxBlockGroup()
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxBlockGroup))
:EbmlMaster(KaxBlockGroup::ClassInfos, EBML_CLASS_SEMCONTEXT(KaxBlockGroup))
{}

static constexpr std::int64_t SignedVINT_Shift1 = (1 << ((7*1) - 1)) - 1;
Expand Down Expand Up @@ -268,6 +268,7 @@ KaxBlockVirtual::KaxBlockVirtual(const KaxBlockVirtual & ElementToClone)
}

KaxBlockVirtual::KaxBlockVirtual()
:EbmlBinary(KaxBlockVirtual::ClassInfos)
{
SetBuffer(DataBlock,sizeof(DataBlock));
SetValueIsSet(false);
Expand Down
1 change: 1 addition & 0 deletions src/KaxBlockData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const KaxBlockBlob & KaxReferenceBlock::RefBlock() const
}

KaxReferenceBlock::KaxReferenceBlock()
:EbmlSInteger(KaxReferenceBlock::ClassInfos)
{
bTimecodeSet = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/KaxCluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace libmatroska {

KaxCluster::KaxCluster()
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxCluster))
:EbmlMaster(KaxCluster::ClassInfos, EBML_CLASS_SEMCONTEXT(KaxCluster))
{}

KaxCluster::KaxCluster(const KaxCluster & ElementToClone)
Expand Down
2 changes: 1 addition & 1 deletion src/KaxSegment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
namespace libmatroska {

KaxSegment::KaxSegment()
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxSegment))
:EbmlMaster(KaxSegment::ClassInfos, EBML_CLASS_SEMCONTEXT(KaxSegment))
{
SetSizeLength(5); // mandatory min size support (for easier updating) (2^(7*5)-2 = 32Go)
SetSizeInfinite(); // by default a segment is big and the size is unknown in advance
Expand Down
Loading