From 2e173d4156ca8c9b6a8c1bd2fdfd1d602f42a551 Mon Sep 17 00:00:00 2001 From: feyris-tan <4116042+feyris-tan@users.noreply.github.com> Date: Sun, 7 Jun 2026 21:56:39 +0200 Subject: [PATCH] Added an option for parsing FLUTE-LCT Frames with ATSC3's peculiarities. --- skyscraper8/Atsc/A331/Atsc3Unpacker.cs | 3 +++ skyscraper8/DvbNip/DvbNipReceiver.cs | 4 ++-- skyscraper8/Ietf/FLUTE/LctFrame.cs | 20 ++++++++++++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/skyscraper8/Atsc/A331/Atsc3Unpacker.cs b/skyscraper8/Atsc/A331/Atsc3Unpacker.cs index 51f95f5..d3fb204 100644 --- a/skyscraper8/Atsc/A331/Atsc3Unpacker.cs +++ b/skyscraper8/Atsc/A331/Atsc3Unpacker.cs @@ -11,6 +11,7 @@ using skyscraper5.Skyscraper; using skyscraper5.Skyscraper.Plugins; using skyscraper5.Skyscraper.Scraper; using skyscraper8.Atsc.A331.Schema; +using skyscraper8.Ietf.FLUTE; namespace skyscraper8.Atsc.A331 { @@ -71,6 +72,8 @@ namespace skyscraper8.Atsc.A331 { return; } + + LctFrame lctFrame = new LctFrame(udpPacket.Payload, true); } private void HandleLls(LlsTable lls) diff --git a/skyscraper8/DvbNip/DvbNipReceiver.cs b/skyscraper8/DvbNip/DvbNipReceiver.cs index 7947aad..c331bb2 100644 --- a/skyscraper8/DvbNip/DvbNipReceiver.cs +++ b/skyscraper8/DvbNip/DvbNipReceiver.cs @@ -53,7 +53,7 @@ namespace skyscraper8.DvbNip UserDatagram discoveryUdpPacket = new UserDatagram(ipv4Packet); if (discoveryUdpPacket.DestinationPort == 3937) { - LctFrame discoveryLctFrame = new LctFrame(discoveryUdpPacket.Payload); + LctFrame discoveryLctFrame = new LctFrame(discoveryUdpPacket.Payload, false); if (discoveryLctFrame == null) return; LctHeader lctHeader = discoveryLctFrame.LctHeader; @@ -77,7 +77,7 @@ namespace skyscraper8.DvbNip } UserDatagram udpPacket = new UserDatagram(ipv4Packet); - LctFrame lctFrame = new LctFrame(udpPacket.Payload); + LctFrame lctFrame = new LctFrame(udpPacket.Payload, false); if (lctFrame.LctHeader == null) { return; diff --git a/skyscraper8/Ietf/FLUTE/LctFrame.cs b/skyscraper8/Ietf/FLUTE/LctFrame.cs index 02fc666..25adab9 100644 --- a/skyscraper8/Ietf/FLUTE/LctFrame.cs +++ b/skyscraper8/Ietf/FLUTE/LctFrame.cs @@ -11,8 +11,10 @@ namespace skyscraper8.Ietf.FLUTE { internal class LctFrame { - public LctFrame(byte[] buffer) + public LctFrame(byte[] buffer, bool isAtsc3) { + this.Atsc3Compliant = isAtsc3; + MemoryStream ms = new MemoryStream(buffer, false); byte byteA = ms.ReadUInt8(); this.Version = (byteA & 0xf0) >> 4; @@ -46,7 +48,17 @@ namespace skyscraper8.Ietf.FLUTE if (ms.GetAvailableBytes() < 4) return; - this.FecHeader = new FecHeader(ms); + //TODO: This assumes to always be Code Point 0, like in DVB-NIP, but ATSC3 uses Code Point 8. + //ATSC 3 sample: salvage strat1 "Z:\Persönliches\Satellitescommunity\Skyscraper Test Fixture\65.0W_11304.256_V_30000_(2026-05-17 09.44.02)_dump.ts" + //DVB-NIP sample: "Z:\Persönliches\Satellitescommunity\Skyscraper Test Fixture\astra1_11141h_gse_nip.ts" + if (!isAtsc3) + { + this.FecHeader = new FecHeader(ms); + } + else + { + this.Atsc3ObjectStartOffset = ms.ReadUInt32BE(); + } long avails = ms.GetAvailableBytes(); if (avails == 0) @@ -60,6 +72,10 @@ namespace skyscraper8.Ietf.FLUTE } } + public uint? Atsc3ObjectStartOffset { get; set; } + + public bool Atsc3Compliant { get; set; } + public int Version { get; } public int CongestionControlFlag { get; } public int ProtocolSpecificIndication { get; }