Added Hooks for ATSC 3.0 and bad reception handling for Voile.
All checks were successful
🚀 Pack skyscraper8 / make-zip (push) Successful in 1m28s

This commit is contained in:
feyris-tan 2026-06-21 19:49:43 +02:00
parent a90541cb39
commit 56b6b84ffd
5 changed files with 35 additions and 7 deletions

View File

@ -2,7 +2,7 @@
{
internal class InvalidTsPacketException : Mpeg2Exception
{
public InvalidTsPacketException() : base("Invalid TS Packet", "")
public InvalidTsPacketException() : base("Buffer contains an invalid TS Packet", "")
{
}
}

View File

@ -16,6 +16,7 @@ namespace skyscraper5.Mpeg2
private ulong[] pidPackets;
private ulong[] scrambledPackets;
private ulong[] teiPackets;
internal Action OnBadReception { private get; set; }
public long PacketLossEvents { get; private set; }
public bool FirstPacketDone { get; private set; }
@ -105,6 +106,7 @@ namespace skyscraper5.Mpeg2
return false;
logger.WarnFormat("It looks like you're either having bad reception or this is a GS with broken encapsulation. This means that you either have FrameMode enabled, or are not using a STiD135.");
OnBadReception?.Invoke();
encapsulationBrokenConfirmed = true;
return true;
}

View File

@ -13,7 +13,7 @@ namespace skyscraper5.Mpeg2
throw new ArgumentException("Invalid buffer length");
if (buffer[0] != 0x47)
throw new ArgumentException("Buffer is not a TS packet");
throw new InvalidTsPacketException();
rawPacket = buffer;

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using moe.yo3explorer.skyscraper8.DVBI.Model;
@ -255,5 +256,7 @@ namespace skyscraper5.Skyscraper.Scraper
void WneStoryComplete(uint sessionId, string filename);
void Atsc3Service(sltType slt);
void Atsc3MbmsEnvelope(MbmsEnvelope mbmsEnvelope);
}
void Atsc3FileDelivery(IPEndPoint destination, ulong tsi, ulong toi, FluteListener targetListener, GuessedFluteDataType guessedFluteDataType, string outFileName);
void OnBadReception();
}
}

View File

@ -138,6 +138,9 @@ namespace skyscraper5.Skyscraper.Scraper
descriptorUnpacker.SetUserDefined(0xfe, true);
DvbContext = dvbContext;
DvbContext.OnBadReception = (() =>
OnBadReception()
);
//PAT
@ -206,7 +209,12 @@ namespace skyscraper5.Skyscraper.Scraper
this.skipBufferRemain = skipAtStart;
}
public int? CurrentNetworkId { get; private set; }
private void OnBadReception()
{
UiJunction?.OnBadReception();
}
public int? CurrentNetworkId { get; private set; }
public int? CurrentTransportStreamId { get; private set; }
public TeiFilter TeiFilter { get; private set; }
@ -262,6 +270,7 @@ namespace skyscraper5.Skyscraper.Scraper
IngestFromStream(stream, true);
}
private bool invalidPacketWarning;
public void IngestFromStream(Stream stream, bool closeWhenDone = true)
{
byte[] buffer = new byte[188];
@ -275,7 +284,14 @@ namespace skyscraper5.Skyscraper.Scraper
if (read != 188)
{
logger.Warn(String.Format("Reading {0} bytes failed. Got {1} instead.", 188, read));
if (read == 0)
{
logger.Info("End of stream.");
}
else
{
logger.Warn(String.Format("Reading {0} bytes failed. Got {1} instead.", 188, read));
}
break;
}
@ -285,7 +301,11 @@ namespace skyscraper5.Skyscraper.Scraper
}
catch (InvalidTsPacketException)
{
break;
if (!invalidPacketWarning)
{
logger.Error("Received a packet that doesn't contain a valid TS sync byte. (are you using EBSPro?, please tell Fey. This problem is still under research.)");
invalidPacketWarning = true;
}
}
}
@ -339,6 +359,8 @@ namespace skyscraper5.Skyscraper.Scraper
}
DvbContext.PushPacket(buffer);
if (totalPacketsPushed++ == 1000)
{
CheckSpecialTs();
@ -3608,6 +3630,7 @@ namespace skyscraper5.Skyscraper.Scraper
public void OnAtsc3FileDelivery(IPEndPoint destination, ulong tsi, ulong toi, FluteListener targetListener,
GuessedFluteDataType guessedFluteDataType, string outFileName)
{
UiJunction?.Atsc3FileDelivery(destination, tsi, toi, targetListener, guessedFluteDataType, outFileName);
if (!ObjectStorage.TestForAtsc3Segment(destination, outFileName))
{
LogEvent(SkyscraperContextEvent.Atsc3Segment, String.Format("{0}/{1}", destination, outFileName));