diff --git a/skyscraper8/GS/GSE-BFBS/BfbsGseReader.cs b/skyscraper8/GS/GSE-BFBS/BfbsGseReader.cs index d201240..0405003 100644 --- a/skyscraper8/GS/GSE-BFBS/BfbsGseReader.cs +++ b/skyscraper8/GS/GSE-BFBS/BfbsGseReader.cs @@ -17,6 +17,7 @@ namespace skyscraper8.GS.GSE_BFBS private readonly ISubTsHandler _subTsHandler; private GseLabel lastLabel; + private int frameNo; public BfbsGseReader(byte misId, ISubTsHandler subTsHandler) { @@ -26,6 +27,7 @@ namespace skyscraper8.GS.GSE_BFBS public void PushFrame(BBHeader bbHeader, ReadOnlySpan readOnlySpan) { + frameNo++; bool validCrc = DvbCrc32.ValidateCrc(readOnlySpan); if (!validCrc) return; @@ -36,7 +38,7 @@ namespace skyscraper8.GS.GSE_BFBS StreamlikeSpan span = new StreamlikeSpan(readOnlySpan); - while (span.GetAvailableBytes() >= 1) + while (span.GetAvailableBytes() > 4) { byte byteA = span.ReadUInt8(); bool startIndicator = (byteA & 0x80) != 0; @@ -97,21 +99,20 @@ namespace skyscraper8.GS.GSE_BFBS ReadOnlySpan gseDataBytes = span.ReadBytes(gseLength); + uint? crc32 = null; if (!startIndicator && endIndicator) { - uint crc32 = span.ReadUInt32BE(); - throw new NotImplementedException("crc32"); + crc32 = span.ReadUInt32BE(); } - HandleGseFrame(startIndicator, endIndicator, fragId, totalLength, label, protocolType, - gseDataBytes); + HandleGseFrame(startIndicator, endIndicator, fragId, totalLength, label, protocolType, gseDataBytes, crc32); } } } - private void HandleGseFrame(bool startIndicator, bool endIndicator, byte? fragId, ushort? totalLength, GseLabel label, ushort? protocolType, ReadOnlySpan gseDataBytes) + private void HandleGseFrame(bool startIndicator, bool endIndicator, byte? fragId, ushort? totalLength, GseLabel label, ushort? protocolType, ReadOnlySpan gseDataBytes, uint? crc32) { - throw new NotImplementedException(); + //throw new NotImplementedException(); } } }