Catch all SIS PSI.
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 46s

This commit is contained in:
Fey 2025-12-22 23:35:19 +01:00
parent 7ff359e52d
commit 004c17ab91
6 changed files with 91 additions and 31 deletions

View File

@ -13,13 +13,13 @@ namespace skyscraper8.DvbSis
public ushort? NetworkId { get; private set; }
public ushort? TransportStreamId { get; private set; }
private List<SdtService> sdtServices;
private List<Tuple<ushort,ushort,SdtService>> sdtServices;
public void OnSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService)
{
if (sdtServices == null)
sdtServices = new List<SdtService>();
sdtServices = new List<Tuple<ushort, ushort, SdtService>>();
sdtServices.Add(sdtService);
sdtServices.Add(new Tuple<ushort,ushort,SdtService>(transportStreamId,originalNetworkId,sdtService));
}
public void SetNetworkId(ushort networkId)
@ -32,12 +32,12 @@ namespace skyscraper8.DvbSis
this.TransportStreamId = transportStreamId;
}
public IReadOnlyList<SdtService> Services
public IReadOnlyList<Tuple<ushort, ushort, SdtService>> Services
{
get
{
if (sdtServices == null)
return new List<SdtService>().AsReadOnly();
return new List<Tuple<ushort, ushort, SdtService>>().AsReadOnly();
return sdtServices.AsReadOnly();
}

View File

@ -91,12 +91,13 @@ namespace skyscraper8.Skyscraper
logger.InfoFormat("Reading: {0}", fi.Name);
FileStream fileStream = fi.OpenRead();
BufferedStream bufferedStream = new BufferedStream(fileStream);
byte[] buffer = new byte[188];
try
{
for (long l = 0; l < fileStream.Length; l += 188)
for (long l = 0; l < bufferedStream.Length; l += 188)
{
if (fileStream.Read(buffer, 0, 188) != 188)
if (bufferedStream.Read(buffer, 0, 188) != 188)
{
logger.ErrorFormat("Failed to read 188 bytes from offset {0} of file {1}, aborting reading it.", l, fi.Name);
readError = 1;
@ -118,6 +119,9 @@ namespace skyscraper8.Skyscraper
logger.ErrorFormat("Failed to read from {0}: {1}", fi.Name, e.ToString());
}
bufferedStream.Close();
fileStream.Close();
string filename = fi.FullName;
TsType tsType = GuessTsType(tsContext);
long totalPackets = tsContext.PacketsRead + 1;

View File

@ -44,6 +44,7 @@ namespace skyscraper5.Skyscraper.IO
[DebuggerStepThrough]
public static uint ReadUInt32BE(this Stream stream)
{
byte[] buffer = new byte[4];
if (stream.Read(buffer, 0, 4) != 4)
throw new EndOfStreamException();
if (BitConverter.IsLittleEndian)

View File

@ -727,10 +727,13 @@ namespace skyscraper5.Skyscraper.Scraper
UiJunction?.NotifyPmtProgram(result, pmtPid);
pmtTracker?.MarkAsProcessed(pmtPid);
if (pmtTracker.ShouldFireAutodetection())
if (pmtTracker != null)
{
CheckForHiddenMpes();
pmtTracker.MarkAsProcessed(pmtPid);
if (pmtTracker.ShouldFireAutodetection())
{
CheckForHiddenMpes();
}
}
}
@ -3350,7 +3353,15 @@ namespace skyscraper5.Skyscraper.Scraper
public void OnSisCat(int sourcePid, SisCatContainer catContainer)
{
throw new NotImplementedException();
if (catContainer.CaDescriptors.Count > 0)
{
SkyscraperContext skyscraperContext = GetSisContext(sourcePid);
foreach(CaDescriptor catEntry in catContainer.CaDescriptors)
{
skyscraperContext.NotifyOfCaSystem(catEntry);
}
}
}
public void OnSisDsaci(ushort currentDsaGroupId, int versionNumber, byte sectionNumber, byte lastSectionNumber, Stream dsaci)
@ -3412,7 +3423,18 @@ namespace skyscraper5.Skyscraper.Scraper
public void OnSisNit(int sourcePid, SisNitContainer nitContainer)
{
throw new NotImplementedException();
SkyscraperContext skyscraperContext = GetSisContext(sourcePid);
if (nitContainer.NetworkId.HasValue)
skyscraperContext.SetNetworkId(nitContainer.NetworkId.Value);
if (nitContainer.Network != null)
skyscraperContext.OnNitNetwork(nitContainer.Network);
foreach(Tuple<ushort,NitTransportStream> nitEntry in nitContainer.TransportStreams)
{
ushort networkId = nitEntry.Item1;
NitTransportStream ts = nitEntry.Item2;
skyscraperContext.OnNitTransportStream(networkId, ts);
}
}
public void OnSisPat(int sourcePid, SisPatContainer patContainer)
@ -3432,17 +3454,35 @@ namespace skyscraper5.Skyscraper.Scraper
public void OnSisPmt(int sourcePid, SisPmtContainer pmtContainer)
{
throw new NotImplementedException();
SkyscraperContext context = GetSisContext(sourcePid);
context.PmtEvent(pmtContainer.ProgramMapping, 0);
}
public void OnSisSdt(int sourcePid, SisSdtContainer sdtContainer)
{
throw new NotImplementedException();
SkyscraperContext context = GetSisContext(sourcePid);
if (sdtContainer.NetworkId.HasValue)
context.SetNetworkId(sdtContainer.NetworkId.Value);
if (sdtContainer.TransportStreamId.HasValue)
context.SetTransportStreamId(sdtContainer.TransportStreamId.Value);
foreach(Tuple<ushort, ushort, SdtService> sdtEntry in sdtContainer.Services)
{
ushort tsId = sdtEntry.Item1;
ushort netId = sdtEntry.Item2;
SdtService service = sdtEntry.Item3;
context.OnSdtService(tsId, netId, service);
}
}
public void OnSisTdt(int sourcePid, SisTdtContainer tdtContainer)
{
throw new NotImplementedException();
if (tdtContainer.UtcTime.HasValue)
{
SkyscraperContext context = GetSisContext(sourcePid);
context.OnTdtTime(tdtContainer.UtcTime.Value);
}
}
private bool[] _sisTimestampFlags;
@ -3472,7 +3512,11 @@ namespace skyscraper5.Skyscraper.Scraper
public void OnSisTot(int sourcePid, SisTotContainer totContainer)
{
throw new NotImplementedException();
if (totContainer.LocalTimeOffset != null)
{
SkyscraperContext context = GetSisContext(sourcePid);
context.OnTotTime(totContainer.UtcTime, totContainer.LocalTimeOffset);
}
}
}
}

View File

@ -1,12 +1,4 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json;
using skyscraper5.Docsis.MacManagement;
using skyscraper5.DsmCc.Descriptors;
using skyscraper5.Dvb.DataBroadcasting.IntModel;
@ -46,6 +38,15 @@ using skyscraper8.Ses;
using skyscraper8.SimpleServiceDiscoveryProtocol;
using skyscraper8.Skyscraper.Drawing;
using skyscraper8.Skyscraper.Scraper.Storage;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Text;
using System.Text.RegularExpressions;
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
@ -1982,14 +1983,14 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
public bool TestForSisDsaci(int networkId, int tsId, ushort groupId, int versionNumber)
{
string xmlFileName = Path.Combine(rootDirectory.FullName, "DVB-SIS", networkId.ToString(), tsId.ToString(), String.Format("DSACI_Group{0}_Version{1}.xml"));
string xmlFileName = Path.Combine(rootDirectory.FullName, "DVB-SIS", networkId.ToString(), tsId.ToString(), String.Format("DSACI_Group{0}_Version{1}.xml",groupId,versionNumber));
FileInfo fi = new FileInfo(xmlFileName);
return fi.Exists;
}
public void StoreSisDsaci(int networkId, int tsId, ushort currentDsaGroupId, int versionNumber, Stream dsaci)
public void StoreSisDsaci(int networkId, int tsId, ushort groupId, int versionNumber, Stream dsaci)
{
string xmlFileName = Path.Combine(rootDirectory.FullName, "DVB-SIS", networkId.ToString(), tsId.ToString(), String.Format("DSACI_Group{0}_Version{1}.xml"));
string xmlFileName = Path.Combine(rootDirectory.FullName, "DVB-SIS", networkId.ToString(), tsId.ToString(), String.Format("DSACI_Group{0}_Version{1}.xml", groupId, versionNumber));
FileInfo fi = new FileInfo(xmlFileName);
fi.Directory.EnsureExists();

View File

@ -138,5 +138,15 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
{
throw new NotImplementedException();
}
}
public bool TestForSisDsaci(int value1, int value2, ushort groupId, int versionNumber)
{
return true;
}
public void StoreSisDsaci(int value1, int value2, ushort currentDsaGroupId, int versionNumber, Stream dsaci)
{
throw new NotImplementedException();
}
}
}