Can now parse CAT, PMT, SDT and TDT from SIS.
All checks were successful
🚀 Pack skyscraper8 / make-zip (push) Successful in 2m42s

This commit is contained in:
Fey 2025-12-15 21:27:13 +01:00
parent e7db7cb364
commit 3b0dad4ba5
10 changed files with 231 additions and 18 deletions

View File

@ -35,7 +35,6 @@ namespace skyscraper8.DvbSis
public void OnT2MiPacketLoss(int pid, byte expectedPacket, T2MIHeader header)
{
throw new NotImplementedException();
}
public void OnT2MiPacket(int pid, byte basebandFramePlpId, byte[] basebandPacket)

View File

@ -9,7 +9,11 @@ using System.Threading.Tasks;
namespace skyscraper8.DvbSis
{
internal class NullSisHandler : SisHandler
{
{
public void OnSisCat(int sourcePid, SisCatContainer catContainer)
{
}
public void OnSisDsaci(ushort currentDsaGroupId, int versionNumber, byte sectionNumber, byte lastSectionNumber, Stream dsaci)
{
@ -26,8 +30,21 @@ namespace skyscraper8.DvbSis
public void OnSisPat(int sourcePid, SisPatContainer patContainer)
{
}
}
public void OnSisPmt(int sourcePid, SisPmtContainer pmtContainer)
{
}
public void OnSisSdt(int sourcePid, SisSdtContainer sdtContainer)
{
}
public void OnSisTdt(int sourcePid, SisTdtContainer tdtContainer)
{
}
public void OnSisTimestamp(int pid, _0x20_DvbT2Timestamp t2Timestamp)
{
}

View File

@ -0,0 +1,34 @@
using skyscraper5.Mpeg2.Descriptors;
using skyscraper5.Mpeg2.Psi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.DvbSis
{
internal class SisCatContainer : ICatEventHandler
{
public void NotifyOfCaSystem(CaDescriptor caDescriptor, bool fromPmt = false)
{
if (caDescriptors == null)
caDescriptors = new List<CaDescriptor>();
caDescriptors.Add(caDescriptor);
}
private List<CaDescriptor> caDescriptors;
public IReadOnlyList<CaDescriptor> CaDescriptors
{
get
{
if (caDescriptors == null)
return new List<CaDescriptor>().AsReadOnly();
return caDescriptors.AsReadOnly();
}
}
}
}

View File

@ -9,11 +9,15 @@ using System.Threading.Tasks;
namespace skyscraper8.DvbSis
{
internal interface SisHandler
{
{
void OnSisCat(int sourcePid, SisCatContainer catContainer);
void OnSisDsaci(ushort currentDsaGroupId, int versionNumber, byte sectionNumber, byte lastSectionNumber, Stream dsaci);
void OnSisEit(int sourcePid, SisEitContainer eitContainer);
void OnSisFti(int relatedPid, _0xF0_FramingTimingInformation fti);
void OnSisPat(int sourcePid, SisPatContainer patContainer);
void OnSisPat(int sourcePid, SisPatContainer patContainer);
void OnSisPmt(int sourcePid, SisPmtContainer pmtContainer);
void OnSisSdt(int sourcePid, SisSdtContainer sdtContainer);
void OnSisTdt(int sourcePid, SisTdtContainer tdtContainer);
void OnSisTimestamp(int pid, _0x20_DvbT2Timestamp t2Timestamp);
}
}

View File

@ -0,0 +1,47 @@
using skyscraper5.Dvb.Psi;
using skyscraper5.Dvb.Psi.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.DvbSis
{
internal class SisNitContainer : INitEventHandler
{
public void OnNitNetwork(NitNetwork nitNetwork)
{
Network = nitNetwork;
}
public void OnNitTransportStream(ushort networkId, NitTransportStream transportStream)
{
if (_transportStreams == null)
_transportStreams = new List<Tuple<ushort, NitTransportStream>>();
_transportStreams.Add(new Tuple<ushort, NitTransportStream> (networkId, transportStream ));
}
public void SetNetworkId(ushort networkId, bool forceOverrite = false)
{
this.NetworkId = networkId;
}
public ushort? NetworkId { get; private set; }
public NitNetwork Network { get; private set; }
private List<Tuple<ushort, NitTransportStream>> _transportStreams;
public IReadOnlyList<Tuple<ushort,NitTransportStream>> TransportStreams
{
get
{
if (_transportStreams == null)
return new List<Tuple<ushort, NitTransportStream>>().AsReadOnly();
return _transportStreams.AsReadOnly();
}
}
}
}

View File

@ -0,0 +1,20 @@
using skyscraper5.Mpeg2.Psi;
using skyscraper5.Mpeg2.Psi.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.DvbSis
{
internal class SisPmtContainer : IPmtEventHandler
{
public void PmtEvent(ProgramMapping result, int pmtPid)
{
this.ProgramMapping = result;
}
public ProgramMapping ProgramMapping { get; private set; }
}
}

View File

@ -27,12 +27,39 @@ namespace skyscraper8.DvbSis
PatParser patParser = new PatParser(patContainer);
patParser.GatherPsi(section, 0);
_handler.OnSisPat(sourcePid, patContainer);
break;
break;
case 0x01:
SisCatContainer catContainer = new SisCatContainer();
CatParser catParser = new CatParser(catContainer);
catParser.GatherPsi(section, 0);
_handler.OnSisCat(sourcePid, catContainer);
break;
case 0x02:
SisPmtContainer pmtContainer = new SisPmtContainer();
PmtParser pmtParser = new PmtParser(pmtContainer);
pmtParser.GatherPsi(section, 0);
_handler.OnSisPmt(sourcePid, pmtContainer);
break;
case 0x40:
case 0x42:
SisSdtContainer sdtContainer = new SisSdtContainer();
SdtParser sdtParser = new SdtParser(sdtContainer);
sdtParser.GatherPsi(section, 0);
_handler.OnSisSdt(sourcePid, sdtContainer);
break;
case 0x4e:
case 0x50:
SisEitContainer eitContainer = new SisEitContainer();
EitParser eitParser = new EitParser(eitContainer);
eitParser.GatherPsi(section, sourcePid);
_handler.OnSisEit(sourcePid, eitContainer);
break;
case 0x70:
SisTdtContainer tdtContainer = new SisTdtContainer();
TimetableParser tdtParser = new TimetableParser(tdtContainer, null);
tdtParser.GatherPsi(section, sourcePid);
_handler.OnSisTdt(sourcePid, tdtContainer);
break;
default:
throw new NotImplementedException(String.Format("Table ID 0x{0:X2} in DVB-SIS PSI/SI not supported yet. To get this fixed, please share a sample of this stream.", section.TableId));

View File

@ -0,0 +1,46 @@
using skyscraper5.Dvb.Psi;
using skyscraper5.Dvb.Psi.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.DvbSis
{
internal class SisSdtContainer : ISdtEventHandler
{
public ushort? NetworkId { get; private set; }
public ushort? TransportStreamId { get; private set; }
private List<SdtService> sdtServices;
public void OnSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService)
{
if (sdtServices == null)
sdtServices = new List<SdtService>();
sdtServices.Add(sdtService);
}
public void SetNetworkId(ushort networkId)
{
this.NetworkId = networkId;
}
public void SetTransportStreamId(ushort transportStreamId)
{
this.TransportStreamId = transportStreamId;
}
public IReadOnlyList<SdtService> Services
{
get
{
if (sdtServices == null)
return new List<SdtService>().AsReadOnly();
return sdtServices.AsReadOnly();
}
}
}
}

View File

@ -0,0 +1,19 @@
using skyscraper5.Dvb.Psi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.DvbSis
{
internal class SisTdtContainer : ITdtEventHandler
{
public DateTime? UtcTime { get; private set; }
public void OnTdtTime(DateTime utcTime)
{
this.UtcTime = utcTime;
}
}
}

View File

@ -1,12 +1,12 @@
{
"profiles": {
"skyscraper8": {
"commandName": "Project",
"commandLineArgs": "\"G:\\Stash\\utena\\dvb-sis_eutelsat5_12522_v.ts\"",
"remoteDebugEnabled": false
},
"Container (Dockerfile)": {
"commandName": "Docker"
}
}
{
"profiles": {
"skyscraper8": {
"commandName": "Project",
"commandLineArgs": "\"F:\\utena2\\dvb-sis_eutelsat5_12522_v.ts\"",
"remoteDebugEnabled": false
},
"Container (Dockerfile)": {
"commandName": "Docker"
}
}
}