diff --git a/skyscraper8.sln.DotSettings.user b/skyscraper8.sln.DotSettings.user index c34a7c8..b6ef203 100644 --- a/skyscraper8.sln.DotSettings.user +++ b/skyscraper8.sln.DotSettings.user @@ -11,12 +11,12 @@ ForceIncluded ForceIncluded /home/schiemas/.cache/JetBrains/Rider2025.1/resharper-host/temp/Rider/vAny/CoverageData/_skyscraper8.1808907683/Snapshot/snapshot.utdcvr - <SessionState ContinuousTestingMode="0" IsActive="True" Name="CheckBfbsCrc #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <Solution /> + <SessionState ContinuousTestingMode="0" IsActive="True" Name="CheckBfbsCrc #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <Solution /> </SessionState> - <SessionState ContinuousTestingMode="0" Name="CheckBfbsCrc" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <TestAncestor> - <TestId>xUnit::84EE9FCD-2C7F-DF84-C1BA-99D018CE9412::net8.0::skyscraper8.Tests.GsType1SanityTest.CheckBfbsCrc</TestId> - </TestAncestor> + <SessionState ContinuousTestingMode="0" Name="CheckBfbsCrc" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <TestAncestor> + <TestId>xUnit::84EE9FCD-2C7F-DF84-C1BA-99D018CE9412::net8.0::skyscraper8.Tests.GsType1SanityTest.CheckBfbsCrc</TestId> + </TestAncestor> </SessionState> <data><HostParameters type="LocalHostParameters" /><Argument type="StandaloneArgument"><Arguments IsNull="False"></Arguments><FileName IsNull="False"></FileName><WorkingDirectory IsNull="False"></WorkingDirectory><Scope><ProcessFilters /></Scope></Argument><Info type="TimelineInfo" /><CoreOptions type="CoreOptions"><CoreTempPath IsNull="False"></CoreTempPath><RemoteEndPoint IsNull="False"></RemoteEndPoint><AdditionalEnvironmentVariables /></CoreOptions><HostOptions type="HostOptions"><HostTempPath IsNull="False"></HostTempPath></HostOptions></data> \ No newline at end of file diff --git a/skyscraper8/GS/GSE-BFBS/BfbsGseReader.cs b/skyscraper8/GS/GSE-BFBS/BfbsGseReader.cs new file mode 100644 index 0000000..a97c094 --- /dev/null +++ b/skyscraper8/GS/GSE-BFBS/BfbsGseReader.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using skyscraper5.Mpeg2; +using skyscraper8.GSE; +using skyscraper8.Skyscraper.IO; +using skyscraper8.Skyscraper.Scraper; + +namespace skyscraper8.GS.GSE_BFBS +{ + internal class BfbsGseReader : IMisHandler + { + private readonly byte _misId; + private readonly ISubTsHandler _subTsHandler; + + public BfbsGseReader(byte misId, ISubTsHandler subTsHandler) + { + _misId = misId; + _subTsHandler = subTsHandler; + } + + public void PushFrame(BBHeader bbHeader, ReadOnlySpan readOnlySpan) + { + bool validCrc = DvbCrc32.ValidateCrc(readOnlySpan); + if (!validCrc) + return; + + if (readOnlySpan[0] == 0 && readOnlySpan[1] == 0 && readOnlySpan[2] == 0 && readOnlySpan[3] == 0) + return; + + + StreamlikeSpan span = new StreamlikeSpan(readOnlySpan); + throw new NotImplementedException(); + } + } +} diff --git a/skyscraper8/GS/GsTypeDetector.cs b/skyscraper8/GS/GsTypeDetector.cs index 900af8c..4db7f7a 100644 --- a/skyscraper8/GS/GsTypeDetector.cs +++ b/skyscraper8/GS/GsTypeDetector.cs @@ -1,5 +1,6 @@ using log4net; using skyscraper5.Dvb.DataBroadcasting; +using skyscraper8.GS.GSE_BFBS; using skyscraper8.GS.SiminnRadiomidun; using skyscraper8.GSE.GSE_HEM; using skyscraper8.GSE.GSE; @@ -23,7 +24,9 @@ public class GsTypeDetector : IMisHandler private GseReader gseReader; private GseHemReader gseHemReader; private SiminnRadiomidunReader siminnRadiomidunReader; + private BfbsGseReader bfbsGseReader; private int simminRadiomidunScore; + private int bfbsScore; public void PushFrame(BBHeader bbHeader, ReadOnlySpan readOnlySpan) { @@ -82,6 +85,17 @@ public class GsTypeDetector : IMisHandler } } + if (bbHeader.TsGs == 1 && bbHeader.SyncByte == 1 && bbHeader.UserPacketLength == 0) + { + if (bfbsGseReader == null) + { + bfbsGseReader = new BfbsGseReader(_misId, subTsHandler); + } + + bfbsGseReader.PushFrame(bbHeader, readOnlySpan); + return; + } + //We have no idea what this is. Tuple streamTypeToPost = new Tuple(bbHeader.TsGs, bbHeader.SyncByte); if (_postedStreamTypes == null) diff --git a/skyscraper8/Properties/launchSettings.json b/skyscraper8/Properties/launchSettings.json index 8ff1d59..ee4f78d 100644 --- a/skyscraper8/Properties/launchSettings.json +++ b/skyscraper8/Properties/launchSettings.json @@ -2,11 +2,7 @@ "profiles": { "skyscraper8": { "commandName": "Project", -<<<<<<< HEAD - "commandLineArgs": "\"D:\\sorglos-iww-rww-aca-oca.ts\"", -======= - "commandLineArgs": "udpin udp://127.0.0.1:6970", ->>>>>>> remotes/origin/sauerland + "commandLineArgs": "E:\\638951188146456482.ts", "remoteDebugEnabled": false }, "Container (Dockerfile)": { diff --git a/skyscraper8/Skyscraper/IO/ReadOnlySpanStream.cs b/skyscraper8/Skyscraper/IO/ReadOnlySpanStream.cs new file mode 100644 index 0000000..bb7b8d0 --- /dev/null +++ b/skyscraper8/Skyscraper/IO/ReadOnlySpanStream.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper8.Skyscraper.IO +{ + internal class ReadOnlySpanStream + { + public ReadOnlySpanStream(ReadOnlySpan span) + { + Memory m = new Memory(); + + } + } +} diff --git a/skyscraper8/Skyscraper/IO/StreamlikeSpan.cs b/skyscraper8/Skyscraper/IO/StreamlikeSpan.cs new file mode 100644 index 0000000..1a0a7c8 --- /dev/null +++ b/skyscraper8/Skyscraper/IO/StreamlikeSpan.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper8.Skyscraper.IO +{ + internal ref struct StreamlikeSpan + { + private ReadOnlySpan _readOnlySpan; + + public StreamlikeSpan(ReadOnlySpan readOnlySpan) + { + _readOnlySpan = readOnlySpan; + internalLength = readOnlySpan.Length; + internalPosition = 0; + } + + private int internalLength, internalPosition; + + public int Read(byte[] buffer, int offset, int count) + { + int result = 0; + for (int i = 0; i < count; i++) + { + buffer[i + offset] = _readOnlySpan[internalPosition]; + internalPosition++; + result++; + } + + return result; + } + + public long Seek(long offset, SeekOrigin origin) + { + switch (origin) + { + case SeekOrigin.Begin: + internalPosition = (int)offset; + break; + case SeekOrigin.Current: + internalPosition += (int)offset; + break; + case SeekOrigin.End: + internalPosition = internalLength + (int)offset; + break; + } + + return internalPosition; + } + + public void SetLength(long value) + { + if (value > internalLength) + throw new NotSupportedException("Can not lengthen Streamlikes. You have to shorten them."); + + _readOnlySpan = _readOnlySpan.Slice(0, (int)value); + internalLength = (int)value; + } + + public void Write(byte[] buffer, int offset, int count) + { + throw new NotSupportedException("Cannot write to an ReadOnlySpan"); + } + + public bool CanRead => true; + public bool CanSeek => true; + public bool CanWrite => true; + public long Length => internalLength; + public long Position => internalPosition; + } + + class TelepathyStream : Stream + { + public override void Flush() + { + throw new NotImplementedException(); + } + + public override int Read(byte[] buffer, int offset, int count) + { + throw new NotImplementedException(); + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotImplementedException(); + } + + public override void SetLength(long value) + { + throw new NotImplementedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + throw new NotImplementedException(); + } + + public override bool CanRead { get; } + public override bool CanSeek { get; } + public override bool CanWrite { get; } + public override long Length { get; } + public override long Position { get; set; } + } +}