From 89b10f0f5a3070e764e820b80694736430487e7d Mon Sep 17 00:00:00 2001 From: Jerome Martinez Date: Wed, 5 Jun 2024 23:15:23 +0200 Subject: [PATCH] Fix Decklink simulator extra frames --- Source/Common/SimulatorWrapper.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/Common/SimulatorWrapper.cpp b/Source/Common/SimulatorWrapper.cpp index 27e288c8..8eebdac1 100644 --- a/Source/Common/SimulatorWrapper.cpp +++ b/Source/Common/SimulatorWrapper.cpp @@ -50,6 +50,7 @@ struct ctl size_t Buffer_Offset; size_t CurrentClusterPos = 0; size_t NextClusterPos = 0; + bool FrameAvailable = false; // MKV info size_t Track_Pos = 0; @@ -255,8 +256,12 @@ bool ctl::ParseBuffer(File& F) F.Read(Buffer + Buffer_Size - Buffer_Offset, ToRead); Buffer_Offset = 0; } + } - return false; // New cluster + if (FrameAvailable) + { + FrameAvailable = false; + return false; } } @@ -274,6 +279,9 @@ void ctl::Segment_Cluster() { IsList = true; + if (!CurrentClusterPos) + FrameAvailable = true; // First cluster detected, we will return now because we are in the init part + CurrentClusterPos = Buffer_Offset; NextClusterPos = Levels[Level].Offset_End; Track_Pos = (size_t)-1; @@ -296,6 +304,7 @@ void ctl::Segment_Cluster_SimpleBlock() { Track_Pos++; Buffer_Offset += 4; + FrameAvailable = true; auto Size = Levels[Level].Offset_End - Buffer_Offset;