Skip to content

Commit

Permalink
pass ShouldWrite by const reference
Browse files Browse the repository at this point in the history
  • Loading branch information
robUx4 committed Jan 28, 2024
1 parent 7019226 commit 8b5bb73
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 100 deletions.
8 changes: 4 additions & 4 deletions matroska/KaxBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class MATROSKA_DLL_API KaxInternalBlock : public libebml::EbmlBinary {
/*!
\note override this function to generate the Data/Size on the fly, unlike the usual binary elements
*/
libebml::filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;
libebml::filepos_t UpdateSize(const ShouldWrite & writeFilter = WriteSkipDefault, bool bForceRender = false) override;
libebml::filepos_t ReadData(libebml::IOCallback & input, libebml::ScopeMode ReadFully = libebml::SCOPE_ALL_DATA) override;

/*!
Expand Down Expand Up @@ -266,7 +266,7 @@ class MATROSKA_DLL_API KaxInternalBlock : public libebml::EbmlBinary {

KaxCluster *ParentCluster{nullptr};

libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter = WriteSkipDefault) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
};

class MATROSKA_DLL_API KaxBlock : public KaxInternalBlock {
Expand Down Expand Up @@ -342,11 +342,11 @@ DECLARE_MKX_BINARY_CONS(KaxBlockVirtual)
/*!
\note override this function to generate the Data/Size on the fly, unlike the usual binary elements
*/
libebml::filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;
libebml::filepos_t UpdateSize(const ShouldWrite & writeFilter = WriteSkipDefault, bool bForceRender = false) override;

void SetParent(const KaxCluster & aParentCluster) {ParentCluster = &aParentCluster;}

libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;

libebml::filepos_t ReadData(libebml::IOCallback & input, libebml::ScopeMode ReadFully = libebml::SCOPE_ALL_DATA) override;

Expand Down
2 changes: 1 addition & 1 deletion matroska/KaxBlockData.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock)
/*!
\brief override this method to compute the timestamp value
*/
libebml::filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;
libebml::filepos_t UpdateSize(const ShouldWrite & writeFilter = WriteSkipDefault, bool bForceRender = false) override;

const KaxBlockBlob & RefBlock() const;
void SetReferencedBlock(const KaxBlockBlob * aRefdBlock);
Expand Down
90 changes: 45 additions & 45 deletions matroska/KaxSemantic.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ DECLARE_MKX_UINTEGER(KaxClusterTimestamp)

DECLARE_MKX_MASTER(KaxClusterSilentTracks)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxClusterSilentTrackNumber)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxClusterPosition)
Expand Down Expand Up @@ -121,7 +121,7 @@ DECLARE_MKX_UINTEGER_DEF(KaxReferencePriority)

DECLARE_MKX_SINTEGER(KaxReferenceVirtual)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_BINARY(KaxCodecState)
Expand All @@ -132,57 +132,57 @@ DECLARE_MKX_SINTEGER(KaxDiscardPadding)

DECLARE_MKX_MASTER(KaxSlices)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_MASTER(KaxTimeSlice)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxSliceLaceNumber)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxSliceFrameNumber)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxSliceBlockAddID)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxSliceDelay)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxSliceDuration)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_MASTER(KaxReferenceFrame)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxReferenceOffset)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxReferenceTimestamp)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_BINARY(KaxEncryptedBlock)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_MASTER(KaxTracks)
Expand Down Expand Up @@ -226,12 +226,12 @@ DECLARE_MKX_UINTEGER_DEF(KaxTrackFlagLacing)

DECLARE_MKX_UINTEGER_DEF(KaxTrackMinCache)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxTrackMaxCache)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxTrackDefaultDuration)
Expand All @@ -242,12 +242,12 @@ DECLARE_MKX_UINTEGER(KaxTrackDefaultDecodedFieldDuration)

DECLARE_MKX_FLOAT_DEF(KaxTrackTimestampScale)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_SINTEGER_DEF(KaxTrackOffset)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxMaxBlockAdditionID)
Expand Down Expand Up @@ -288,32 +288,32 @@ DECLARE_MKX_UNISTRING(KaxCodecName)

DECLARE_MKX_UINTEGER(KaxTrackAttachmentLink)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UNISTRING(KaxCodecSettings)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_STRING(KaxCodecInfoURL)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_STRING(KaxCodecDownloadURL)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxCodecDecodeAll)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxTrackOverlay)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxCodecDelay)
Expand Down Expand Up @@ -351,7 +351,7 @@ DECLARE_MKX_UINTEGER_DEF(KaxVideoAlphaMode)

