Added a "StreamlikeSpan"
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 1m15s

This commit is contained in:
feyris-tan 2025-11-06 21:42:51 +01:00
parent 5aa475dd46
commit 5cd08b978d
6 changed files with 185 additions and 11 deletions

View File

@ -11,12 +11,12 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe1ab690537c44e02a014076312b886b7b2e200_003F4f_003F7bfc5050_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATuple_00602_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F57d616db882b441b8c50720b4477e03db2e200_003F9f_003F0d16f921_003FTuple_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">/home/schiemas/.cache/JetBrains/Rider2025.1/resharper-host/temp/Rider/vAny/CoverageData/_skyscraper8.1808907683/Snapshot/snapshot.utdcvr</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=1108d3f2_002D5e6f_002D416b_002Da8ee_002D3c9502a978e2/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="CheckBfbsCrc #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Solution /&gt;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=1108d3f2_002D5e6f_002D416b_002Da8ee_002D3c9502a978e2/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="CheckBfbsCrc #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Solution /&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8cbe9c8f_002Dfc55_002D47f1_002D9df1_002Dcb4c7fbbc56b/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="CheckBfbsCrc" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;TestAncestor&gt;
&lt;TestId&gt;xUnit::84EE9FCD-2C7F-DF84-C1BA-99D018CE9412::net8.0::skyscraper8.Tests.GsType1SanityTest.CheckBfbsCrc&lt;/TestId&gt;
&lt;/TestAncestor&gt;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8cbe9c8f_002Dfc55_002D47f1_002D9df1_002Dcb4c7fbbc56b/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="CheckBfbsCrc" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;xUnit::84EE9FCD-2C7F-DF84-C1BA-99D018CE9412::net8.0::skyscraper8.Tests.GsType1SanityTest.CheckBfbsCrc&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Profiling/Configurations/=1/@EntryIndexedValue">&lt;data&gt;&lt;HostParameters type="LocalHostParameters" /&gt;&lt;Argument type="StandaloneArgument"&gt;&lt;Arguments IsNull="False"&gt;&lt;/Arguments&gt;&lt;FileName IsNull="False"&gt;&lt;/FileName&gt;&lt;WorkingDirectory IsNull="False"&gt;&lt;/WorkingDirectory&gt;&lt;Scope&gt;&lt;ProcessFilters /&gt;&lt;/Scope&gt;&lt;/Argument&gt;&lt;Info type="TimelineInfo" /&gt;&lt;CoreOptions type="CoreOptions"&gt;&lt;CoreTempPath IsNull="False"&gt;&lt;/CoreTempPath&gt;&lt;RemoteEndPoint IsNull="False"&gt;&lt;/RemoteEndPoint&gt;&lt;AdditionalEnvironmentVariables /&gt;&lt;/CoreOptions&gt;&lt;HostOptions type="HostOptions"&gt;&lt;HostTempPath IsNull="False"&gt;&lt;/HostTempPath&gt;&lt;/HostOptions&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>

View File

@ -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<byte> 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();
}
}
}

View File

@ -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<byte> 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<int, byte> streamTypeToPost = new Tuple<int, byte>(bbHeader.TsGs, bbHeader.SyncByte);
if (_postedStreamTypes == null)

View File

@ -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)": {

View File

@ -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<byte> span)
{
Memory<byte> m = new Memory<byte>();
}
}
}

View File

@ -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<byte> _readOnlySpan;
public StreamlikeSpan(ReadOnlySpan<byte> 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; }
}
}