The GS of Siminn Radiomidun can now get read.
All checks were successful
🚀 Pack skyscraper8 / make-zip (push) Successful in 1m31s
All checks were successful
🚀 Pack skyscraper8 / make-zip (push) Successful in 1m31s
This commit is contained in:
parent
260821ed9d
commit
799f36dba8
@ -1,5 +1,6 @@
|
|||||||
using log4net;
|
using log4net;
|
||||||
using skyscraper5.Dvb.DataBroadcasting;
|
using skyscraper5.Dvb.DataBroadcasting;
|
||||||
|
using skyscraper8.GS.SiminnRadiomidun;
|
||||||
using skyscraper8.GSE.GSE_HEM;
|
using skyscraper8.GSE.GSE_HEM;
|
||||||
using skyscraper8.GSE.GSE;
|
using skyscraper8.GSE.GSE;
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ public class GsTypeDetector : IMisHandler
|
|||||||
|
|
||||||
private GseReader gseReader;
|
private GseReader gseReader;
|
||||||
private GseHemReader gseHemReader;
|
private GseHemReader gseHemReader;
|
||||||
|
private SiminnRadiomidunReader siminnRadiomidunReader;
|
||||||
public void PushFrame(BBHeader bbHeader, ReadOnlySpan<byte> readOnlySpan)
|
public void PushFrame(BBHeader bbHeader, ReadOnlySpan<byte> readOnlySpan)
|
||||||
{
|
{
|
||||||
if (readOnlySpan.Length == 0)
|
if (readOnlySpan.Length == 0)
|
||||||
@ -50,6 +52,19 @@ public class GsTypeDetector : IMisHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bbHeader.TsGs == 0 && bbHeader.SyncByte == 71 && bbHeader.UserPacketLength == 188)
|
||||||
|
{
|
||||||
|
//Looks like a Simmin Radiomidun-like stream.
|
||||||
|
if (siminnRadiomidunReader == null)
|
||||||
|
{
|
||||||
|
//These behave similar to T2-MI. Interesting.
|
||||||
|
siminnRadiomidunReader = new SiminnRadiomidunReader();
|
||||||
|
}
|
||||||
|
|
||||||
|
siminnRadiomidunReader.PushFrame(bbHeader, readOnlySpan);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//We have no idea what this is.
|
//We have no idea what this is.
|
||||||
Tuple<int, byte> streamTypeToPost = new Tuple<int, byte>(bbHeader.TsGs, bbHeader.SyncByte);
|
Tuple<int, byte> streamTypeToPost = new Tuple<int, byte>(bbHeader.TsGs, bbHeader.SyncByte);
|
||||||
if (_postedStreamTypes == null)
|
if (_postedStreamTypes == null)
|
||||||
|
|||||||
95
skyscraper8/GS/SiminnRadiomidun/SiminnRadiomidunReader.cs
Normal file
95
skyscraper8/GS/SiminnRadiomidun/SiminnRadiomidunReader.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using skyscraper5.Mpeg2.Descriptors;
|
||||||
|
using skyscraper5.Skyscraper.IO;
|
||||||
|
using skyscraper5.T2MI;
|
||||||
|
using skyscraper8.GSE;
|
||||||
|
|
||||||
|
namespace skyscraper8.GS.SiminnRadiomidun
|
||||||
|
{
|
||||||
|
internal class SiminnRadiomidunReader : IMisHandler
|
||||||
|
{
|
||||||
|
public SiminnRadiomidunReader()
|
||||||
|
{
|
||||||
|
packetQueue = new Queue<Tuple<BBHeader,MemoryStream>>();
|
||||||
|
isInSync = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isInSync;
|
||||||
|
private Queue<Tuple<BBHeader, MemoryStream>> packetQueue;
|
||||||
|
private MemoryStream currentItem;
|
||||||
|
|
||||||
|
public long PacketQueueSize
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (packetQueue == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return packetQueue.Select(x => x.Item2.Length).Sum();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void PushFrame(BBHeader bbHeader, ReadOnlySpan<byte> readOnlySpan)
|
||||||
|
{
|
||||||
|
if (packetQueue == null)
|
||||||
|
packetQueue = new Queue<Tuple<BBHeader, MemoryStream>>();
|
||||||
|
|
||||||
|
packetQueue.Enqueue(new Tuple<BBHeader, MemoryStream>(bbHeader,new MemoryStream(readOnlySpan.Slice(0,bbHeader.DataFieldLength).ToArray(), true)));
|
||||||
|
|
||||||
|
while (PacketQueueSize > 8192)
|
||||||
|
{
|
||||||
|
if (!isInSync)
|
||||||
|
{
|
||||||
|
Tuple<BBHeader, MemoryStream> dequeue = packetQueue.Dequeue();
|
||||||
|
currentItem = dequeue.Item2;
|
||||||
|
currentItem.Position = dequeue.Item1.SyncD;
|
||||||
|
isInSync = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] outputPacketBuffer = new byte[188];
|
||||||
|
int result = currentItem.Read(outputPacketBuffer, 0, 188);
|
||||||
|
if (result == 188)
|
||||||
|
{
|
||||||
|
OutputPacket(outputPacketBuffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int bytesNeeded = 188 - result;
|
||||||
|
Tuple<BBHeader, MemoryStream> dequeue = packetQueue.Dequeue();
|
||||||
|
if (bytesNeeded == dequeue.Item1.SyncD)
|
||||||
|
{
|
||||||
|
//We're still in sync!
|
||||||
|
syncSucess++;
|
||||||
|
currentItem = dequeue.Item2;
|
||||||
|
currentItem.Read(outputPacketBuffer, result, bytesNeeded);
|
||||||
|
OutputPacket(outputPacketBuffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//sync loss, let's discard the packet
|
||||||
|
syncFail++;
|
||||||
|
currentItem = dequeue.Item2;
|
||||||
|
currentItem.Position = dequeue.Item1.SyncD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ulong syncSucess, syncFail;
|
||||||
|
private FileStream dumpingFileStream;
|
||||||
|
private void OutputPacket(byte[] buffer)
|
||||||
|
{
|
||||||
|
buffer[0] = 0x47;
|
||||||
|
if (dumpingFileStream == null)
|
||||||
|
{
|
||||||
|
FileInfo fi = new FileInfo(string.Format("{0}.ts", DateTime.Now.Ticks));
|
||||||
|
dumpingFileStream = fi.OpenWrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
dumpingFileStream.Write(buffer, 0, 188);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"skyscraper8": {
|
"skyscraper8": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"commandLineArgs": "udpin udp://172.20.20.130:6969",
|
"commandLineArgs": "C:\\devel\\skyscraper8\\skyscraper8\\bin\\Debug\\net8.0\\11049v.ts",
|
||||||
"remoteDebugEnabled": false
|
"remoteDebugEnabled": false
|
||||||
},
|
},
|
||||||
"Container (Dockerfile)": {
|
"Container (Dockerfile)": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user