From 7590c7c5bc9690706cbc2604777a24cc56532823 Mon Sep 17 00:00:00 2001
From: feyris-tan <4116042+feyris-tan@users.noreply.github.com>
Date: Sat, 21 Jun 2025 20:57:07 +0200
Subject: [PATCH] Added some NIP Metadata parsing.
---
.../NetworkInformationFile.cs | 394 ++++++++++++++++++
.../NetworkInformationFile.xsd | 121 ++++++
.../make-classes.bat | 3 +
.../PrivateDataSignalling.cs | 134 ++++++
.../PrivateDataSignalling.xsd | 32 ++
.../make-classes.bat | 1 +
.../ServiceInformationFile.cs | 235 +++++++++++
.../ServiceInformationFile.xsd | 74 ++++
.../make-classes.bat | 3 +
.../TimeOffserFile-XSD/TimeOffsetFile.cs | 127 ++++++
.../TimeOffserFile-XSD/TimeOffsetFile.xsd | 36 ++
.../TimeOffserFile-XSD/make-classes.bat | 3 +
skyscraper8/DvbI/DvbIFilesystemProcessor.cs | 1 +
skyscraper8/DvbI/DvbIUtils.cs | 40 +-
...ep_app1_DVB-I_slep_app2_DVB-I_slep_app3.cs | 2 +-
.../DvbI/ServiceListEntryPointSource.cs | 3 +-
skyscraper8/DvbNip/DvbNipEventHandler.cs | 10 +
skyscraper8/DvbNip/DvbNipReceiver.cs | 145 +++++--
.../DvbNip/DvbNipServiceListNotifier.cs | 14 +
skyscraper8/DvbNip/DvbNipUtilities.cs | 53 +++
.../DvbNip/NipActualCarrierInformation.cs | 18 +
.../XmlSchema/NetworkInformationFile.cs | 394 ++++++++++++++++++
.../DvbNip/XmlSchema/PrivateDataSignalling.cs | 134 ++++++
.../XmlSchema/ServiceInformationFile.cs | 235 +++++++++++
.../DvbNip/XmlSchema/TimeOffsetFile.cs | 127 ++++++
...8_mpeg7_subset_extensibility_2024-04-24.cs | 0
skyscraper8/Ietf/FLUTE/FluteListener.cs | 8 +-
skyscraper8/Skyscraper/ByteArrayExtensions.cs | 15 +
.../Skyscraper/Scraper/SkyscraperContext.cs | 141 ++++++-
.../Scraper/SkyscraperContextEvent.cs | 7 +-
.../Filesystem/FilesystemScraperStorage.cs | 50 +++
.../Scraper/Storage/IScraperStorage.cs | 11 +-
.../InMemory/InMemoryScraperStorage.cs | 167 +++++++-
.../Scraper/Storage/Split/ObjectStorage.cs | 9 +
.../Storage/Split/SplitScraperStorage.cs | 44 ++
.../yo3explorerToSkyscraperContextBridge.cs | 15 +-
36 files changed, 2738 insertions(+), 68 deletions(-)
create mode 100644 Documentation/NetworkInformationFile-XSD/NetworkInformationFile.cs
create mode 100644 Documentation/NetworkInformationFile-XSD/NetworkInformationFile.xsd
create mode 100644 Documentation/NetworkInformationFile-XSD/make-classes.bat
create mode 100644 Documentation/PrivateDataSignallingManifest/PrivateDataSignalling.cs
create mode 100644 Documentation/PrivateDataSignallingManifest/PrivateDataSignalling.xsd
create mode 100644 Documentation/PrivateDataSignallingManifest/make-classes.bat
create mode 100644 Documentation/ServiceInformationFile-XSD/ServiceInformationFile.cs
create mode 100644 Documentation/ServiceInformationFile-XSD/ServiceInformationFile.xsd
create mode 100644 Documentation/ServiceInformationFile-XSD/make-classes.bat
create mode 100644 Documentation/TimeOffserFile-XSD/TimeOffsetFile.cs
create mode 100644 Documentation/TimeOffserFile-XSD/TimeOffsetFile.xsd
create mode 100644 Documentation/TimeOffserFile-XSD/make-classes.bat
create mode 100644 skyscraper8/DvbNip/DvbNipServiceListNotifier.cs
create mode 100644 skyscraper8/DvbNip/XmlSchema/NetworkInformationFile.cs
create mode 100644 skyscraper8/DvbNip/XmlSchema/PrivateDataSignalling.cs
create mode 100644 skyscraper8/DvbNip/XmlSchema/ServiceInformationFile.cs
create mode 100644 skyscraper8/DvbNip/XmlSchema/TimeOffsetFile.cs
rename skyscraper8/DvbNip/{ => XmlSchema}/multicast-session-configuration_phase-2_2024-05-28_mpeg7_subset_extensibility_2024-04-24.cs (100%)
diff --git a/Documentation/NetworkInformationFile-XSD/NetworkInformationFile.cs b/Documentation/NetworkInformationFile-XSD/NetworkInformationFile.cs
new file mode 100644
index 0000000..3e64744
--- /dev/null
+++ b/Documentation/NetworkInformationFile-XSD/NetworkInformationFile.cs
@@ -0,0 +1,394 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+//
+// This source code was auto-generated by xsd, Version=4.8.9037.0.
+//
+namespace skyscraper8.DvbNip {
+ using System.Xml.Serialization;
+
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ [System.Xml.Serialization.XmlRootAttribute("NetworkInformationFile", Namespace="urn:dvb:metadata:nativeip:2023", IsNullable=false)]
+ public partial class NetworkInformationFileType {
+
+ private System.DateTime versionUpdateField;
+
+ private NetworkInformationFileTypeNIFType nIFTypeField;
+
+ private BroadcastNetworkType actualBroadcastNetworkField;
+
+ private BroadcastNetworkType[] otherBroadcastNetworkField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ public NetworkInformationFileTypeNIFType NIFType {
+ get {
+ return this.nIFTypeField;
+ }
+ set {
+ this.nIFTypeField = value;
+ }
+ }
+
+ ///
+ public BroadcastNetworkType ActualBroadcastNetwork {
+ get {
+ return this.actualBroadcastNetworkField;
+ }
+ set {
+ this.actualBroadcastNetworkField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("OtherBroadcastNetwork")]
+ public BroadcastNetworkType[] OtherBroadcastNetwork {
+ get {
+ return this.otherBroadcastNetworkField;
+ }
+ set {
+ this.otherBroadcastNetworkField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2023")]
+ public enum NetworkInformationFileTypeNIFType {
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Physical Network")]
+ PhysicalNetwork,
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Commercial Operator")]
+ CommercialOperator,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ public partial class BroadcastNetworkType {
+
+ private BroadcastNetworkTypeNetworkType networkTypeField;
+
+ private string networkNameField;
+
+ private string nIPNetworkProviderNameField;
+
+ private SatellitePositionType satellitePositionField;
+
+ private ushort nIPNetworkIDField;
+
+ private NIPStreamType[] nIPStreamField;
+
+ ///
+ public BroadcastNetworkTypeNetworkType NetworkType {
+ get {
+ return this.networkTypeField;
+ }
+ set {
+ this.networkTypeField = value;
+ }
+ }
+
+ ///
+ public string NetworkName {
+ get {
+ return this.networkNameField;
+ }
+ set {
+ this.networkNameField = value;
+ }
+ }
+
+ ///
+ public string NIPNetworkProviderName {
+ get {
+ return this.nIPNetworkProviderNameField;
+ }
+ set {
+ this.nIPNetworkProviderNameField = value;
+ }
+ }
+
+ ///
+ public SatellitePositionType SatellitePosition {
+ get {
+ return this.satellitePositionField;
+ }
+ set {
+ this.satellitePositionField = value;
+ }
+ }
+
+ ///
+ public ushort NIPNetworkID {
+ get {
+ return this.nIPNetworkIDField;
+ }
+ set {
+ this.nIPNetworkIDField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("NIPStream")]
+ public NIPStreamType[] NIPStream {
+ get {
+ return this.nIPStreamField;
+ }
+ set {
+ this.nIPStreamField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2023")]
+ public enum BroadcastNetworkTypeNetworkType {
+
+ ///
+ Satellite,
+
+ ///
+ Terrestrial,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ public partial class SatellitePositionType {
+
+ private double orbitalPositionField;
+
+ private SatellitePositionTypeWest_East_flag west_East_flagField;
+
+ ///
+ public double OrbitalPosition {
+ get {
+ return this.orbitalPositionField;
+ }
+ set {
+ this.orbitalPositionField = value;
+ }
+ }
+
+ ///
+ public SatellitePositionTypeWest_East_flag West_East_flag {
+ get {
+ return this.west_East_flagField;
+ }
+ set {
+ this.west_East_flagField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2023")]
+ public enum SatellitePositionTypeWest_East_flag {
+
+ ///
+ West,
+
+ ///
+ East,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ public partial class NIPStreamType {
+
+ private NIPStreamTypeLinkLayerFormat linkLayerFormatField;
+
+ private string nIPStreamProviderNameField;
+
+ private string nIPCarrierIDField;
+
+ private string nIPLinkIDField;
+
+ private ushort nIPServiceIDField;
+
+ private NIPStreamTypeBootstrapStream bootstrapStreamField;
+
+ ///
+ public NIPStreamTypeLinkLayerFormat LinkLayerFormat {
+ get {
+ return this.linkLayerFormatField;
+ }
+ set {
+ this.linkLayerFormatField = value;
+ }
+ }
+
+ ///
+ public string NIPStreamProviderName {
+ get {
+ return this.nIPStreamProviderNameField;
+ }
+ set {
+ this.nIPStreamProviderNameField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="positiveInteger")]
+ public string NIPCarrierID {
+ get {
+ return this.nIPCarrierIDField;
+ }
+ set {
+ this.nIPCarrierIDField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string NIPLinkID {
+ get {
+ return this.nIPLinkIDField;
+ }
+ set {
+ this.nIPLinkIDField = value;
+ }
+ }
+
+ ///
+ public ushort NIPServiceID {
+ get {
+ return this.nIPServiceIDField;
+ }
+ set {
+ this.nIPServiceIDField = value;
+ }
+ }
+
+ ///
+ public NIPStreamTypeBootstrapStream BootstrapStream {
+ get {
+ return this.bootstrapStreamField;
+ }
+ set {
+ this.bootstrapStreamField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2023")]
+ public enum NIPStreamTypeLinkLayerFormat {
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("GSE-Lite")]
+ GSELite,
+
+ ///
+ TS,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2023")]
+ public partial class NIPStreamTypeBootstrapStream {
+
+ private NIPStreamTypeBootstrapStreamBootstrapType bootstrapTypeField;
+
+ private NIPStreamTypeBootstrapStreamStatus statusField;
+
+ ///
+ public NIPStreamTypeBootstrapStreamBootstrapType BootstrapType {
+ get {
+ return this.bootstrapTypeField;
+ }
+ set {
+ this.bootstrapTypeField = value;
+ }
+ }
+
+ ///
+ public NIPStreamTypeBootstrapStreamStatus Status {
+ get {
+ return this.statusField;
+ }
+ set {
+ this.statusField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2023")]
+ public enum NIPStreamTypeBootstrapStreamBootstrapType {
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Physical Network")]
+ PhysicalNetwork,
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Commercial Operator")]
+ CommercialOperator,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2023")]
+ public enum NIPStreamTypeBootstrapStreamStatus {
+
+ ///
+ Active,
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Not Active")]
+ NotActive,
+
+ ///
+ Deprecated,
+ }
+}
diff --git a/Documentation/NetworkInformationFile-XSD/NetworkInformationFile.xsd b/Documentation/NetworkInformationFile-XSD/NetworkInformationFile.xsd
new file mode 100644
index 0000000..fb9b5a4
--- /dev/null
+++ b/Documentation/NetworkInformationFile-XSD/NetworkInformationFile.xsd
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Documentation/NetworkInformationFile-XSD/make-classes.bat b/Documentation/NetworkInformationFile-XSD/make-classes.bat
new file mode 100644
index 0000000..c6cd0bb
--- /dev/null
+++ b/Documentation/NetworkInformationFile-XSD/make-classes.bat
@@ -0,0 +1,3 @@
+"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8.1 Tools\x64\xsd.exe" /classes NetworkInformationFile.xsd /namespace:skyscraper8.DvbNip
+
+pause
\ No newline at end of file
diff --git a/Documentation/PrivateDataSignallingManifest/PrivateDataSignalling.cs b/Documentation/PrivateDataSignallingManifest/PrivateDataSignalling.cs
new file mode 100644
index 0000000..1766c34
--- /dev/null
+++ b/Documentation/PrivateDataSignallingManifest/PrivateDataSignalling.cs
@@ -0,0 +1,134 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+//
+// This source code was auto-generated by xsd, Version=4.8.9037.0.
+//
+namespace skyscraper8.DvbNip {
+ using System.Xml.Serialization;
+
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ [System.Xml.Serialization.XmlRootAttribute("PrivateDataSignallingManifest", Namespace="urn:dvb:metadata:nativeip:2023", IsNullable=false)]
+ public partial class PrivateDataSignallingManifestType {
+
+ private System.DateTime versionUpdateField;
+
+ private PrivateDataProviderType[] privateDataProviderField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("PrivateDataProvider")]
+ public PrivateDataProviderType[] PrivateDataProvider {
+ get {
+ return this.privateDataProviderField;
+ }
+ set {
+ this.privateDataProviderField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ public partial class PrivateDataProviderType {
+
+ private PrivateDataSessionType[] privateDataSessionField;
+
+ private byte[] privateDataProviderIDField;
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("PrivateDataSession")]
+ public PrivateDataSessionType[] PrivateDataSession {
+ get {
+ return this.privateDataSessionField;
+ }
+ set {
+ this.privateDataSessionField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlAttributeAttribute(DataType="hexBinary")]
+ public byte[] privateDataProviderID {
+ get {
+ return this.privateDataProviderIDField;
+ }
+ set {
+ this.privateDataProviderIDField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ public partial class PrivateDataSessionType {
+
+ private System.DateTime versionUpdateField;
+
+ private bool versionUpdateFieldSpecified;
+
+ private string[] tagRefField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlIgnoreAttribute()]
+ public bool VersionUpdateSpecified {
+ get {
+ return this.versionUpdateFieldSpecified;
+ }
+ set {
+ this.versionUpdateFieldSpecified = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("TagRef", DataType="anyURI")]
+ public string[] TagRef {
+ get {
+ return this.tagRefField;
+ }
+ set {
+ this.tagRefField = value;
+ }
+ }
+ }
+}
diff --git a/Documentation/PrivateDataSignallingManifest/PrivateDataSignalling.xsd b/Documentation/PrivateDataSignallingManifest/PrivateDataSignalling.xsd
new file mode 100644
index 0000000..edab7d4
--- /dev/null
+++ b/Documentation/PrivateDataSignallingManifest/PrivateDataSignalling.xsd
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Documentation/PrivateDataSignallingManifest/make-classes.bat b/Documentation/PrivateDataSignallingManifest/make-classes.bat
new file mode 100644
index 0000000..1129ee4
--- /dev/null
+++ b/Documentation/PrivateDataSignallingManifest/make-classes.bat
@@ -0,0 +1 @@
+"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8.1 Tools\x64\xsd.exe" /classes PrivateDataSignalling.xsd /namespace:skyscraper8.DvbNip
\ No newline at end of file
diff --git a/Documentation/ServiceInformationFile-XSD/ServiceInformationFile.cs b/Documentation/ServiceInformationFile-XSD/ServiceInformationFile.cs
new file mode 100644
index 0000000..e3d39d4
--- /dev/null
+++ b/Documentation/ServiceInformationFile-XSD/ServiceInformationFile.cs
@@ -0,0 +1,235 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+//
+// This source code was auto-generated by xsd, Version=4.8.9037.0.
+//
+namespace skyscraper8.DvbNip {
+ using System.Xml.Serialization;
+
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ [System.Xml.Serialization.XmlRootAttribute("ServiceInformationFile", Namespace="urn:dvb:metadata:nativeip:2023", IsNullable=false)]
+ public partial class ServiceInformationFileType {
+
+ private System.DateTime versionUpdateField;
+
+ private string nIPNetworkProviderNameField;
+
+ private BroadcastMediaStreamType[] broadcastMediaStreamField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ public string NIPNetworkProviderName {
+ get {
+ return this.nIPNetworkProviderNameField;
+ }
+ set {
+ this.nIPNetworkProviderNameField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("BroadcastMediaStream")]
+ public BroadcastMediaStreamType[] BroadcastMediaStream {
+ get {
+ return this.broadcastMediaStreamField;
+ }
+ set {
+ this.broadcastMediaStreamField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ public partial class BroadcastMediaStreamType {
+
+ private ushort nIPNetworkIDField;
+
+ private string nIPCarrierIDField;
+
+ private string nIPLinkIDField;
+
+ private ushort nIPServiceIDField;
+
+ private BroadcastMediaStreamTypeBroadcastMedia broadcastMediaField;
+
+ ///
+ public ushort NIPNetworkID {
+ get {
+ return this.nIPNetworkIDField;
+ }
+ set {
+ this.nIPNetworkIDField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="positiveInteger")]
+ public string NIPCarrierID {
+ get {
+ return this.nIPCarrierIDField;
+ }
+ set {
+ this.nIPCarrierIDField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string NIPLinkID {
+ get {
+ return this.nIPLinkIDField;
+ }
+ set {
+ this.nIPLinkIDField = value;
+ }
+ }
+
+ ///
+ public ushort NIPServiceID {
+ get {
+ return this.nIPServiceIDField;
+ }
+ set {
+ this.nIPServiceIDField = value;
+ }
+ }
+
+ ///
+ public BroadcastMediaStreamTypeBroadcastMedia BroadcastMedia {
+ get {
+ return this.broadcastMediaField;
+ }
+ set {
+ this.broadcastMediaField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2023")]
+ public partial class BroadcastMediaStreamTypeBroadcastMedia {
+
+ private string[] uRIField;
+
+ private InteractiveApplicationsType[] interactiveApplicationsField;
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("URI")]
+ public string[] URI {
+ get {
+ return this.uRIField;
+ }
+ set {
+ this.uRIField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("InteractiveApplications")]
+ public InteractiveApplicationsType[] InteractiveApplications {
+ get {
+ return this.interactiveApplicationsField;
+ }
+ set {
+ this.interactiveApplicationsField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ public partial class InteractiveApplicationsType {
+
+ private InteractiveApplicationsTypeApplicationType applicationTypeField;
+
+ private string applicationIDField;
+
+ private string applicationURIField;
+
+ ///
+ public InteractiveApplicationsTypeApplicationType ApplicationType {
+ get {
+ return this.applicationTypeField;
+ }
+ set {
+ this.applicationTypeField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="integer")]
+ public string ApplicationID {
+ get {
+ return this.applicationIDField;
+ }
+ set {
+ this.applicationIDField = value;
+ }
+ }
+
+ ///
+ public string ApplicationURI {
+ get {
+ return this.applicationURIField;
+ }
+ set {
+ this.applicationURIField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2023")]
+ public enum InteractiveApplicationsTypeApplicationType {
+
+ ///
+ HbbTV,
+
+ ///
+ MHP,
+
+ ///
+ MHEG5,
+
+ ///
+ Proprietary,
+ }
+}
diff --git a/Documentation/ServiceInformationFile-XSD/ServiceInformationFile.xsd b/Documentation/ServiceInformationFile-XSD/ServiceInformationFile.xsd
new file mode 100644
index 0000000..86e9bfe
--- /dev/null
+++ b/Documentation/ServiceInformationFile-XSD/ServiceInformationFile.xsd
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Documentation/ServiceInformationFile-XSD/make-classes.bat b/Documentation/ServiceInformationFile-XSD/make-classes.bat
new file mode 100644
index 0000000..4a855e8
--- /dev/null
+++ b/Documentation/ServiceInformationFile-XSD/make-classes.bat
@@ -0,0 +1,3 @@
+"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8.1 Tools\x64\xsd.exe" /classes ServiceInformationFile.xsd /namespace:skyscraper8.DvbNip
+
+pause
\ No newline at end of file
diff --git a/Documentation/TimeOffserFile-XSD/TimeOffsetFile.cs b/Documentation/TimeOffserFile-XSD/TimeOffsetFile.cs
new file mode 100644
index 0000000..1c3bd4b
--- /dev/null
+++ b/Documentation/TimeOffserFile-XSD/TimeOffsetFile.cs
@@ -0,0 +1,127 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+//
+// This source code was auto-generated by xsd, Version=4.8.9037.0.
+//
+namespace skyscraper8.DvbNip {
+ using System.Xml.Serialization;
+
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2023")]
+ [System.Xml.Serialization.XmlRootAttribute("TimeOffsetFile", Namespace="urn:dvb:metadata:nativeip:2023", IsNullable=false)]
+ public partial class TimeOffsetFileType {
+
+ private System.DateTime versionUpdateField;
+
+ private string country_codeField;
+
+ private string country_region_IdField;
+
+ private bool local_time_offset_polarityField;
+
+ private string local_time_offset_valueField;
+
+ private System.DateTime time_of_changeField;
+
+ private bool time_of_changeFieldSpecified;
+
+ private string next_time_offset_valueField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ public string country_code {
+ get {
+ return this.country_codeField;
+ }
+ set {
+ this.country_codeField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string country_region_Id {
+ get {
+ return this.country_region_IdField;
+ }
+ set {
+ this.country_region_IdField = value;
+ }
+ }
+
+ ///
+ public bool local_time_offset_polarity {
+ get {
+ return this.local_time_offset_polarityField;
+ }
+ set {
+ this.local_time_offset_polarityField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string local_time_offset_value {
+ get {
+ return this.local_time_offset_valueField;
+ }
+ set {
+ this.local_time_offset_valueField = value;
+ }
+ }
+
+ ///
+ public System.DateTime time_of_change {
+ get {
+ return this.time_of_changeField;
+ }
+ set {
+ this.time_of_changeField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlIgnoreAttribute()]
+ public bool time_of_changeSpecified {
+ get {
+ return this.time_of_changeFieldSpecified;
+ }
+ set {
+ this.time_of_changeFieldSpecified = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string next_time_offset_value {
+ get {
+ return this.next_time_offset_valueField;
+ }
+ set {
+ this.next_time_offset_valueField = value;
+ }
+ }
+ }
+}
diff --git a/Documentation/TimeOffserFile-XSD/TimeOffsetFile.xsd b/Documentation/TimeOffserFile-XSD/TimeOffsetFile.xsd
new file mode 100644
index 0000000..80452a8
--- /dev/null
+++ b/Documentation/TimeOffserFile-XSD/TimeOffsetFile.xsd
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Documentation/TimeOffserFile-XSD/make-classes.bat b/Documentation/TimeOffserFile-XSD/make-classes.bat
new file mode 100644
index 0000000..ce9b54d
--- /dev/null
+++ b/Documentation/TimeOffserFile-XSD/make-classes.bat
@@ -0,0 +1,3 @@
+"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8.1 Tools\x64\xsd.exe" /classes TimeOffsetFile.xsd /namespace:skyscraper8.DvbNip
+
+pause
\ No newline at end of file
diff --git a/skyscraper8/DvbI/DvbIFilesystemProcessor.cs b/skyscraper8/DvbI/DvbIFilesystemProcessor.cs
index 032a89f..b6d9543 100644
--- a/skyscraper8/DvbI/DvbIFilesystemProcessor.cs
+++ b/skyscraper8/DvbI/DvbIFilesystemProcessor.cs
@@ -47,6 +47,7 @@ namespace skyscraper8.DvbI
DvbIDataStorage dataStorage = (DvbIDataStorage)context.DataStorage;
long sourceHash = context.GetSourceHash();
+
if (dataStorage.TestForDvbiServiceListEntryPoints(sourceHash))
{
DateTime lastChecked = dataStorage.GetLastDvbiServiceListEntryPointUpdateDate(sourceHash);
diff --git a/skyscraper8/DvbI/DvbIUtils.cs b/skyscraper8/DvbI/DvbIUtils.cs
index 97c0063..1766056 100644
--- a/skyscraper8/DvbI/DvbIUtils.cs
+++ b/skyscraper8/DvbI/DvbIUtils.cs
@@ -2,9 +2,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
+using static skyscraper5.src.InteractionChannel.Model.Rmt;
namespace skyscraper8.DvbI
{
@@ -15,11 +17,16 @@ namespace skyscraper8.DvbI
private static XmlSerializer serviceListEntryPointSerializer;
public static ServiceListEntryPoints UnpackServiceListEntryPoints(byte[] buffer)
+ {
+ MemoryStream slepStream = new MemoryStream(buffer, false);
+ return UnpackServiceListEntryPoints(slepStream);
+ }
+
+ public static ServiceListEntryPoints UnpackServiceListEntryPoints(Stream slepStream)
{
if (serviceListEntryPointSerializer == null)
serviceListEntryPointSerializer = new XmlSerializer(typeof(ServiceListEntryPoints));
- MemoryStream slepStream = new MemoryStream(buffer, false);
object slepWrapped = serviceListEntryPointSerializer.Deserialize(slepStream);
ServiceListEntryPoints serviceListEntryPoint = (ServiceListEntryPoints)slepWrapped;
return serviceListEntryPoint;
@@ -226,5 +233,36 @@ namespace skyscraper8.DvbI
}
return null;
}
+
+
+ public static long GetSourceHash(ServiceListEntryPointSource source, ushort originalNetworkId, ushort transportStreamId, int pid)
+ {
+ long result = (int)source;
+ switch (source)
+ {
+ case ServiceListEntryPointSource.TransportStream:
+ case ServiceListEntryPointSource.DvbNip:
+ result <<= 4;
+ result += originalNetworkId;
+ result <<= 16;
+ result += transportStreamId;
+ result <<= 16;
+ result += pid;
+ return result;
+ default:
+ throw new NotImplementedException(source.ToString());
+ }
+ }
+
+ public static ServiceListEntryPoints UnpackServiceListEntryPoints(string rawSlepString)
+ {
+ if (serviceListEntryPointSerializer == null)
+ serviceListEntryPointSerializer = new XmlSerializer(typeof(ServiceListEntryPoints));
+
+ StringReader stringReader = new StringReader(rawSlepString);
+ object slepWrapped = serviceListEntryPointSerializer.Deserialize(stringReader);
+ ServiceListEntryPoints serviceListEntryPoint = (ServiceListEntryPoints)slepWrapped;
+ return serviceListEntryPoint;
+ }
}
}
diff --git a/skyscraper8/DvbI/Model/DVB-I_slep_DVB-I_slep_app1_DVB-I_slep_app2_DVB-I_slep_app3.cs b/skyscraper8/DvbI/Model/DVB-I_slep_DVB-I_slep_app1_DVB-I_slep_app2_DVB-I_slep_app3.cs
index dc61f32..08e019b 100644
--- a/skyscraper8/DvbI/Model/DVB-I_slep_DVB-I_slep_app1_DVB-I_slep_app2_DVB-I_slep_app3.cs
+++ b/skyscraper8/DvbI/Model/DVB-I_slep_DVB-I_slep_app1_DVB-I_slep_app2_DVB-I_slep_app3.cs
@@ -226,7 +226,7 @@ namespace moe.yo3explorer.skyscraper8.DVBI.Model {
private string contentTypeField;
///
- [System.Xml.Serialization.XmlElementAttribute(Namespace="urn:dvb:metadata:servicediscovery-types:2023")]
+ //[System.Xml.Serialization.XmlElementAttribute(Namespace="urn:dvb:metadata:servicediscovery-types:2023")]
public string URI {
get {
return this.uRIField;
diff --git a/skyscraper8/DvbI/ServiceListEntryPointSource.cs b/skyscraper8/DvbI/ServiceListEntryPointSource.cs
index 50d7ec3..dc688c1 100644
--- a/skyscraper8/DvbI/ServiceListEntryPointSource.cs
+++ b/skyscraper8/DvbI/ServiceListEntryPointSource.cs
@@ -8,6 +8,7 @@ namespace skyscraper8.DvbI
{
internal enum ServiceListEntryPointSource
{
- TransportStream
+ TransportStream,
+ DvbNip
}
}
diff --git a/skyscraper8/DvbNip/DvbNipEventHandler.cs b/skyscraper8/DvbNip/DvbNipEventHandler.cs
index ba8e640..7fa2403 100644
--- a/skyscraper8/DvbNip/DvbNipEventHandler.cs
+++ b/skyscraper8/DvbNip/DvbNipEventHandler.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using moe.yo3explorer.skyscraper8.DVBI.Model;
namespace skyscraper8.DvbNip
{
@@ -13,5 +14,14 @@ namespace skyscraper8.DvbNip
void FluteFileDownloadProgress(NipActualCarrierInformation currentCarrierInformation, ulong destinationTsi, ulong destinationToi, double progress, FileType fileAssociation);
void OnMulticastGatewayConfiguration(NipActualCarrierInformation currentCarrierInformation, MulticastGatewayConfigurationType multicastGatewayConfiguration);
void OnNipCarrierDetected(NipActualCarrierInformation currentCarrierInformation);
+ bool IsFileNeeded(string announcedFileContentLocation);
+ void OnPrivateDataSignallingManifest(NipActualCarrierInformation currentCarrierInformation, PrivateDataSignallingManifestType privateDataSignallingManifest);
+ void OnServiceListEntryPoints(NipActualCarrierInformation currentCarrierInformation,
+ ServiceListEntryPoints serviceListEntryPoints, DateTime currentTime, DvbNipServiceListNotifier dvbNipReceiver);
+
+ void OnServiceList(NipActualCarrierInformation currentCarrierInformation, string serviceListId, ServiceListType serviceList);
+ void OnTimeOffsetFile(NipActualCarrierInformation currentCarrierInformation, TimeOffsetFileType timeOffsetFile);
+ void OnNetworkInformationFile(NipActualCarrierInformation currentCarrierInformation, NetworkInformationFileType networkInformationFile);
+ void OnServiceInformationFile(NipActualCarrierInformation currentCarrierInformation, ServiceInformationFileType serviceInformationFile);
}
}
diff --git a/skyscraper8/DvbNip/DvbNipReceiver.cs b/skyscraper8/DvbNip/DvbNipReceiver.cs
index 17bd068..119dde7 100644
--- a/skyscraper8/DvbNip/DvbNipReceiver.cs
+++ b/skyscraper8/DvbNip/DvbNipReceiver.cs
@@ -10,11 +10,13 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
+using moe.yo3explorer.skyscraper8.DVBI.Model;
+using skyscraper8.DvbI;
namespace skyscraper8.DvbNip
{
[SkyscraperPlugin]
- internal class DvbNipReceiver : ISkyscraperMpePlugin
+ internal class DvbNipReceiver : ISkyscraperMpePlugin, DvbNipServiceListNotifier
{
private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name);
@@ -62,6 +64,10 @@ namespace skyscraper8.DvbNip
}
UserDatagram udpPacket = new UserDatagram(ipv4Packet);
LctFrame lctFrame = new LctFrame(udpPacket.Payload);
+ if (lctFrame.LctHeader.TimeExtenstion != null)
+ {
+ this.currentTime = lctFrame.LctHeader.TimeExtenstion.Sct;
+ }
if (flutes == null)
flutes = new Dictionary, FluteListener>();
@@ -108,19 +114,26 @@ namespace skyscraper8.DvbNip
{
return;
}
- if (fluteListener.FileAssociation.ContentLocation.Equals("urn:dvb:metadata:cs:MulticastTransportObjectTypeCS:2021:gateway-configuration"))
+ if (fluteListener.FileAssociation.ContentLocation.StartsWith("urn:dvb:"))
{
- if(CurrentCarrierInformation != null)
- {
- MulticastGatewayConfigurationType multicastGatewayConfiguration = DvbNipUtilities.UnpackMulticastGatewayConfiguration(fluteListener.ToStream());
- EventHandler?.OnMulticastGatewayConfiguration(CurrentCarrierInformation, multicastGatewayConfiguration);
- fluteListener.Disabled = true;
- }
+ HandleMetadata(fluteListener);
+ fluteListener.Disabled = true;
return;
}
if (CurrentCarrierInformation != null)
{
+ if (serviceListUrls != null)
+ {
+ if (serviceListUrls.ContainsKey(fluteListener.FileAssociation.ContentLocation))
+ {
+ string serviceListId = serviceListUrls[fluteListener.FileAssociation.ContentLocation];
+ Stream serviceListStream = fluteListener.ToStream();
+ byte[] serviceListByteArray = new byte[serviceListStream.Length];
+ ServiceListType serviceList = DvbIUtils.UnpackServiceList(serviceListByteArray);
+ EventHandler.OnServiceList(CurrentCarrierInformation, serviceListId, serviceList);
+ }
+ }
EventHandler?.FluteFileArrival(CurrentCarrierInformation, fluteListener);
fluteListener.Disabled = true;
}
@@ -140,6 +153,54 @@ namespace skyscraper8.DvbNip
}
}
+ private DateTime? currentTime;
+ private bool HandleMetadata(FluteListener fluteListener)
+ {
+ switch (fluteListener.FileAssociation.ContentLocation)
+ {
+ case "urn:dvb:metadata:cs:MulticastTransportObjectTypeCS:2021:gateway-configuration":
+ MulticastGatewayConfigurationType multicastGatewayConfiguration = DvbNipUtilities.UnpackMulticastGatewayConfiguration(fluteListener.ToStream());
+ EventHandler?.OnMulticastGatewayConfiguration(CurrentCarrierInformation, multicastGatewayConfiguration);
+ return true;
+ case "urn:dvb:metadata:nativeip:PrivateDataSignalling":
+ PrivateDataSignallingManifestType privateDataSignallingManifest = DvbNipUtilities.UnpackPrivateDataSignallingManifest(fluteListener.ToStream());
+ EventHandler?.OnPrivateDataSignallingManifest(CurrentCarrierInformation, privateDataSignallingManifest);
+ return true;
+ case "urn:dvb:metadata:nativeip:dvb-i-slep":
+ if (currentTime.HasValue)
+ {
+ Stream rawSlepStream = fluteListener.ToStream();
+ byte[] rawSlepBytes = new byte[rawSlepStream.Length];
+ rawSlepStream.Read(rawSlepBytes, 0, (int)rawSlepStream.Length);
+ string rawSlepString = Encoding.UTF8.GetString(rawSlepBytes);
+ rawSlepString = rawSlepString.Replace(" 10)
+ {
+ logger.DebugFormat(String.Format(
+ "Removed {0} stale segments from FLUTE cache. Cache slimmed from {1} to {2} items.",
+ staleListeners.Count, prevItems, nowItems));
+ }
}
}
@@ -170,6 +236,14 @@ namespace skyscraper8.DvbNip
if (string.IsNullOrEmpty(announcedFile.TOI))
continue;
+ bool needed = EventHandler.IsFileNeeded(announcedFile.ContentLocation);
+ if (serviceListUrls != null)
+ {
+ if (serviceListUrls.ContainsKey(announcedFile.ContentLocation))
+ {
+ needed = true;
+ }
+ }
ulong targetToi = ulong.Parse(announcedFile.TOI);
Tuple fluteCoordinate = new Tuple(sourceListener.DestinationAddress, sourceListener.DestinationPort, sourceListener.DestinationTsi, targetToi);
if (flutes.ContainsKey(fluteCoordinate))
@@ -180,6 +254,9 @@ namespace skyscraper8.DvbNip
listener.FileAssociation = announcedFile;
result = true;
}
+
+ if (!needed)
+ listener.Disabled = true;
}
else
{
@@ -187,27 +264,9 @@ namespace skyscraper8.DvbNip
listener.FileAssociation = announcedFile;
flutes.Add(fluteCoordinate, listener);
result = true;
+ if (!needed)
+ listener.Disabled = true;
}
- /*FluteListener? targetListener = flutes.Find(x =>
- x.DestinationAddress.Equals(sourceListener.DestinationAddress) &&
- x.DestinationPort == sourceListener.DestinationPort &&
- x.DestinationTsi == sourceListener.DestinationTsi &&
- x.DestinationToi == targetToi);
- if (targetListener != null)
- {
- if (targetListener.FileAssociation != null)
- {
- targetListener.FileAssociation = announcedFile;
- result = true;
- }
- }
- else
- {
- targetListener = new FluteListener(sourceListener.DestinationAddress, sourceListener.DestinationPort, sourceListener.DestinationTsi, targetToi);
- targetListener.FileAssociation = announcedFile;
- flutes.Add(targetListener);
- result = true;
- }*/
}
return result;
@@ -230,5 +289,33 @@ namespace skyscraper8.DvbNip
public NipActualCarrierInformation CurrentCarrierInformation { get; private set; }
public IDvbNipEventHandler EventHandler { get; private set; }
+
+ private Dictionary serviceListUrls;
+ public void AddServiceListUrl(string url, string id)
+ {
+ if (serviceListUrls == null)
+ serviceListUrls = new Dictionary();
+
+ if (!serviceListUrls.ContainsKey(url))
+ {
+ serviceListUrls.Add(url, id);
+
+ KeyValuePair, FluteListener> keyValuePair = flutes
+ .Where(x => x.Value.FileAssociation != null)
+ .Where(x => x.Value.FileAssociation.ContentLocation.Equals(url))
+ .FirstOrDefault();
+ if (keyValuePair.Key != null)
+ {
+ flutes.Remove(keyValuePair.Key);
+ }
+ }
+
+ }
+
+ private long sourceHash;
+ public void SetSourceHash(long sourceHash)
+ {
+ this.sourceHash = sourceHash;
+ }
}
}
diff --git a/skyscraper8/DvbNip/DvbNipServiceListNotifier.cs b/skyscraper8/DvbNip/DvbNipServiceListNotifier.cs
new file mode 100644
index 0000000..cc25ffc
--- /dev/null
+++ b/skyscraper8/DvbNip/DvbNipServiceListNotifier.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace skyscraper8.DvbNip
+{
+ public interface DvbNipServiceListNotifier
+ {
+ void AddServiceListUrl(string url, string id);
+ void SetSourceHash(long sourceHash);
+ }
+}
diff --git a/skyscraper8/DvbNip/DvbNipUtilities.cs b/skyscraper8/DvbNip/DvbNipUtilities.cs
index 636e28c..2bc2799 100644
--- a/skyscraper8/DvbNip/DvbNipUtilities.cs
+++ b/skyscraper8/DvbNip/DvbNipUtilities.cs
@@ -57,5 +57,58 @@ namespace skyscraper8.DvbNip
{
return IsContinuousFileType(Path.GetExtension(filteType.ContentLocation));
}
+
+ private static XmlSerializer privateDataSignallingManifestXmlSerializer;
+ public static PrivateDataSignallingManifestType UnpackPrivateDataSignallingManifest(Stream toStream)
+ {
+ if (privateDataSignallingManifestXmlSerializer == null)
+ {
+ privateDataSignallingManifestXmlSerializer = new XmlSerializer(typeof(PrivateDataSignallingManifestType));
+ }
+
+ object v = privateDataSignallingManifestXmlSerializer.Deserialize(toStream);
+ PrivateDataSignallingManifestType result = (PrivateDataSignallingManifestType)v;
+ return result;
+ }
+
+ private static XmlSerializer timeOffsetFileXmlSerializer;
+
+ public static TimeOffsetFileType UnpackTimeOffsetFile(Stream toStream)
+ {
+ if (timeOffsetFileXmlSerializer == null)
+ {
+ timeOffsetFileXmlSerializer = new XmlSerializer(typeof(TimeOffsetFileType));
+ }
+
+ object v = timeOffsetFileXmlSerializer.Deserialize(toStream);
+ TimeOffsetFileType result = (TimeOffsetFileType)v;
+ return result;
+ }
+
+ private static XmlSerializer networkInformationFileXmlSerializer;
+ public static NetworkInformationFileType UnpackNetworkInformationFile(Stream toStream)
+ {
+ if (networkInformationFileXmlSerializer == null)
+ {
+ networkInformationFileXmlSerializer = new XmlSerializer(typeof(NetworkInformationFileType));
+ }
+
+ object v = networkInformationFileXmlSerializer.Deserialize(toStream);
+ NetworkInformationFileType result = (NetworkInformationFileType)v;
+ return result;
+ }
+
+ private static XmlSerializer serviceInformationFileXmlSerializer;
+ public static ServiceInformationFileType UnpackServiceInformationFile(Stream toStream)
+ {
+ if (serviceInformationFileXmlSerializer == null)
+ {
+ serviceInformationFileXmlSerializer = new XmlSerializer(typeof(ServiceInformationFileType));
+ }
+
+ object v = serviceInformationFileXmlSerializer.Deserialize(toStream);
+ ServiceInformationFileType result = (ServiceInformationFileType)v;
+ return result;
+ }
}
}
diff --git a/skyscraper8/DvbNip/NipActualCarrierInformation.cs b/skyscraper8/DvbNip/NipActualCarrierInformation.cs
index 0f78d59..a2e1b6c 100644
--- a/skyscraper8/DvbNip/NipActualCarrierInformation.cs
+++ b/skyscraper8/DvbNip/NipActualCarrierInformation.cs
@@ -26,5 +26,23 @@ namespace skyscraper8.DvbNip
public ushort NipLinkId { get; }
public ushort NipServiceId { get; }
public string NipStreamProviderName { get; }
+
+ protected bool Equals(NipActualCarrierInformation other)
+ {
+ return NipNetworkId == other.NipNetworkId && NipCarrierId == other.NipCarrierId && NipLinkId == other.NipLinkId && NipServiceId == other.NipServiceId;
+ }
+
+ public override bool Equals(object? obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((NipActualCarrierInformation)obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(NipNetworkId, NipCarrierId, NipLinkId, NipServiceId);
+ }
}
}
diff --git a/skyscraper8/DvbNip/XmlSchema/NetworkInformationFile.cs b/skyscraper8/DvbNip/XmlSchema/NetworkInformationFile.cs
new file mode 100644
index 0000000..7ed86cb
--- /dev/null
+++ b/skyscraper8/DvbNip/XmlSchema/NetworkInformationFile.cs
@@ -0,0 +1,394 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+//
+// This source code was auto-generated by xsd, Version=4.8.9037.0.
+//
+namespace skyscraper8.DvbNip {
+ using System.Xml.Serialization;
+
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ [System.Xml.Serialization.XmlRootAttribute("NetworkInformationFile", Namespace="urn:dvb:metadata:nativeip:2024", IsNullable=false)]
+ public partial class NetworkInformationFileType {
+
+ private System.DateTime versionUpdateField;
+
+ private NetworkInformationFileTypeNIFType nIFTypeField;
+
+ private BroadcastNetworkType actualBroadcastNetworkField;
+
+ private BroadcastNetworkType[] otherBroadcastNetworkField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ public NetworkInformationFileTypeNIFType NIFType {
+ get {
+ return this.nIFTypeField;
+ }
+ set {
+ this.nIFTypeField = value;
+ }
+ }
+
+ ///
+ public BroadcastNetworkType ActualBroadcastNetwork {
+ get {
+ return this.actualBroadcastNetworkField;
+ }
+ set {
+ this.actualBroadcastNetworkField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("OtherBroadcastNetwork")]
+ public BroadcastNetworkType[] OtherBroadcastNetwork {
+ get {
+ return this.otherBroadcastNetworkField;
+ }
+ set {
+ this.otherBroadcastNetworkField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2024")]
+ public enum NetworkInformationFileTypeNIFType {
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Physical Network")]
+ PhysicalNetwork,
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Commercial Operator")]
+ CommercialOperator,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ public partial class BroadcastNetworkType {
+
+ private BroadcastNetworkTypeNetworkType networkTypeField;
+
+ private string networkNameField;
+
+ private string nIPNetworkProviderNameField;
+
+ private SatellitePositionType satellitePositionField;
+
+ private ushort nIPNetworkIDField;
+
+ private NIPStreamType[] nIPStreamField;
+
+ ///
+ public BroadcastNetworkTypeNetworkType NetworkType {
+ get {
+ return this.networkTypeField;
+ }
+ set {
+ this.networkTypeField = value;
+ }
+ }
+
+ ///
+ public string NetworkName {
+ get {
+ return this.networkNameField;
+ }
+ set {
+ this.networkNameField = value;
+ }
+ }
+
+ ///
+ public string NIPNetworkProviderName {
+ get {
+ return this.nIPNetworkProviderNameField;
+ }
+ set {
+ this.nIPNetworkProviderNameField = value;
+ }
+ }
+
+ ///
+ public SatellitePositionType SatellitePosition {
+ get {
+ return this.satellitePositionField;
+ }
+ set {
+ this.satellitePositionField = value;
+ }
+ }
+
+ ///
+ public ushort NIPNetworkID {
+ get {
+ return this.nIPNetworkIDField;
+ }
+ set {
+ this.nIPNetworkIDField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("NIPStream")]
+ public NIPStreamType[] NIPStream {
+ get {
+ return this.nIPStreamField;
+ }
+ set {
+ this.nIPStreamField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2024")]
+ public enum BroadcastNetworkTypeNetworkType {
+
+ ///
+ Satellite,
+
+ ///
+ Terrestrial,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ public partial class SatellitePositionType {
+
+ private double orbitalPositionField;
+
+ private SatellitePositionTypeWest_East_flag west_East_flagField;
+
+ ///
+ public double OrbitalPosition {
+ get {
+ return this.orbitalPositionField;
+ }
+ set {
+ this.orbitalPositionField = value;
+ }
+ }
+
+ ///
+ public SatellitePositionTypeWest_East_flag West_East_flag {
+ get {
+ return this.west_East_flagField;
+ }
+ set {
+ this.west_East_flagField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2024")]
+ public enum SatellitePositionTypeWest_East_flag {
+
+ ///
+ West,
+
+ ///
+ East,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ public partial class NIPStreamType {
+
+ private NIPStreamTypeLinkLayerFormat linkLayerFormatField;
+
+ private string nIPStreamProviderNameField;
+
+ private string nIPCarrierIDField;
+
+ private string nIPLinkIDField;
+
+ private ushort nIPServiceIDField;
+
+ private NIPStreamTypeBootstrapStream bootstrapStreamField;
+
+ ///
+ public NIPStreamTypeLinkLayerFormat LinkLayerFormat {
+ get {
+ return this.linkLayerFormatField;
+ }
+ set {
+ this.linkLayerFormatField = value;
+ }
+ }
+
+ ///
+ public string NIPStreamProviderName {
+ get {
+ return this.nIPStreamProviderNameField;
+ }
+ set {
+ this.nIPStreamProviderNameField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="positiveInteger")]
+ public string NIPCarrierID {
+ get {
+ return this.nIPCarrierIDField;
+ }
+ set {
+ this.nIPCarrierIDField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string NIPLinkID {
+ get {
+ return this.nIPLinkIDField;
+ }
+ set {
+ this.nIPLinkIDField = value;
+ }
+ }
+
+ ///
+ public ushort NIPServiceID {
+ get {
+ return this.nIPServiceIDField;
+ }
+ set {
+ this.nIPServiceIDField = value;
+ }
+ }
+
+ ///
+ public NIPStreamTypeBootstrapStream BootstrapStream {
+ get {
+ return this.bootstrapStreamField;
+ }
+ set {
+ this.bootstrapStreamField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2024")]
+ public enum NIPStreamTypeLinkLayerFormat {
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("GSE-Lite")]
+ GSELite,
+
+ ///
+ TS,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2024")]
+ public partial class NIPStreamTypeBootstrapStream {
+
+ private NIPStreamTypeBootstrapStreamBootstrapType bootstrapTypeField;
+
+ private NIPStreamTypeBootstrapStreamStatus statusField;
+
+ ///
+ public NIPStreamTypeBootstrapStreamBootstrapType BootstrapType {
+ get {
+ return this.bootstrapTypeField;
+ }
+ set {
+ this.bootstrapTypeField = value;
+ }
+ }
+
+ ///
+ public NIPStreamTypeBootstrapStreamStatus Status {
+ get {
+ return this.statusField;
+ }
+ set {
+ this.statusField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2024")]
+ public enum NIPStreamTypeBootstrapStreamBootstrapType {
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Physical Network")]
+ PhysicalNetwork,
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Commercial Operator")]
+ CommercialOperator,
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2024")]
+ public enum NIPStreamTypeBootstrapStreamStatus {
+
+ ///
+ Active,
+
+ ///
+ [System.Xml.Serialization.XmlEnumAttribute("Not Active")]
+ NotActive,
+
+ ///
+ Deprecated,
+ }
+}
diff --git a/skyscraper8/DvbNip/XmlSchema/PrivateDataSignalling.cs b/skyscraper8/DvbNip/XmlSchema/PrivateDataSignalling.cs
new file mode 100644
index 0000000..8f88c54
--- /dev/null
+++ b/skyscraper8/DvbNip/XmlSchema/PrivateDataSignalling.cs
@@ -0,0 +1,134 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+//
+// This source code was auto-generated by xsd, Version=4.8.9037.0.
+//
+namespace skyscraper8.DvbNip {
+ using System.Xml.Serialization;
+
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ [System.Xml.Serialization.XmlRootAttribute("PrivateDataSignallingManifest", Namespace="urn:dvb:metadata:nativeip:2024", IsNullable=false)]
+ public partial class PrivateDataSignallingManifestType {
+
+ private System.DateTime versionUpdateField;
+
+ private PrivateDataProviderType[] privateDataProviderField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("PrivateDataProvider")]
+ public PrivateDataProviderType[] PrivateDataProvider {
+ get {
+ return this.privateDataProviderField;
+ }
+ set {
+ this.privateDataProviderField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ public partial class PrivateDataProviderType {
+
+ private PrivateDataSessionType[] privateDataSessionField;
+
+ private byte[] privateDataProviderIDField;
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("PrivateDataSession")]
+ public PrivateDataSessionType[] PrivateDataSession {
+ get {
+ return this.privateDataSessionField;
+ }
+ set {
+ this.privateDataSessionField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlAttributeAttribute(DataType="hexBinary")]
+ public byte[] privateDataProviderID {
+ get {
+ return this.privateDataProviderIDField;
+ }
+ set {
+ this.privateDataProviderIDField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ public partial class PrivateDataSessionType {
+
+ private System.DateTime versionUpdateField;
+
+ private bool versionUpdateFieldSpecified;
+
+ private string[] tagRefField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlIgnoreAttribute()]
+ public bool VersionUpdateSpecified {
+ get {
+ return this.versionUpdateFieldSpecified;
+ }
+ set {
+ this.versionUpdateFieldSpecified = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("TagRef", DataType="anyURI")]
+ public string[] TagRef {
+ get {
+ return this.tagRefField;
+ }
+ set {
+ this.tagRefField = value;
+ }
+ }
+ }
+}
diff --git a/skyscraper8/DvbNip/XmlSchema/ServiceInformationFile.cs b/skyscraper8/DvbNip/XmlSchema/ServiceInformationFile.cs
new file mode 100644
index 0000000..505ac54
--- /dev/null
+++ b/skyscraper8/DvbNip/XmlSchema/ServiceInformationFile.cs
@@ -0,0 +1,235 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+//
+// This source code was auto-generated by xsd, Version=4.8.9037.0.
+//
+namespace skyscraper8.DvbNip {
+ using System.Xml.Serialization;
+
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ [System.Xml.Serialization.XmlRootAttribute("ServiceInformationFile", Namespace="urn:dvb:metadata:nativeip:2024", IsNullable=false)]
+ public partial class ServiceInformationFileType {
+
+ private System.DateTime versionUpdateField;
+
+ private string nIPNetworkProviderNameField;
+
+ private BroadcastMediaStreamType[] broadcastMediaStreamField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ public string NIPNetworkProviderName {
+ get {
+ return this.nIPNetworkProviderNameField;
+ }
+ set {
+ this.nIPNetworkProviderNameField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("BroadcastMediaStream")]
+ public BroadcastMediaStreamType[] BroadcastMediaStream {
+ get {
+ return this.broadcastMediaStreamField;
+ }
+ set {
+ this.broadcastMediaStreamField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ public partial class BroadcastMediaStreamType {
+
+ private ushort nIPNetworkIDField;
+
+ private string nIPCarrierIDField;
+
+ private string nIPLinkIDField;
+
+ private ushort nIPServiceIDField;
+
+ private BroadcastMediaStreamTypeBroadcastMedia broadcastMediaField;
+
+ ///
+ public ushort NIPNetworkID {
+ get {
+ return this.nIPNetworkIDField;
+ }
+ set {
+ this.nIPNetworkIDField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="positiveInteger")]
+ public string NIPCarrierID {
+ get {
+ return this.nIPCarrierIDField;
+ }
+ set {
+ this.nIPCarrierIDField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string NIPLinkID {
+ get {
+ return this.nIPLinkIDField;
+ }
+ set {
+ this.nIPLinkIDField = value;
+ }
+ }
+
+ ///
+ public ushort NIPServiceID {
+ get {
+ return this.nIPServiceIDField;
+ }
+ set {
+ this.nIPServiceIDField = value;
+ }
+ }
+
+ ///
+ public BroadcastMediaStreamTypeBroadcastMedia BroadcastMedia {
+ get {
+ return this.broadcastMediaField;
+ }
+ set {
+ this.broadcastMediaField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2024")]
+ public partial class BroadcastMediaStreamTypeBroadcastMedia {
+
+ private string[] uRIField;
+
+ private InteractiveApplicationsType[] interactiveApplicationsField;
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("URI")]
+ public string[] URI {
+ get {
+ return this.uRIField;
+ }
+ set {
+ this.uRIField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute("InteractiveApplications")]
+ public InteractiveApplicationsType[] InteractiveApplications {
+ get {
+ return this.interactiveApplicationsField;
+ }
+ set {
+ this.interactiveApplicationsField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ public partial class InteractiveApplicationsType {
+
+ private InteractiveApplicationsTypeApplicationType applicationTypeField;
+
+ private string applicationIDField;
+
+ private string applicationURIField;
+
+ ///
+ public InteractiveApplicationsTypeApplicationType ApplicationType {
+ get {
+ return this.applicationTypeField;
+ }
+ set {
+ this.applicationTypeField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="integer")]
+ public string ApplicationID {
+ get {
+ return this.applicationIDField;
+ }
+ set {
+ this.applicationIDField = value;
+ }
+ }
+
+ ///
+ public string ApplicationURI {
+ get {
+ return this.applicationURIField;
+ }
+ set {
+ this.applicationURIField = value;
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:dvb:metadata:nativeip:2024")]
+ public enum InteractiveApplicationsTypeApplicationType {
+
+ ///
+ HbbTV,
+
+ ///
+ MHP,
+
+ ///
+ MHEG5,
+
+ ///
+ Proprietary,
+ }
+}
diff --git a/skyscraper8/DvbNip/XmlSchema/TimeOffsetFile.cs b/skyscraper8/DvbNip/XmlSchema/TimeOffsetFile.cs
new file mode 100644
index 0000000..b4b07c7
--- /dev/null
+++ b/skyscraper8/DvbNip/XmlSchema/TimeOffsetFile.cs
@@ -0,0 +1,127 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+//
+// This source code was auto-generated by xsd, Version=4.8.9037.0.
+//
+namespace skyscraper8.DvbNip {
+ using System.Xml.Serialization;
+
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.9037.0")]
+ [System.SerializableAttribute()]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:dvb:metadata:nativeip:2024")]
+ [System.Xml.Serialization.XmlRootAttribute("TimeOffsetFile", Namespace="urn:dvb:metadata:nativeip:2024", IsNullable=false)]
+ public partial class TimeOffsetFileType {
+
+ private System.DateTime versionUpdateField;
+
+ private string country_codeField;
+
+ private string country_region_IdField;
+
+ private bool local_time_offset_polarityField;
+
+ private string local_time_offset_valueField;
+
+ private System.DateTime time_of_changeField;
+
+ private bool time_of_changeFieldSpecified;
+
+ private string next_time_offset_valueField;
+
+ ///
+ public System.DateTime VersionUpdate {
+ get {
+ return this.versionUpdateField;
+ }
+ set {
+ this.versionUpdateField = value;
+ }
+ }
+
+ ///
+ public string country_code {
+ get {
+ return this.country_codeField;
+ }
+ set {
+ this.country_codeField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string country_region_Id {
+ get {
+ return this.country_region_IdField;
+ }
+ set {
+ this.country_region_IdField = value;
+ }
+ }
+
+ ///
+ public bool local_time_offset_polarity {
+ get {
+ return this.local_time_offset_polarityField;
+ }
+ set {
+ this.local_time_offset_polarityField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string local_time_offset_value {
+ get {
+ return this.local_time_offset_valueField;
+ }
+ set {
+ this.local_time_offset_valueField = value;
+ }
+ }
+
+ ///
+ public System.DateTime time_of_change {
+ get {
+ return this.time_of_changeField;
+ }
+ set {
+ this.time_of_changeField = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlIgnoreAttribute()]
+ public bool time_of_changeSpecified {
+ get {
+ return this.time_of_changeFieldSpecified;
+ }
+ set {
+ this.time_of_changeFieldSpecified = value;
+ }
+ }
+
+ ///
+ [System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
+ public string next_time_offset_value {
+ get {
+ return this.next_time_offset_valueField;
+ }
+ set {
+ this.next_time_offset_valueField = value;
+ }
+ }
+ }
+}
diff --git a/skyscraper8/DvbNip/multicast-session-configuration_phase-2_2024-05-28_mpeg7_subset_extensibility_2024-04-24.cs b/skyscraper8/DvbNip/XmlSchema/multicast-session-configuration_phase-2_2024-05-28_mpeg7_subset_extensibility_2024-04-24.cs
similarity index 100%
rename from skyscraper8/DvbNip/multicast-session-configuration_phase-2_2024-05-28_mpeg7_subset_extensibility_2024-04-24.cs
rename to skyscraper8/DvbNip/XmlSchema/multicast-session-configuration_phase-2_2024-05-28_mpeg7_subset_extensibility_2024-04-24.cs
diff --git a/skyscraper8/Ietf/FLUTE/FluteListener.cs b/skyscraper8/Ietf/FLUTE/FluteListener.cs
index 2f1fbb3..26137b4 100644
--- a/skyscraper8/Ietf/FLUTE/FluteListener.cs
+++ b/skyscraper8/Ietf/FLUTE/FluteListener.cs
@@ -227,9 +227,13 @@ namespace skyscraper8.Ietf.FLUTE
set
{
_fileAssocitation = value;
- if (_fileAssocitation.ContentLengthSpecified)
+ if (transferLength == 0)
{
- if (transferLength == 0)
+ if (_fileAssocitation.TransferLengthSpecified)
+ {
+ transferLength = (long)_fileAssocitation.TransferLength;
+ }
+ else if (_fileAssocitation.ContentLengthSpecified)
{
transferLength = (long)_fileAssocitation.ContentLength;
}
diff --git a/skyscraper8/Skyscraper/ByteArrayExtensions.cs b/skyscraper8/Skyscraper/ByteArrayExtensions.cs
index dceb8d8..41632ad 100644
--- a/skyscraper8/Skyscraper/ByteArrayExtensions.cs
+++ b/skyscraper8/Skyscraper/ByteArrayExtensions.cs
@@ -12,5 +12,20 @@ namespace skyscraper5.Skyscraper
return _comparer.Compare(a, b) == 0;
}
+
+ //geklaut aus yo3explorers CD-I Treiber
+ public static void FlipEndian(this byte[] data)
+ {
+ if (data.Length % 2 == 1)
+ throw new InvalidDataException(); //Überprüfe: Ist das überhaupt eine Zahl ?
+ byte temp;
+
+ for (int i = 0; i < (data.Length / 2); i++)
+ {
+ temp = data[i];
+ data[i] = data[data.Length - i - 1];
+ data[data.Length - i - 1] = temp;
+ }
+ }
}
}
diff --git a/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs b/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs
index 7497e4d..718e7af 100644
--- a/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs
+++ b/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs
@@ -1,4 +1,5 @@
using log4net;
+using moe.yo3explorer.skyscraper8.DVBI.Model;
using skyscraper5.Abertis;
using skyscraper5.Docsis;
using skyscraper5.Docsis.MacManagement;
@@ -38,6 +39,7 @@ using skyscraper5.Skyscraper.Plugins;
using skyscraper5.Skyscraper.Scraper.FrameGrabber;
using skyscraper5.Skyscraper.Scraper.Storage;
using skyscraper5.Skyscraper.Scraper.Storage.InMemory;
+using skyscraper5.Skyscraper.Scraper.Storage.Split;
using skyscraper5.Skyscraper.Scraper.Storage.Utilities;
using skyscraper5.Skyscraper.Scraper.StreamAutodetection;
using skyscraper5.Skyscraper.Scraper.Utils;
@@ -2450,21 +2452,18 @@ namespace skyscraper5.Skyscraper.Scraper
public void FluteFileArrival(NipActualCarrierInformation carrier, FluteListener listener)
{
- string filename = DvbNipUtilities.MakeFilename(listener.FileAssociation.ContentLocation);
- FileInfo fileInfo = new FileInfo(filename);
- if (!fileInfo.Exists)
- {
- string extension = Path.GetExtension(fileInfo.Name).ToLowerInvariant();
- if (!DvbNipUtilities.IsContinuousFileType(extension))
- LogEvent(SkyscraperContextEvent.FluteFileArrival, listener.FileAssociation.ContentLocation);
- fileInfo.Directory.EnsureExists();
- listener.WriteToFile(fileInfo.FullName);
- }
+ string extension = Path.GetExtension(listener.FileAssociation.ContentLocation).ToLowerInvariant();
+ if (!DvbNipUtilities.IsContinuousFileType(extension))
+ LogEvent(SkyscraperContextEvent.FluteFileArrival, listener.FileAssociation.ContentLocation);
+ ScraperStorage.DvbNipFileArrival(carrier, listener);
}
public void OnMulticastGatewayConfiguration(NipActualCarrierInformation carrier, MulticastGatewayConfigurationType multicastGatewayConfiguration)
{
+ if (multicastGatewayConfiguration.MulticastSession == null)
+ return;
+ throw new NotImplementedException();
}
public void OnNipCarrierDetected(NipActualCarrierInformation currentCarrierInformation)
@@ -2472,6 +2471,128 @@ namespace skyscraper5.Skyscraper.Scraper
LogEvent(SkyscraperContextEvent.NipCarrierDetected, String.Format("{0}", currentCarrierInformation.NipStreamProviderName));
}
+ public bool IsFileNeeded(string announcedFileContentLocation)
+ {
+ if (announcedFileContentLocation.StartsWith("urn:dvb"))
+ return true;
+
+ return !ScraperStorage.DvbNipTestForFile(announcedFileContentLocation);
+ }
+
+ public void OnPrivateDataSignallingManifest(NipActualCarrierInformation currentCarrierInformation, PrivateDataSignallingManifestType privateDataSignallingManifest)
+ {
+ foreach (PrivateDataProviderType privateDataProvider in privateDataSignallingManifest.PrivateDataProvider)
+ {
+ privateDataProvider.privateDataProviderID.FlipEndian();
+ uint privateDataSpecifier = BitConverter.ToUInt32(privateDataProvider.privateDataProviderID);
+ List privateDataSessions = privateDataProvider.PrivateDataSession.SelectMany(x => x.TagRef).ToList();
+ bool added = ScraperStorage.DvbNipPrivateDataSpecifier(currentCarrierInformation, privateDataSignallingManifest.VersionUpdate, privateDataSpecifier, privateDataSessions);
+ if (added)
+ {
+ LogEvent(SkyscraperContextEvent.NipPrivateDataSpecifier, String.Format("{0} -> {1}", currentCarrierInformation.NipStreamProviderName, privateDataSpecifier));
+ }
+ }
+ }
+
+ public void OnServiceListEntryPoints(NipActualCarrierInformation currentCarrierInformation, ServiceListEntryPoints serviceListEntryPoints, DateTime dvbNipTime, DvbNipServiceListNotifier serviceListNotifier)
+ {
+ long sourceHash = DvbIUtils.GetSourceHash(ServiceListEntryPointSource.DvbNip, currentCarrierInformation.NipNetworkId, currentCarrierInformation.NipCarrierId, currentCarrierInformation.NipLinkId);
+ serviceListNotifier.SetSourceHash(sourceHash);
+ DvbIDataStorage dataStorage = ScraperStorage;
+
+ if (dataStorage.TestForDvbiServiceListEntryPoints(sourceHash))
+ {
+ DateTime lastChecked = dataStorage.GetLastDvbiServiceListEntryPointUpdateDate(sourceHash);
+ TimeSpan sinceLastChecked = dvbNipTime - lastChecked;
+ if (sinceLastChecked.TotalDays < 1.0)
+ return;
+ }
+ else
+ {
+ logger.InfoFormat("New DVB-I Service List Entry Point: {0}", currentCarrierInformation.NipStreamProviderName);
+ dataStorage.InsertDvbiServiceListEntryPoint(sourceHash);
+ }
+
+ IEnumerable enumerable = DvbIUtils.FlattenServiceListEntryPoints(serviceListEntryPoints);
+ foreach (DvbiServiceList serviceList in enumerable)
+ {
+ DateTime serviceListLastChecked;
+ if (dataStorage.TestForDvbiServiceList(serviceList.Id))
+ {
+ serviceListLastChecked = dataStorage.GetDvbiServiceListLastUpdateDate(serviceList.Id);
+ }
+ else
+ {
+ logger.InfoFormat("New DVB-I Service List: {0}", serviceList.Name);
+ dataStorage.InsertDvbiServiceList(serviceList);
+ dataStorage.AddDvbiServiceListToServiceListEntryPoint(serviceList, sourceHash);
+ serviceListLastChecked = new DateTime(1970, 1, 1);
+ }
+
+ TimeSpan sinceLastServiceListCheck = dvbNipTime - serviceListLastChecked;
+ if (sinceLastServiceListCheck.TotalDays < 1.0)
+ continue;
+
+ serviceListNotifier.AddServiceListUrl(serviceList.URI, serviceList.Id);
+ /*if (vfs.FileExists(serviceList.URI))
+ {
+ byte[] serviceListBytes = vfs.GetFile(serviceList.URI);
+ ServiceListType serviceListData = DvbIUtils.UnpackServiceList(serviceListBytes);
+ HandleServiceList(serviceListData, dataStorage, serviceList.Id);
+ dataStorage.UpdateDvbiServiceListLastCheckedDate(serviceList.Id, context.CurrentTime);
+ }*/
+ }
+
+ dataStorage.UpdateDvbiServiceListEntryPointUpdateDate(sourceHash, dvbNipTime);
+ }
+
+ public void OnServiceList(NipActualCarrierInformation currentCarrierInformation, string serviceListId,
+ ServiceListType serviceList)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnTimeOffsetFile(NipActualCarrierInformation currentCarrierInformation, TimeOffsetFileType timeOffsetFile)
+ {
+ if (timeOffsetFile.time_of_change != DateTime.MinValue)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public void OnNetworkInformationFile(NipActualCarrierInformation currentCarrierInformation, NetworkInformationFileType networkInformationFile)
+ {
+ List broadcastNetworks = new List();
+ if (networkInformationFile.ActualBroadcastNetwork != null)
+ broadcastNetworks.Add(networkInformationFile.ActualBroadcastNetwork);
+ if (networkInformationFile.OtherBroadcastNetwork != null)
+ broadcastNetworks.AddRange(networkInformationFile.OtherBroadcastNetwork);
+
+ foreach (BroadcastNetworkType network in broadcastNetworks)
+ {
+ if (!ScraperStorage.DvbNipTestForNetwork(network))
+ {
+ LogEvent(SkyscraperContextEvent.DvbNipNetwork, network.NetworkName);
+ ScraperStorage.DvbNipInsertNetwork(network);
+ }
+ }
+ }
+
+ public void OnServiceInformationFile(NipActualCarrierInformation currentCarrierInformation, ServiceInformationFileType serviceInformationFile)
+ {
+ foreach (BroadcastMediaStreamType broadcastMediaStreamType in serviceInformationFile.BroadcastMediaStream)
+ {
+ if (!ScraperStorage.DvbNipTestForService(broadcastMediaStreamType))
+ {
+ string id = String.Format("{0},{1},{2},{3}", broadcastMediaStreamType.NIPNetworkID,
+ broadcastMediaStreamType.NIPCarrierID, broadcastMediaStreamType.NIPLinkID,
+ broadcastMediaStreamType.NIPServiceID);
+ LogEvent(SkyscraperContextEvent.DvbNipService, id);
+ ScraperStorage.DvbNipInsertService(broadcastMediaStreamType);
+ }
+ }
+ }
+
public void FluteFileDownloadProgress(NipActualCarrierInformation currentCarrierInformation, ulong destinationTsi, ulong destinationToi, double progress, FileType filetype)
{
if (filetype != null)
diff --git a/skyscraper8/Skyscraper/Scraper/SkyscraperContextEvent.cs b/skyscraper8/Skyscraper/Scraper/SkyscraperContextEvent.cs
index 3e727e8..bff2b8c 100644
--- a/skyscraper8/Skyscraper/Scraper/SkyscraperContextEvent.cs
+++ b/skyscraper8/Skyscraper/Scraper/SkyscraperContextEvent.cs
@@ -75,6 +75,9 @@
SgtService,
FluteFileArrival,
NipCarrierDetected,
- FluteFileProgress
- }
+ FluteFileProgress,
+ NipPrivateDataSpecifier,
+ DvbNipNetwork,
+ DvbNipService
+ }
}
diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorage.cs
index 14ac497..7af65f4 100644
--- a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorage.cs
+++ b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorage.cs
@@ -34,6 +34,8 @@ using skyscraper5.src.Skyscraper.Scraper.Dns;
using skyscraper5.src.Skyscraper.Scraper.Storage.InMemory;
using skyscraper5.Teletext;
using skyscraper8.DvbI;
+using skyscraper8.DvbNip;
+using skyscraper8.Ietf.FLUTE;
using skyscraper8.Ses;
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
@@ -1429,6 +1431,54 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
throw new NotImplementedException();
}
+ public bool DvbNipTestForFile(string announcedFileContentLocation)
+ {
+ string saneFilename = DvbNipUtilities.MakeFilename(announcedFileContentLocation);
+ FileInfo fi = new FileInfo(saneFilename);
+ return fi.Exists;
+ }
+
+ public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener)
+ {
+ string filename = DvbNipUtilities.MakeFilename(listener.FileAssociation.ContentLocation);
+ FileInfo fi = new FileInfo(filename);
+ fi.Directory.EnsureExists();
+ FileStream outStream = fi.OpenWrite();
+ Stream inStream = listener.ToStream();
+ inStream.CopyTo(outStream);
+ outStream.Flush(true);
+ outStream.Close();
+ outStream.Dispose();
+ inStream.Close();
+ inStream.Dispose();
+ }
+
+ public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate,
+ uint privateDataSpecifier, List privateDataSessions)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool DvbNipTestForNetwork(BroadcastNetworkType network)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void DvbNipInsertNetwork(BroadcastNetworkType network)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType)
+ {
+ throw new NotImplementedException();
+ }
+
public DateTime GetLastDvbiServiceListEntryPointUpdateDate(long sourceHash)
{
throw new NotImplementedException();
diff --git a/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorage.cs
index cea4eca..fc5d2dd 100644
--- a/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorage.cs
+++ b/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorage.cs
@@ -29,6 +29,8 @@ using skyscraper5.src.Skyscraper.FrequencyListGenerator;
using skyscraper5.src.Skyscraper.Scraper.Dns;
using skyscraper5.Teletext;
using skyscraper8.DvbI;
+using skyscraper8.DvbNip;
+using skyscraper8.Ietf.FLUTE;
using skyscraper8.Ses;
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
@@ -181,5 +183,12 @@ namespace skyscraper5.Skyscraper.Scraper.Storage
void InsertSgtList(SgtList list);
bool TestForSgtService(SgtService child);
void InsertSgtService(SgtService child);
- }
+ bool DvbNipTestForFile(string announcedFileContentLocation);
+ void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener);
+ bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate, uint privateDataSpecifier, List privateDataSessions);
+ bool DvbNipTestForNetwork(BroadcastNetworkType network);
+ void DvbNipInsertNetwork(BroadcastNetworkType network);
+ bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType);
+ void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType);
+ }
}
diff --git a/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs
index dcc4342..9e565a7 100644
--- a/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs
+++ b/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.NetworkInformation;
-using skyscraper5.Docsis.MacManagement;
+using skyscraper5.Docsis.MacManagement;
using skyscraper5.DsmCc.Descriptors;
using skyscraper5.Dvb.DataBroadcasting.IntModel;
using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
@@ -32,9 +26,17 @@ using skyscraper5.src.Skyscraper.Scraper.Dns;
using skyscraper5.src.Skyscraper.Scraper.Storage.InMemory;
using skyscraper5.Teletext;
using skyscraper8.DvbI;
+using skyscraper8.DvbNip;
using skyscraper8.Ses;
using skyscraper8.Ses.Descriptors;
using skyscraper8.Skyscraper.Scraper.Storage.InMemory.Model;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.NetworkInformation;
+using skyscraper8.Ietf.FLUTE;
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
@@ -1292,6 +1294,157 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
sgtServices.Add(child);
}
+ public bool DvbNipTestForFile(string announcedFileContentLocation)
+ {
+ string saneFilename = DvbNipUtilities.MakeFilename(announcedFileContentLocation);
+ FileInfo fi = new FileInfo(saneFilename);
+ return fi.Exists;
+ }
+
+ public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener)
+ {
+ string filename = DvbNipUtilities.MakeFilename(listener.FileAssociation.ContentLocation);
+ FileInfo fi = new FileInfo(filename);
+ fi.Directory.EnsureExists();
+ FileStream outStream = fi.OpenWrite();
+ Stream inStream = listener.ToStream();
+ inStream.CopyTo(outStream);
+ outStream.Flush(true);
+ outStream.Close();
+ outStream.Dispose();
+ inStream.Close();
+ inStream.Dispose();
+ }
+
+ private class NipPds
+ {
+ public class NipSubPds
+ {
+ public DateTime VersionUpdate { get; set; }
+ public List PrivateDataSessions { get; set; }
+
+ public NipSubPds(DateTime versionUpdate, List privateDataSessions)
+ {
+ VersionUpdate = versionUpdate;
+ PrivateDataSessions = privateDataSessions;
+ }
+ }
+
+ public Dictionary subs;
+ }
+
+ private Dictionary _nipPrivateDataSpecifiers;
+ public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate, uint privateDataSpecifier, List privateDataSessions)
+ {
+ if (_nipPrivateDataSpecifiers == null)
+ _nipPrivateDataSpecifiers = new Dictionary();
+
+ if (_nipPrivateDataSpecifiers.ContainsKey(currentCarrierInformation))
+ {
+ NipPds oldPds = _nipPrivateDataSpecifiers[currentCarrierInformation];
+ if (oldPds.subs.ContainsKey(privateDataSpecifier))
+ {
+ NipPds.NipSubPds oldPdsSub = oldPds.subs[privateDataSpecifier];
+ if (oldPdsSub.VersionUpdate < versionUpdate)
+ {
+ oldPdsSub.VersionUpdate = versionUpdate;
+ oldPdsSub.PrivateDataSessions = privateDataSessions;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ oldPds.subs.Add(privateDataSpecifier, new NipPds.NipSubPds(versionUpdate, privateDataSessions));
+ return true;
+ }
+
+ }
+ else
+ {
+ NipPds newPds = new NipPds();
+ newPds.subs = new Dictionary();
+ newPds.subs.Add(privateDataSpecifier, new NipPds.NipSubPds(versionUpdate, privateDataSessions));
+ return true;
+ }
+ }
+
+ private BroadcastNetworkType[] nipBroadcastNetworkTypes;
+ public bool DvbNipTestForNetwork(BroadcastNetworkType network)
+ {
+ if (nipBroadcastNetworkTypes == null)
+ return false;
+
+ return nipBroadcastNetworkTypes[network.NIPNetworkID] != null;
+ }
+
+ public void DvbNipInsertNetwork(BroadcastNetworkType network)
+ {
+ if (nipBroadcastNetworkTypes == null)
+ nipBroadcastNetworkTypes = new BroadcastNetworkType[ushort.MaxValue];
+
+ nipBroadcastNetworkTypes[network.NIPNetworkID] = network;
+ }
+
+ private class NipServiceCoordinate
+ {
+ public NipServiceCoordinate(BroadcastMediaStreamType bmst)
+ {
+ this.NetworkId = bmst.NIPNetworkID;
+ this.CarrierId = Convert.ToInt32(bmst.NIPCarrierID);
+ this.LinkId = Convert.ToInt32(bmst.NIPLinkID);
+ this.ServiceId = bmst.NIPServiceID;
+ }
+
+ public ushort ServiceId { get; set; }
+
+ public int LinkId { get; set; }
+
+ public int CarrierId { get; set; }
+
+ public ushort NetworkId { get; set; }
+
+ protected bool Equals(NipServiceCoordinate other)
+ {
+ return ServiceId == other.ServiceId && LinkId == other.LinkId && CarrierId == other.CarrierId && NetworkId == other.NetworkId;
+ }
+
+ public override bool Equals(object? obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((NipServiceCoordinate)obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(ServiceId, LinkId, CarrierId, NetworkId);
+ }
+ }
+
+ private Dictionary _dvbNipServices;
+ public bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType)
+ {
+ if (_dvbNipServices == null)
+ return false;
+
+ NipServiceCoordinate coords = new NipServiceCoordinate(broadcastMediaStreamType);
+ return _dvbNipServices.ContainsKey(coords);
+ }
+
+ public void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType)
+ {
+ if (_dvbNipServices == null)
+ _dvbNipServices = new Dictionary();
+
+ NipServiceCoordinate coords = new NipServiceCoordinate(broadcastMediaStreamType);
+ _dvbNipServices.Add(coords, broadcastMediaStreamType);
+ }
+
public void InsertDvbiServiceListEntryPoint(long sourceHash)
{
if (_dvbiServiceListEntryPointsCoordinates == null)
diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Split/ObjectStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/Split/ObjectStorage.cs
index d066ce8..f1605e7 100644
--- a/skyscraper8/Skyscraper/Scraper/Storage/Split/ObjectStorage.cs
+++ b/skyscraper8/Skyscraper/Scraper/Storage/Split/ObjectStorage.cs
@@ -6,6 +6,8 @@ using System.Text;
using System.Threading.Tasks;
using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
using skyscraper5.Teletext;
+using skyscraper8.DvbNip;
+using skyscraper8.Ietf.FLUTE;
namespace skyscraper5.Skyscraper.Scraper.Storage.Split
{
@@ -21,5 +23,12 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
object[] GetPluginConnector();
void Ping();
+ bool DvbNipTestForFile(string announcedFileContentLocation);
+ void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener);
+ bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate, uint privateDataSpecifier, List privateDataSessions);
+ bool DvbNipTestForNetwork(BroadcastNetworkType network);
+ void DvbNipInsertNetwork(BroadcastNetworkType network);
+ bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType);
+ void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType);
}
}
diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Split/SplitScraperStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/Split/SplitScraperStorage.cs
index 6b1a3ef..58ef682 100644
--- a/skyscraper8/Skyscraper/Scraper/Storage/Split/SplitScraperStorage.cs
+++ b/skyscraper8/Skyscraper/Scraper/Storage/Split/SplitScraperStorage.cs
@@ -29,6 +29,8 @@ using skyscraper5.src.Skyscraper.FrequencyListGenerator;
using skyscraper5.src.Skyscraper.Scraper.Dns;
using skyscraper5.Teletext;
using skyscraper8.DvbI;
+using skyscraper8.DvbNip;
+using skyscraper8.Ietf.FLUTE;
using skyscraper8.Ses;
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
@@ -889,6 +891,48 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
dataStorage.InsertSgtService(child);
}
+ [DebuggerStepThrough]
+ public bool DvbNipTestForFile(string announcedFileContentLocation)
+ {
+ return objectStorage.DvbNipTestForFile(announcedFileContentLocation);
+ }
+
+ [DebuggerStepThrough]
+ public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener)
+ {
+ objectStorage.DvbNipFileArrival(carrier, listener);
+ }
+
+ [DebuggerStepThrough]
+ public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate, uint privateDataSpecifier, List privateDataSessions)
+ {
+ return objectStorage.DvbNipPrivateDataSpecifier(currentCarrierInformation, versionUpdate, privateDataSpecifier, privateDataSessions);
+ }
+
+ [DebuggerStepThrough]
+ public bool DvbNipTestForNetwork(BroadcastNetworkType network)
+ {
+ return objectStorage.DvbNipTestForNetwork(network);
+ }
+
+ [DebuggerStepThrough]
+ public void DvbNipInsertNetwork(BroadcastNetworkType network)
+ {
+ objectStorage.DvbNipInsertNetwork(network);
+ }
+
+ [DebuggerStepThrough]
+ public bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType)
+ {
+ return objectStorage.DvbNipTestForService(broadcastMediaStreamType);
+ }
+
+ [DebuggerStepThrough]
+ public void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType)
+ {
+ objectStorage.DvbNipInsertService(broadcastMediaStreamType);
+ }
+
[DebuggerStepThrough]
public void InsertDvbiServiceListEntryPoint(long sourceHash)
{
diff --git a/skyscraper8/yo3explorer/yo3explorerToSkyscraperContextBridge.cs b/skyscraper8/yo3explorer/yo3explorerToSkyscraperContextBridge.cs
index db383a7..f7d2d46 100644
--- a/skyscraper8/yo3explorer/yo3explorerToSkyscraperContextBridge.cs
+++ b/skyscraper8/yo3explorer/yo3explorerToSkyscraperContextBridge.cs
@@ -19,20 +19,7 @@ namespace skyscraper8.yo3explorer
public long GetSourceHash()
{
- long result = (int)Source;
- switch (Source)
- {
- case ServiceListEntryPointSource.TransportStream:
- result <<= 4;
- result += OriginalNetworkId.Value;
- result <<= 16;
- result += TransportStreamId.Value;
- result <<= 16;
- result += PID;
- return result;
- default:
- throw new NotImplementedException(Source.ToString());
- }
+ return DvbIUtils.GetSourceHash(Source, (ushort)OriginalNetworkId.Value, (ushort)TransportStreamId.Value, PID);
}
internal string ToHumanReadableSourceString()