Added BCT parsing.
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 1m19s

This commit is contained in:
feyris-tan 2025-10-18 22:04:52 +02:00
parent 2d8b66e1e8
commit 4a90c8751f
11 changed files with 150 additions and 12 deletions

View File

@ -21,6 +21,7 @@ namespace skyscraper5.src.InteractionChannel
TmstInvalid, TmstInvalid,
Fct2Invalid, Fct2Invalid,
Tbtp2Invalid, Tbtp2Invalid,
Tmst2Invalid Tmst2Invalid,
BctInvalid
} }
} }

View File

@ -8,6 +8,7 @@ using System.Net.NetworkInformation;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using skyscraper5.src.InteractionChannel.Model2; using skyscraper5.src.InteractionChannel.Model2;
using skyscraper8.InteractionChannel.Model2;
namespace skyscraper5.src.InteractionChannel namespace skyscraper5.src.InteractionChannel
{ {
@ -30,6 +31,7 @@ namespace skyscraper5.src.InteractionChannel
void OnReturnTransmissionMOdes(PhysicalAddress macAddress, _0xb2_ReturnTransmissionModesDescriptor descriptor); void OnReturnTransmissionMOdes(PhysicalAddress macAddress, _0xb2_ReturnTransmissionModesDescriptor descriptor);
void OnConnectionControl(PhysicalAddress macAddress, _0xaf_ConnectionControlDescriptor descriptor); void OnConnectionControl(PhysicalAddress macAddress, _0xaf_ConnectionControlDescriptor descriptor);
void OnTerminalBurstTimePlan2(ushort interactiveNetworkId, Tbtp2 tbtp2); void OnTerminalBurstTimePlan2(ushort interactiveNetworkId, Tbtp2 tbtp2);
void OnFrameComposition2(ushort? networkId, Fct2 fct2); void OnFrameComposition2(ushort networkId, Fct2 fct2);
void OnBroadcastConfiguration(ushort networkId, Bct bct);
} }
} }

View File

@ -9,6 +9,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using skyscraper8.InteractionChannel.Model2;
namespace skyscraper5.src.InteractionChannel namespace skyscraper5.src.InteractionChannel
{ {
@ -205,11 +206,24 @@ namespace skyscraper5.src.InteractionChannel
return; return;
} }
Handler.OnFrameComposition2(NetworkId, fct2); Handler.OnFrameComposition2(NetworkId.Value, fct2);
return; return;
case 0xAC: //BCT case 0xAC: //BCT
//see en_30154502v010401p.pdf, page 49 InteractionChannelSiSectionHeader bctHeader = new InteractionChannelSiSectionHeader(ms);
throw new NotImplementedException("BCT"); if (!bctHeader.Valid)
{
_handler.OnInteractionChannelError(InteractionChannelErrorState.HeaderInvalid);
return;
}
NetworkId = bctHeader.InteractiveNetworkId;
Bct bct = new Bct(ms);
if (!bct.Valid)
{
_handler.OnInteractionChannelError(InteractionChannelErrorState.BctInvalid);
return;
}
Handler.OnBroadcastConfiguration(NetworkId.Value, bct);
return;
case 0xAD: //TBTP2 case 0xAD: //TBTP2
InteractionChannelSiSectionHeader tbtp2Header = new InteractionChannelSiSectionHeader(ms); InteractionChannelSiSectionHeader tbtp2Header = new InteractionChannelSiSectionHeader(ms);
if (!tbtp2Header.Valid) if (!tbtp2Header.Valid)

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Skyscraper;
using skyscraper5.Skyscraper.IO;
namespace skyscraper8.InteractionChannel.Model2
{
/// <summary>
/// Broadcast Configuration Table as found on ETSI EN 301 545-2 V1.4.1, page 59
/// </summary>
public class Bct : Validatable
{
public Bct(MemoryStream ms)
{
byte loopCount = ms.ReadUInt8();
TxTypes = new BroadcastConfiguration[loopCount];
for (int i = 0; i < loopCount; i++)
{
TxTypes[i] = new BroadcastConfiguration();
TxTypes[i].TxType = ms.ReadUInt8();
TxTypes[i].TxContentType = ms.ReadUInt8();
TxTypes[i].TxFormatClass = ms.ReadUInt8();
byte txFormatDataLengnth = ms.ReadUInt8();
TxTypes[i].TxFormatData = ms.ReadBytes(txFormatDataLengnth);
}
Valid = true;
}
public BroadcastConfiguration[] TxTypes { get; private set; }
public class BroadcastConfiguration
{
public byte TxType { get; set; }
public byte TxContentType { get; set; }
public byte TxFormatClass { get; set; }
public byte[] TxFormatData { get; set; }
}
}
}

