Modernized the architecture for BAT and NIT.
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 42s
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 42s
This commit is contained in:
parent
08abdb0fb6
commit
26beed9606
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using skyscraper5.Dvb.Descriptors;
|
using skyscraper5.Dvb.Descriptors;
|
||||||
@ -51,17 +52,23 @@ namespace skyscraper5.Dvb.Psi
|
|||||||
byte[] bouquetDescriptorsData = ms.ReadBytes(bouquetDescriptorsLength);
|
byte[] bouquetDescriptorsData = ms.ReadBytes(bouquetDescriptorsLength);
|
||||||
IEnumerable<TsDescriptor> outerDescriptors = TsDescriptorUnpacker.GetInstance().UnpackDescriptors(bouquetDescriptorsData, "BAT");
|
IEnumerable<TsDescriptor> outerDescriptors = TsDescriptorUnpacker.GetInstance().UnpackDescriptors(bouquetDescriptorsData, "BAT");
|
||||||
BatBouquet batBouquet = ParseOuterDescriptors(outerDescriptors,bouquetId);
|
BatBouquet batBouquet = ParseOuterDescriptors(outerDescriptors,bouquetId);
|
||||||
EventHandler.OnBatBouquet(batBouquet);
|
|
||||||
|
|
||||||
readUInt16Be = ms.ReadUInt16BE();
|
readUInt16Be = ms.ReadUInt16BE();
|
||||||
int transportStreamLoopLength = (readUInt16Be & 0x0fff);
|
int transportStreamLoopLength = (readUInt16Be & 0x0fff);
|
||||||
byte[] transportStreamLoopData = ms.ReadBytes(transportStreamLoopLength);
|
byte[] transportStreamLoopData = ms.ReadBytes(transportStreamLoopLength);
|
||||||
ParseTransportStream(transportStreamLoopData, batBouquet);
|
ReadOnlyCollection<BatTransportStream> transportStreams = ParseTransportStream(transportStreamLoopData, batBouquet).ToList().AsReadOnly();
|
||||||
|
batBouquet.TransportStreams = transportStreams;
|
||||||
|
|
||||||
uint crc32 = ms.ReadUInt32BE();
|
uint crc32 = ms.ReadUInt32BE();
|
||||||
}
|
|
||||||
|
|
||||||
private void ParseTransportStream(byte[] transportStreamLoopData, BatBouquet batBouquet)
|
EventHandler.OnBatBouquet(batBouquet);
|
||||||
|
foreach(BatTransportStream ts in transportStreams)
|
||||||
|
{
|
||||||
|
EventHandler.OnBatTransportStream(batBouquet, ts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<BatTransportStream> ParseTransportStream(byte[] transportStreamLoopData, BatBouquet batBouquet)
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream(transportStreamLoopData, false);
|
MemoryStream ms = new MemoryStream(transportStreamLoopData, false);
|
||||||
while (ms.GetAvailableBytes() > 6)
|
while (ms.GetAvailableBytes() > 6)
|
||||||
@ -75,7 +82,8 @@ namespace skyscraper5.Dvb.Psi
|
|||||||
byte[] transportDescriptorsData = ms.ReadBytes(transportDescriptorsLength);
|
byte[] transportDescriptorsData = ms.ReadBytes(transportDescriptorsLength);
|
||||||
IEnumerable<TsDescriptor> descriptors = TsDescriptorUnpacker.GetInstance().UnpackDescriptors(transportDescriptorsData, "BAT");
|
IEnumerable<TsDescriptor> descriptors = TsDescriptorUnpacker.GetInstance().UnpackDescriptors(transportDescriptorsData, "BAT");
|
||||||
BatTransportStream child = ParseInnerDescriptors(transportStreamId, originalNetworkId, descriptors);
|
BatTransportStream child = ParseInnerDescriptors(transportStreamId, originalNetworkId, descriptors);
|
||||||
EventHandler.OnBatTransportStream(batBouquet, child);
|
//EventHandler.OnBatTransportStream(batBouquet, child);
|
||||||
|
yield return child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -35,8 +36,9 @@ namespace skyscraper5.Dvb.Psi.Model
|
|||||||
public int? ControlRemoteAccessOverInternet { get; set; }
|
public int? ControlRemoteAccessOverInternet { get; set; }
|
||||||
public bool? DoNotApplyRevocation { get; set; }
|
public bool? DoNotApplyRevocation { get; set; }
|
||||||
public bool? DoNotScramble { get; set; }
|
public bool? DoNotScramble { get; set; }
|
||||||
|
public ReadOnlyCollection<BatTransportStream> TransportStreams { get; internal set; }
|
||||||
|
|
||||||
public BatBouquet(ushort bouquetId)
|
public BatBouquet(ushort bouquetId)
|
||||||
{
|
{
|
||||||
BouquetId = bouquetId;
|
BouquetId = bouquetId;
|
||||||
Linkages = new List<LinkageDescriptor>();
|
Linkages = new List<LinkageDescriptor>();
|
||||||
|
|||||||
@ -44,8 +44,9 @@ namespace skyscraper5.Dvb.Psi.Model
|
|||||||
|
|
||||||
//from descriptor 0x41
|
//from descriptor 0x41
|
||||||
public ServiceListDescriptor.Service[] ServiceList { get; set; }
|
public ServiceListDescriptor.Service[] ServiceList { get; set; }
|
||||||
|
public ReadOnlyCollection<NitTransportStream> Streams { get; internal set; }
|
||||||
|
|
||||||
public NitNetwork(ushort networkId)
|
public NitNetwork(ushort networkId)
|
||||||
{
|
{
|
||||||
NetworkId = networkId;
|
NetworkId = networkId;
|
||||||
Linkages = new List<LinkageDescriptor>();
|
Linkages = new List<LinkageDescriptor>();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using skyscraper5.Dvb.Descriptors;
|
using skyscraper5.Dvb.Descriptors;
|
||||||
@ -140,17 +141,25 @@ namespace skyscraper5.Dvb.Psi
|
|||||||
throw new NotImplementedException(dvbDescriptor.GetType().Name);
|
throw new NotImplementedException(dvbDescriptor.GetType().Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EventHandler.OnNitNetwork(nitNetwork);
|
|
||||||
|
|
||||||
readUInt16Be = ms.ReadUInt16BE();
|
readUInt16Be = ms.ReadUInt16BE();
|
||||||
int transportStreamLoopLength = readUInt16Be & 0x0fff;
|
int transportStreamLoopLength = readUInt16Be & 0x0fff;
|
||||||
byte[] transportStreamsBuffer = ms.ReadBytes(transportStreamLoopLength);
|
byte[] transportStreamsBuffer = ms.ReadBytes(transportStreamLoopLength);
|
||||||
UnpackTransportStreams(networkId,transportStreamsBuffer);
|
|
||||||
|
|
||||||
|
|
||||||
uint crc32 = ms.ReadUInt32BE();
|
uint crc32 = ms.ReadUInt32BE();
|
||||||
}
|
|
||||||
|
|
||||||
private void UnpackTransportStreams(ushort networkId, byte[] buffer)
|
ReadOnlyCollection<NitTransportStream> nitTransportStreams = UnpackTransportStreams(networkId, transportStreamsBuffer).ToList().AsReadOnly();
|
||||||
|
nitNetwork.Streams = nitTransportStreams;
|
||||||
|
EventHandler.OnNitNetwork(nitNetwork);
|
||||||
|
foreach (NitTransportStream stream in nitTransportStreams)
|
||||||
|
{
|
||||||
|
EventHandler.OnNitTransportStream(networkId, stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<NitTransportStream> UnpackTransportStreams(ushort networkId, byte[] buffer)
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream(buffer, false);
|
MemoryStream ms = new MemoryStream(buffer, false);
|
||||||
while ((ms.Length - ms.Position) > 6)
|
while ((ms.Length - ms.Position) > 6)
|
||||||
@ -162,7 +171,7 @@ namespace skyscraper5.Dvb.Psi
|
|||||||
ushort readUInt16Be = ms.ReadUInt16BE();
|
ushort readUInt16Be = ms.ReadUInt16BE();
|
||||||
int transportDescriptorsLength = readUInt16Be & 0x0fff;
|
int transportDescriptorsLength = readUInt16Be & 0x0fff;
|
||||||
if (transportDescriptorsLength > ms.GetAvailableBytes())
|
if (transportDescriptorsLength > ms.GetAvailableBytes())
|
||||||
return;
|
yield break;
|
||||||
byte[] transportDescriptorBuffer = ms.ReadBytes(transportDescriptorsLength);
|
byte[] transportDescriptorBuffer = ms.ReadBytes(transportDescriptorsLength);
|
||||||
IEnumerable<TsDescriptor> descriptors = TsDescriptorUnpacker.GetInstance().UnpackDescriptors(transportDescriptorBuffer, "NIT");
|
IEnumerable<TsDescriptor> descriptors = TsDescriptorUnpacker.GetInstance().UnpackDescriptors(transportDescriptorBuffer, "NIT");
|
||||||
foreach (TsDescriptor dvbDescriptor in descriptors)
|
foreach (TsDescriptor dvbDescriptor in descriptors)
|
||||||
@ -277,7 +286,8 @@ namespace skyscraper5.Dvb.Psi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandler.OnNitTransportStream(networkId, child);
|
yield return child;
|
||||||
|
//EventHandler.OnNitTransportStream(networkId, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,6 @@ namespace skyscraper5.Skyscraper.Scraper
|
|||||||
void NotifySdtService(SdtService sdtService);
|
void NotifySdtService(SdtService sdtService);
|
||||||
void NotifyPatProgram(int pmtPid, ushort programId);
|
void NotifyPatProgram(int pmtPid, ushort programId);
|
||||||
void NotifyPmtProgram(ProgramMapping result, int pmtPid);
|
void NotifyPmtProgram(ProgramMapping result, int pmtPid);
|
||||||
void NotifyNit(NitTransportStream transportStream);
|
|
||||||
void NotifyMpeTraffic(IpTrafficInfo iti, int ipv4PacketLength);
|
void NotifyMpeTraffic(IpTrafficInfo iti, int ipv4PacketLength);
|
||||||
void NotifyAit(AitApplication aitApplication);
|
void NotifyAit(AitApplication aitApplication);
|
||||||
void DsmCcModuleAdd(int elementaryPid, ushort moduleInfoModuleId, byte moduleInfoModuleVersion);
|
void DsmCcModuleAdd(int elementaryPid, ushort moduleInfoModuleId, byte moduleInfoModuleVersion);
|
||||||
@ -37,7 +36,6 @@ namespace skyscraper5.Skyscraper.Scraper
|
|||||||
void NotifyWss(ushort programNumber, WssDataBlock wssDataBlock);
|
void NotifyWss(ushort programNumber, WssDataBlock wssDataBlock);
|
||||||
void NotifyStreamTypeDetection(string contestantTag, int pid);
|
void NotifyStreamTypeDetection(string contestantTag, int pid);
|
||||||
void NotifyBat(BatBouquet batBouquet);
|
void NotifyBat(BatBouquet batBouquet);
|
||||||
void NotifyBatTs(ushort batBouquetBouquetId, BatTransportStream child);
|
|
||||||
void DsmCcVfs(VfsFile vfsFile);
|
void DsmCcVfs(VfsFile vfsFile);
|
||||||
void NotifyTot(DateTime utcTime, LocalTimeOffsetDescriptor ltod);
|
void NotifyTot(DateTime utcTime, LocalTimeOffsetDescriptor ltod);
|
||||||
void NotifyTdt(DateTime utcTime);
|
void NotifyTdt(DateTime utcTime);
|
||||||
@ -188,7 +186,8 @@ namespace skyscraper5.Skyscraper.Scraper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Returns true if the "Do not auto-zap" checkbox is checked in the FoundFrequenciesWIndow</returns>
|
/// <returns>Returns true if the "Do not auto-zap" checkbox is checked in the FoundFrequenciesWIndow</returns>
|
||||||
bool MayAutoZap();
|
bool MayAutoZap();
|
||||||
|
void NotifyNit(NitNetwork nitNetwork);
|
||||||
|
|
||||||
TaskQueue Tasks { get; set; }
|
TaskQueue Tasks { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1079,8 +1079,6 @@ namespace skyscraper5.Skyscraper.Scraper
|
|||||||
|
|
||||||
public void OnNitTransportStream(ushort networkId, NitTransportStream transportStream)
|
public void OnNitTransportStream(ushort networkId, NitTransportStream transportStream)
|
||||||
{
|
{
|
||||||
UiJunction?.NotifyNit(transportStream);
|
|
||||||
|
|
||||||
string name;
|
string name;
|
||||||
switch (transportStream.DeliveryMethod)
|
switch (transportStream.DeliveryMethod)
|
||||||
{
|
{
|
||||||
@ -1128,10 +1126,7 @@ namespace skyscraper5.Skyscraper.Scraper
|
|||||||
|
|
||||||
public void OnNitNetwork(NitNetwork nitNetwork)
|
public void OnNitNetwork(NitNetwork nitNetwork)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(nitNetwork.Name))
|
UiJunction?.NotifyNit(nitNetwork);
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
if (nitNetwork.XaitPid.HasValue && CurrentNetworkId.HasValue)
|
if (nitNetwork.XaitPid.HasValue && CurrentNetworkId.HasValue)
|
||||||
{
|
{
|
||||||
ushort nitNetworkXaitPid = nitNetwork.XaitPid.Value;
|
ushort nitNetworkXaitPid = nitNetwork.XaitPid.Value;
|
||||||
@ -1230,7 +1225,6 @@ namespace skyscraper5.Skyscraper.Scraper
|
|||||||
|
|
||||||
public void OnBatTransportStream(BatBouquet batBouquet, BatTransportStream child)
|
public void OnBatTransportStream(BatBouquet batBouquet, BatTransportStream child)
|
||||||
{
|
{
|
||||||
UiJunction?.NotifyBatTs(batBouquet.BouquetId, child);
|
|
||||||
string name = String.Format("{0},{1}", batBouquet.BouquetId, child.OriginalNetworkId);
|
string name = String.Format("{0},{1}", batBouquet.BouquetId, child.OriginalNetworkId);
|
||||||
if (DataStorage.TestForBatTransportStream(batBouquet.BouquetId, child))
|
if (DataStorage.TestForBatTransportStream(batBouquet.BouquetId, child))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -51,7 +51,7 @@ using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
|
|||||||
|
|
||||||
namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
|
namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
|
||||||
{
|
{
|
||||||
internal class FilesystemStorage : DataStorage, ObjectStorage
|
public class FilesystemStorage : DataStorage, ObjectStorage
|
||||||
{
|
{
|
||||||
private readonly DirectoryInfo rootDirectory;
|
private readonly DirectoryInfo rootDirectory;
|
||||||
private readonly string importFilesKnownFilename;
|
private readonly string importFilesKnownFilename;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user