DECLARE_MKX_UINTEGER(KaxOldStereoMode)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxVideoPixelWidth)
Expand Down Expand Up @@ -383,20 +383,20 @@ DECLARE_MKX_UINTEGER_DEF(KaxVideoDisplayUnit)

DECLARE_MKX_UINTEGER_DEF(KaxVideoAspectRatio)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_BINARY_LENGTH(KaxVideoColourSpace, 4)
};

DECLARE_MKX_FLOAT(KaxVideoGamma)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_FLOAT(KaxVideoFrameRate)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_MASTER(KaxVideoColour)
Expand Down Expand Up @@ -506,7 +506,7 @@ DECLARE_MKX_UINTEGER_DEF(KaxAudioChannels)

DECLARE_MKX_BINARY(KaxAudioPosition)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxAudioBitDepth)
Expand Down Expand Up @@ -538,27 +538,27 @@ DECLARE_MKX_UINTEGER(KaxTrackJoinUID)

DECLARE_MKX_UINTEGER(KaxTrickTrackUID)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_BINARY_LENGTH(KaxTrickTrackSegmentUID, 16)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxTrickTrackFlag)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxTrickMasterTrackUID)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_BINARY_LENGTH(KaxTrickMasterTrackSegmentUID, 16)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_MASTER(KaxContentEncodings)
Expand Down Expand Up @@ -602,22 +602,22 @@ DECLARE_MKX_UINTEGER(KaxAESSettingsCipherMode)

DECLARE_MKX_BINARY(KaxContentSignature)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_BINARY(KaxContentSigKeyID)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxContentSigAlgo)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxContentSigHashAlgo)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxCueTime)
Expand Down Expand Up @@ -646,17 +646,17 @@ DECLARE_MKX_UINTEGER(KaxCueRefTime)

DECLARE_MKX_UINTEGER(KaxCueRefCluster)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxCueRefNumber)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER_DEF(KaxCueRefCodecState)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_MASTER(KaxAttachments)
Expand All @@ -682,17 +682,17 @@ DECLARE_MKX_UINTEGER(KaxFileUID)

DECLARE_MKX_BINARY(KaxFileReferral)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxFileUsedStartTime)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UINTEGER(KaxFileUsedEndTime)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_MASTER(KaxChapters)
Expand Down Expand Up @@ -838,7 +838,7 @@ DECLARE_MKX_UINTEGER_DEF(KaxTagDefault)

DECLARE_MKX_UINTEGER_DEF(KaxTagDefaultBogus)
public:
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override;
};

DECLARE_MKX_UNISTRING(KaxTagString)
Expand Down
6 changes: 3 additions & 3 deletions src/KaxBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ LacingType KaxInternalBlock::GetBestLacingType() const {
return LACING_EBML;
}

filepos_t KaxInternalBlock::UpdateSize(ShouldWrite, bool /* bForceRender */)
filepos_t KaxInternalBlock::UpdateSize(const ShouldWrite &, bool /* bForceRender */)
{
LacingType LacingHere;
assert(!EbmlBinary::GetBuffer()); // Data is not used for KaxInternalBlock
Expand Down Expand Up @@ -277,7 +277,7 @@ KaxBlockVirtual::~KaxBlockVirtual()
SetBuffer( nullptr, 0 );
}

filepos_t KaxBlockVirtual::UpdateSize(ShouldWrite, bool /* bForceRender */)
filepos_t KaxBlockVirtual::UpdateSize(const ShouldWrite &, bool /* bForceRender */)
{
assert(TrackNumber < 0x4000);
binary *cursor = EbmlBinary::GetBuffer();
Expand Down Expand Up @@ -305,7 +305,7 @@ filepos_t KaxBlockVirtual::UpdateSize(ShouldWrite, bool /* bForceRender */)
\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 timestamp to write should be retrieved from the Cluster from here
*/
filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender */, ShouldWrite)
filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender */, const ShouldWrite &)
{
if (myBuffers.empty())
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/KaxBlockData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void KaxReferenceBlock::FreeBlob()
RefdBlock = nullptr;
}

filepos_t KaxReferenceBlock::UpdateSize(ShouldWrite writeFilter, bool bForceRender)
filepos_t KaxReferenceBlock::UpdateSize(const ShouldWrite & writeFilter, bool bForceRender)
{
if (!bTimestampSet) {
assert(RefdBlock);
Expand Down
Loading

0 comments on commit 8b5bb73

Please sign in to comment.