View File

@ -8,6 +8,7 @@ using System.Net.NetworkInformation;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using skyscraper5.src.InteractionChannel.Model2; using skyscraper5.src.InteractionChannel.Model2;
using skyscraper8.InteractionChannel.Model2;
namespace skyscraper5.src.InteractionChannel namespace skyscraper5.src.InteractionChannel
{ {
@ -27,9 +28,18 @@ namespace skyscraper5.src.InteractionChannel
} }
public void OnFrameComposition2(ushort networkId, Fct2 fct2)
{
}
public void OnBroadcastConfiguration(ushort networkId, Bct bct)
{
}
public void OnFrameComposition2(ushort? networkId, Fct2 fct2) public void OnFrameComposition2(ushort? networkId, Fct2 fct2)
{ {
throw new NotImplementedException();
} }
public void OnContentionControl(PhysicalAddress macAddress, _0xab_ContentionControlDescriptor ccd) public void OnContentionControl(PhysicalAddress macAddress, _0xab_ContentionControlDescriptor ccd)

View File

@ -80,6 +80,7 @@ using skyscraper5.src.InteractionChannel.Model2;
using skyscraper8.Experimentals.NdsSsu; using skyscraper8.Experimentals.NdsSsu;
using skyscraper8.Experimentals.OtvSsu; using skyscraper8.Experimentals.OtvSsu;
using skyscraper8.GSE; using skyscraper8.GSE;
using skyscraper8.InteractionChannel.Model2;
using skyscraper8.Skyscraper.Net; using skyscraper8.Skyscraper.Net;
using skyscraper8.Skyscraper.Scraper; using skyscraper8.Skyscraper.Scraper;
using Tsubasa.IO; using Tsubasa.IO;
@ -2413,14 +2414,26 @@ namespace skyscraper5.Skyscraper.Scraper
} }
} }
public void OnFrameComposition2(ushort? networkId, Fct2 fct2) public void OnFrameComposition2(ushort networkId, Fct2 fct2)
{ {
foreach (Fct2.Frame frame in fct2.FrameTypes) foreach (Fct2.Frame frame in fct2.FrameTypes)
{ {
if (!DataStorage.TestForFrameComposition2(networkId.Value, frame)) if (!DataStorage.TestForFrameComposition2(networkId, frame))
{ {
LogEvent(SkyscraperContextEvent.FrameComposition2,String.Format("Network ID = {0}, Frame Type = {1}",networkId.Value,frame.FrameType)); LogEvent(SkyscraperContextEvent.FrameComposition2,String.Format("Network ID = {0}, Frame Type = {1}",networkId,frame.FrameType));
DataStorage.InsertFct2Frame(networkId.Value, frame); DataStorage.InsertFct2Frame(networkId, frame);
}
}
}
public void OnBroadcastConfiguration(ushort networkId, Bct bct)
{
foreach (Bct.BroadcastConfiguration txType in bct.TxTypes)
{
if (!DataStorage.TestForBroadcastConfiguration(networkId, txType.TxType))
{
LogEvent(SkyscraperContextEvent.BroadcastConfiguration, String.Format("Network ID = {0}, Broadcast Configuration #{1}", networkId, txType.TxType));
DataStorage.InsertBroadcastConfiguration(networkId, txType);
} }
} }
} }

View File

@ -87,6 +87,7 @@
NdsSsuFileAnnounced, NdsSsuFileAnnounced,
NdsSsuProgress, NdsSsuProgress,
TerminalBurstTimePlan2, TerminalBurstTimePlan2,
FrameComposition2 FrameComposition2,
BroadcastConfiguration
} }
} }

View File

