diff --git a/matroska/KaxBlock.h b/matroska/KaxBlock.h index c05f93d2..6207397e 100644 --- a/matroska/KaxBlock.h +++ b/matroska/KaxBlock.h @@ -262,8 +262,6 @@ class MATROSKA_DLL_API KaxInternalBlock : public libebml::EbmlBinary { KaxCluster *ParentCluster{nullptr}; bool bIsSimple; - bool bIsKeyframe{true}; - bool bIsDiscardable{false}; libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter = WriteSkipDefault) override; }; @@ -272,13 +270,15 @@ class MATROSKA_DLL_API KaxBlock : public KaxInternalBlock { private: static const libebml::EbmlCallbacks ClassInfos; public: - KaxBlock() :KaxInternalBlock(KaxBlock::ClassInfos, false) {} + KaxBlock() :KaxInternalBlock(KaxBlock::ClassInfos) {} MATROSKA_CLASS_BODY(KaxBlock) }; class MATROSKA_DLL_API KaxSimpleBlock : public KaxInternalBlock { private: static const libebml::EbmlCallbacks ClassInfos; + bool bIsKeyframe{true}; + bool bIsDiscardable{false}; public: KaxSimpleBlock() :KaxInternalBlock(KaxSimpleBlock::ClassInfos, true) {} diff --git a/src/KaxBlock.cpp b/src/KaxBlock.cpp index 2753471b..797adb36 100644 --- a/src/KaxBlock.cpp +++ b/src/KaxBlock.cpp @@ -350,9 +350,10 @@ filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender *cursor = 0x08; if (bIsSimple) { - if (bIsKeyframe) + auto *s = reinterpret_cast(this); + if (s->IsKeyframe()) *cursor |= 0x80; - if (bIsDiscardable) + if (s->IsDiscardable()) *cursor |= 0x01; } @@ -517,8 +518,9 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) const std::uint8_t Flags = Mem.GetUInt8(); if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) { - bIsKeyframe = (Flags & 0x80) != 0; - bIsDiscardable = (Flags & 0x01) != 0; + auto *s = reinterpret_cast(this); + s->SetKeyframe( (Flags & 0x80) != 0 ); + s->SetDiscardable( (Flags & 0x01) != 0 ); } mInvisible = (Flags & 0x08) >> 3; mLacing = static_cast((Flags & 0x06) >> 1); @@ -642,8 +644,9 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) cursor += 2; if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) { - bIsKeyframe = (*cursor & 0x80) != 0; - bIsDiscardable = (*cursor & 0x01) != 0; + auto *s = reinterpret_cast(this); + s->SetKeyframe( (*cursor & 0x80) != 0 ); + s->SetDiscardable( (*cursor & 0x01) != 0 ); } mInvisible = (*cursor & 0x08) >> 3; mLacing = static_cast((*cursor++ & 0x06) >> 1);