From 4c35c275489166e3ebec27816758804729484ba2 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Tue, 19 Dec 2023 08:09:56 +0100 Subject: [PATCH] Switch to the ShouldWrite API to select which elements to write --- matroska/KaxBlock.h | 8 ++-- matroska/KaxBlockData.h | 2 +- matroska/KaxCluster.h | 2 +- matroska/KaxCues.h | 4 +- matroska/KaxSemantic.h | 90 ++++++++++++++++++++--------------------- src/KaxBlock.cpp | 6 +-- src/KaxBlockData.cpp | 4 +- src/KaxCluster.cpp | 6 +-- src/KaxSemantic.cpp | 90 ++++++++++++++++++++--------------------- test/mux/test6.cpp | 4 +- 10 files changed, 108 insertions(+), 108 deletions(-) diff --git a/matroska/KaxBlock.h b/matroska/KaxBlock.h index 25a60074..1d594cbf 100644 --- a/matroska/KaxBlock.h +++ b/matroska/KaxBlock.h @@ -198,7 +198,7 @@ class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary { /*! \note override this function to generate the Data/Size on the fly, unlike the usual binary elements */ - filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false) override; + filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override; filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override; /*! @@ -264,7 +264,7 @@ class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary { bool bIsKeyframe{true}; bool bIsDiscardable{false}; - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault = false) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter = WriteSkipDefault) override; }; class MATROSKA_DLL_API KaxBlock : public KaxInternalBlock { @@ -334,11 +334,11 @@ DECLARE_MKX_BINARY_CONS(KaxBlockVirtual) /*! \note override this function to generate the Data/Size on the fly, unlike the usual binary elements */ - filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false) override; + filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override; void SetParent(const KaxCluster & aParentCluster) {ParentCluster = &aParentCluster;} - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override; diff --git a/matroska/KaxBlockData.h b/matroska/KaxBlockData.h index 6a16933d..96d5a8ba 100644 --- a/matroska/KaxBlockData.h +++ b/matroska/KaxBlockData.h @@ -28,7 +28,7 @@ DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock) /*! \brief override this method to compute the timecode value */ - filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false) override; + filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override; const KaxBlockBlob & RefBlock() const; void SetReferencedBlock(const KaxBlockBlob * aRefdBlock); diff --git a/matroska/KaxCluster.h b/matroska/KaxCluster.h index b004e20e..6e252518 100644 --- a/matroska/KaxCluster.h +++ b/matroska/KaxCluster.h @@ -48,7 +48,7 @@ DECLARE_MKX_MASTER_CONS(KaxCluster) /*! \brief Render the data to the stream and retrieve the position of BlockGroups for later cue entries */ - filepos_t Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault = false); + filepos_t Render(IOCallback & output, KaxCues & CueToUpdate, ShouldWrite writeFilter = WriteSkipDefault); /*! \return the global timecode of this Cluster diff --git a/matroska/KaxCues.h b/matroska/KaxCues.h index b9dbbbd6..6dcfb952 100644 --- a/matroska/KaxCues.h +++ b/matroska/KaxCues.h @@ -36,9 +36,9 @@ DECLARE_MKX_MASTER(KaxCues) /*! \brief override to sort by timecode/track */ - filepos_t Render(IOCallback & output, bool bSaveDefault = false) { + filepos_t Render(IOCallback & output, ShouldWrite writeFilter = WriteSkipDefault) { Sort(); - return EbmlMaster::Render(output, bSaveDefault); + return EbmlMaster::Render(output, writeFilter); } std::uint64_t GetTimecodePosition(std::uint64_t aTimecode) const; diff --git a/matroska/KaxSemantic.h b/matroska/KaxSemantic.h index 97c76e70..1c0d532a 100644 --- a/matroska/KaxSemantic.h +++ b/matroska/KaxSemantic.h @@ -99,12 +99,12 @@ DECLARE_MKX_UINTEGER(KaxClusterTimecode) DECLARE_MKX_MASTER(KaxClusterSilentTracks) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxClusterSilentTrackNumber) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxClusterPosition) @@ -133,7 +133,7 @@ DECLARE_MKX_UINTEGER(KaxReferencePriority) DECLARE_MKX_SINTEGER(KaxReferenceVirtual) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_BINARY (KaxCodecState) @@ -144,57 +144,57 @@ DECLARE_MKX_SINTEGER(KaxDiscardPadding) DECLARE_MKX_MASTER(KaxSlices) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_MASTER(KaxTimeSlice) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxSliceLaceNumber) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxSliceFrameNumber) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxSliceBlockAddID) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxSliceDelay) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxSliceDuration) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_MASTER(KaxReferenceFrame) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxReferenceOffset) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxReferenceTimeCode) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_BINARY (KaxEncryptedBlock) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_MASTER(KaxTracks) @@ -238,12 +238,12 @@ DECLARE_MKX_UINTEGER(KaxTrackFlagLacing) DECLARE_MKX_UINTEGER(KaxTrackMinCache) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxTrackMaxCache) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxTrackDefaultDuration) @@ -254,12 +254,12 @@ DECLARE_MKX_UINTEGER(KaxTrackDefaultDecodedFieldDuration) DECLARE_MKX_FLOAT(KaxTrackTimecodeScale) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_SINTEGER(KaxTrackOffset) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxMaxBlockAdditionID) @@ -300,27 +300,27 @@ DECLARE_MKX_UNISTRING(KaxCodecName) DECLARE_MKX_UINTEGER(KaxTrackAttachmentLink) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UNISTRING(KaxCodecSettings) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_STRING(KaxCodecInfoURL) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_STRING(KaxCodecDownloadURL) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxCodecDecodeAll) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxTrackOverlay) @@ -361,7 +361,7 @@ DECLARE_MKX_UINTEGER(KaxVideoAlphaMode) DECLARE_MKX_UINTEGER(KaxOldStereoMode) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxVideoPixelWidth) @@ -393,7 +393,7 @@ DECLARE_MKX_UINTEGER(KaxVideoDisplayUnit) DECLARE_MKX_UINTEGER(KaxVideoAspectRatio) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_BINARY (KaxVideoColourSpace) @@ -403,12 +403,12 @@ DECLARE_MKX_BINARY (KaxVideoColourSpace) DECLARE_MKX_FLOAT(KaxVideoGamma) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_FLOAT(KaxVideoFrameRate) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_MASTER(KaxVideoColour) @@ -518,7 +518,7 @@ DECLARE_MKX_UINTEGER(KaxAudioChannels) DECLARE_MKX_BINARY (KaxAudioPosition) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxAudioBitDepth) @@ -550,28 +550,28 @@ DECLARE_MKX_UINTEGER(KaxTrackJoinUID) DECLARE_MKX_UINTEGER(KaxTrickTrackUID) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_BINARY (KaxTrickTrackSegmentUID) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; bool ValidateSize() const override {return IsFiniteSize() && GetSize() == 16;} }; DECLARE_MKX_UINTEGER(KaxTrickTrackFlag) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxTrickMasterTrackUID) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_BINARY (KaxTrickMasterTrackSegmentUID) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; bool ValidateSize() const override {return IsFiniteSize() && GetSize() == 16;} }; @@ -616,22 +616,22 @@ DECLARE_MKX_UINTEGER(KaxAESSettingsCipherMode) DECLARE_MKX_BINARY (KaxContentSignature) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_BINARY (KaxContentSigKeyID) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxContentSigAlgo) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxContentSigHashAlgo) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxCueTime) @@ -660,17 +660,17 @@ DECLARE_MKX_UINTEGER(KaxCueRefTime) DECLARE_MKX_UINTEGER(KaxCueRefCluster) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxCueRefNumber) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxCueRefCodecState) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_MASTER(KaxAttachments) @@ -696,17 +696,17 @@ DECLARE_MKX_UINTEGER(KaxFileUID) DECLARE_MKX_BINARY (KaxFileReferral) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxFileUsedStartTime) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UINTEGER(KaxFileUsedEndTime) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_MASTER(KaxChapters) @@ -854,7 +854,7 @@ DECLARE_MKX_UINTEGER(KaxTagDefault) DECLARE_MKX_UINTEGER(KaxTagDefaultBogus) public: - filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault) override; + filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override; }; DECLARE_MKX_UNISTRING(KaxTagString) @@ -1180,7 +1180,7 @@ typedef enum { *Indicate what type of content the ChapterAtom contains and might be skipped. It can be used to automatically skip content based on the type. If a `ChapterAtom` is inside a `ChapterAtom` that has a `ChapterSkipType` set, it **MUST NOT** have a `ChapterSkipType` or have a `ChapterSkipType` with the same value as it's parent `ChapterAtom`. If the `ChapterAtom` doesn't contain a `ChapterTimeEnd`, the value of the `ChapterSkipType` is only valid until the next `ChapterAtom` with a `ChapterSkipType` value or the end of the file. - + */ typedef enum { MATROSKA_CHAPTERSKIPTYPE_NO_SKIPPING = 0, // Content which should not be skipped. diff --git a/src/KaxBlock.cpp b/src/KaxBlock.cpp index 55dac54d..99f668b1 100644 --- a/src/KaxBlock.cpp +++ b/src/KaxBlock.cpp @@ -204,7 +204,7 @@ LacingType KaxInternalBlock::GetBestLacingType() const { return LACING_EBML; } -filepos_t KaxInternalBlock::UpdateSize(bool /* bSaveDefault */, bool /* bForceRender */) +filepos_t KaxInternalBlock::UpdateSize(ShouldWrite, bool /* bForceRender */) { LacingType LacingHere; assert(!EbmlBinary::GetBuffer()); // Data is not used for KaxInternalBlock @@ -280,7 +280,7 @@ KaxBlockVirtual::~KaxBlockVirtual() SetBuffer( nullptr, 0 ); } -filepos_t KaxBlockVirtual::UpdateSize(bool /* bSaveDefault */, bool /* bForceRender */) +filepos_t KaxBlockVirtual::UpdateSize(ShouldWrite, bool /* bForceRender */) { assert(TrackNumber < 0x4000); binary *cursor = EbmlBinary::GetBuffer(); @@ -308,7 +308,7 @@ filepos_t KaxBlockVirtual::UpdateSize(bool /* bSaveDefault */, bool /* bForceRen \todo more optimisation is possible (render the Block head and don't copy the buffer in memory, care should be taken with the allocation of Data) \todo the actual timecode to write should be retrieved from the Cluster from here */ -filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bSaveDefault */) +filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender */, ShouldWrite) { if (myBuffers.empty()) return 0; diff --git a/src/KaxBlockData.cpp b/src/KaxBlockData.cpp index 1645410c..0713c145 100644 --- a/src/KaxBlockData.cpp +++ b/src/KaxBlockData.cpp @@ -47,7 +47,7 @@ void KaxReferenceBlock::FreeBlob() RefdBlock = nullptr; } -filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender) +filepos_t KaxReferenceBlock::UpdateSize(ShouldWrite writeFilter, bool bForceRender) { if (!bTimecodeSet) { assert(RefdBlock); @@ -56,7 +56,7 @@ filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender) auto &block = static_cast(*RefdBlock); SetValue(static_cast(block.GlobalTimecode()) - static_cast(ParentBlock->GlobalTimecode()) / static_cast(ParentBlock->GlobalTimecodeScale())); } - return EbmlSInteger::UpdateSize(bSaveDefault, bForceRender); + return EbmlSInteger::UpdateSize(writeFilter, bForceRender); } void KaxReferenceBlock::SetReferencedBlock(const KaxBlockBlob * aRefdBlock) diff --git a/src/KaxCluster.cpp b/src/KaxCluster.cpp index 2746fcad..0b2b12ac 100644 --- a/src/KaxCluster.cpp +++ b/src/KaxCluster.cpp @@ -112,7 +112,7 @@ bool KaxCluster::AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, D /*! \todo only put the Blocks written in the cue entries */ -filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault) +filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, ShouldWrite writeFilter) { filepos_t Result = 0; @@ -144,7 +144,7 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS } } - Result = EbmlMaster::Render(output, bSaveDefault); + Result = EbmlMaster::Render(output, writeFilter); // For all Blocks add their position on the CueEntry for (const auto& element : GetElementList()) { @@ -182,7 +182,7 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS } } - Result = EbmlMaster::Render(output, bSaveDefault); + Result = EbmlMaster::Render(output, writeFilter); // For all Blocks add their position on the CueEntry for (const auto& blob : Blobs) diff --git a/src/KaxSemantic.cpp b/src/KaxSemantic.cpp index d79b8bbc..be94fceb 100644 --- a/src/KaxSemantic.cpp +++ b/src/KaxSemantic.cpp @@ -733,227 +733,227 @@ DEFINE_MKX_UINTEGER_DEF(KaxTagDefaultBogus, 0x44B4, 2, KaxTagSimple, "TagDefault DEFINE_MKX_UNISTRING(KaxTagString, 0x4487, 2, KaxTagSimple, "TagString") DEFINE_MKX_BINARY (KaxTagBinary, 0x4485, 2, KaxTagSimple, "TagBinary") -filepos_t KaxClusterSilentTracks::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxClusterSilentTracks::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxClusterSilentTrackNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxClusterSilentTrackNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxBlockVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxBlockVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxReferenceVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxReferenceVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxSlices::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxSlices::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTimeSlice::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTimeSlice::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxSliceLaceNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxSliceLaceNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxSliceFrameNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxSliceFrameNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxSliceBlockAddID::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxSliceBlockAddID::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxSliceDelay::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxSliceDelay::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxSliceDuration::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxSliceDuration::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxReferenceFrame::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxReferenceFrame::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxReferenceOffset::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxReferenceOffset::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxReferenceTimeCode::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxReferenceTimeCode::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxEncryptedBlock::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxEncryptedBlock::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrackMinCache::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrackMinCache::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrackMaxCache::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrackMaxCache::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrackTimecodeScale::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrackTimecodeScale::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrackOffset::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrackOffset::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrackAttachmentLink::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrackAttachmentLink::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxCodecSettings::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxCodecSettings::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxCodecInfoURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxCodecInfoURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxCodecDownloadURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxCodecDownloadURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxCodecDecodeAll::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxCodecDecodeAll::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxOldStereoMode::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxOldStereoMode::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxVideoAspectRatio::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxVideoAspectRatio::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxVideoGamma::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxVideoGamma::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxVideoFrameRate::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxVideoFrameRate::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxAudioPosition::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxAudioPosition::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrickTrackUID::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrickTrackUID::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrickTrackSegmentUID::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrickTrackSegmentUID::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrickTrackFlag::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrickTrackFlag::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrickMasterTrackUID::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrickMasterTrackUID::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTrickMasterTrackSegmentUID::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTrickMasterTrackSegmentUID::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxContentSignature::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxContentSignature::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxContentSigKeyID::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxContentSigKeyID::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxContentSigAlgo::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxContentSigAlgo::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxContentSigHashAlgo::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxContentSigHashAlgo::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxCueRefCluster::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxCueRefCluster::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxCueRefNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxCueRefNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxCueRefCodecState::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxCueRefCodecState::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxFileReferral::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxFileReferral::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxFileUsedStartTime::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxFileUsedStartTime::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxFileUsedEndTime::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxFileUsedEndTime::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } -filepos_t KaxTagDefaultBogus::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { +filepos_t KaxTagDefaultBogus::RenderData(IOCallback & /* output */, bool /* bForceRender */, ShouldWrite) { assert(false); // no you are not allowed to use this element ! return 0; } diff --git a/test/mux/test6.cpp b/test/mux/test6.cpp index 1732b697..1ed34776 100644 --- a/test/mux/test6.cpp +++ b/test/mux/test6.cpp @@ -34,7 +34,7 @@ const unsigned int BIN_FRAME_SIZE = 1500; const unsigned int TXT_FRAME_SIZE = 200; const std::uint64_t TIMECODE_SCALE = 1000000; -const bool bWriteDefaultValues = false; +const EbmlElement::ShouldWrite bWriteDefaultValues = EbmlElement::WriteSkipDefault; /*! The first file is a "binary" file with data scaling from 0x00 to 0xFF repeatedly @@ -330,7 +330,7 @@ int main(int argc, char **argv) MetaSeek.IndexThis(*pMyTracks2, FileSegment); // \todo put it just before the Cue Entries - filepos_t MetaSeekSize = Dummy.ReplaceWith(MetaSeek, out_file, bWriteDefaultValues); + filepos_t MetaSeekSize = Dummy.ReplaceWith(MetaSeek, out_file, true, bWriteDefaultValues); #ifdef VOID_TEST MyInfos.VoidMe(out_file);