@ -28,6 +28,7 @@ using skyscraper8.Ses;
using System.Net; using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using skyscraper5.src.InteractionChannel.Model2; using skyscraper5.src.InteractionChannel.Model2;
using skyscraper8.InteractionChannel.Model2;
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform; using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
namespace skyscraper8.Skyscraper.Scraper.Storage namespace skyscraper8.Skyscraper.Scraper.Storage
@ -198,5 +199,7 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
void StoreTerminalBurstTimePlan2(ushort interactiveNetworkId, byte tbtp2GroupId, Tbtp2.Frame frame); void StoreTerminalBurstTimePlan2(ushort interactiveNetworkId, byte tbtp2GroupId, Tbtp2.Frame frame);
bool TestForFrameComposition2(ushort networkId, Fct2.Frame fct2); bool TestForFrameComposition2(ushort networkId, Fct2.Frame fct2);
void InsertFct2Frame(ushort networkId, Fct2.Frame frame); void InsertFct2Frame(ushort networkId, Fct2.Frame frame);
bool TestForBroadcastConfiguration(ushort networkId, byte txTypeTxType);
void InsertBroadcastConfiguration(ushort networkId, Bct.BroadcastConfiguration txType);
} }
} }

View File

@ -38,6 +38,7 @@ using skyscraper8.DvbI;
using skyscraper8.DvbNip; using skyscraper8.DvbNip;
using skyscraper8.Experimentals.NdsSsu; using skyscraper8.Experimentals.NdsSsu;
using skyscraper8.Ietf.FLUTE; using skyscraper8.Ietf.FLUTE;
using skyscraper8.InteractionChannel.Model2;
using skyscraper8.Ses; using skyscraper8.Ses;
using skyscraper8.SimpleServiceDiscoveryProtocol; using skyscraper8.SimpleServiceDiscoveryProtocol;
using skyscraper8.Skyscraper.Drawing; using skyscraper8.Skyscraper.Drawing;
@ -1176,6 +1177,16 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool TestForBroadcastConfiguration(ushort networkId, byte txTypeTxType)
{
throw new NotImplementedException();
}
public void InsertBroadcastConfiguration(ushort networkId, Bct.BroadcastConfiguration txType)
{
throw new NotImplementedException();
}
public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt() public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt()
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@ -38,6 +38,7 @@ using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using skyscraper5.src.InteractionChannel.Model2; using skyscraper5.src.InteractionChannel.Model2;
using skyscraper8.Ietf.FLUTE; using skyscraper8.Ietf.FLUTE;
using skyscraper8.InteractionChannel.Model2;
using skyscraper8.Skyscraper.Scraper.Storage; using skyscraper8.Skyscraper.Scraper.Storage;
using skyscraper8.Skyscraper.Scraper.Storage.Utilities; using skyscraper8.Skyscraper.Scraper.Storage.Utilities;
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform; using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
@ -1005,6 +1006,25 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
_fct2Frames.Add(key, frame); _fct2Frames.Add(key, frame);
} }
private Dictionary<Tuple<ushort, byte>, Bct.BroadcastConfiguration> broadcastConfigurations;
public bool TestForBroadcastConfiguration(ushort networkId, byte txTypeTxType)
{
if (broadcastConfigurations == null)
return false;
Tuple<ushort, byte> key = new Tuple<ushort, byte>(networkId, txTypeTxType);
return broadcastConfigurations.ContainsKey(key);
}
public void InsertBroadcastConfiguration(ushort networkId, Bct.BroadcastConfiguration txType)
{
if (broadcastConfigurations == null)
broadcastConfigurations = new Dictionary<Tuple<ushort, byte>, Bct.BroadcastConfiguration>();
Tuple<ushort, byte> key = new Tuple<ushort, byte>(networkId, txType.TxType);
broadcastConfigurations.Add(key, txType);
}
public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt() public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt()
{ {
for (int x = 0; x < pmtEntries.Length; x++) for (int x = 0; x < pmtEntries.Length; x++)

View File

@ -12,6 +12,7 @@ using System.Net.NetworkInformation;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using skyscraper5.src.InteractionChannel.Model2; using skyscraper5.src.InteractionChannel.Model2;
using skyscraper8.InteractionChannel.Model2;
namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
{ {
@ -193,9 +194,28 @@ namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
} }
} }
public void OnFrameComposition2(ushort networkId, Fct2 fct2)
{
if (fct2.FrameTypes.Length > 0)
{
Score++;
}
}
public void OnBroadcastConfiguration(ushort networkId, Bct bct)
{
if (bct.TxTypes.Length > 0)
{
Score++;
}
}
public void OnFrameComposition2(ushort? networkId, Fct2 fct2) public void OnFrameComposition2(ushort? networkId, Fct2 fct2)
{ {
throw new NotImplementedException(); if (fct2.FrameTypes.Length > 0)
{
Score++;
}
} }
} }
} }