skyscraper8/skyscraper8/DvbNip/NipActualCarrierInformation.cs
feyris-tan 30026b2b02
All checks were successful
🚀 Pack skyscraper8 / make-zip (push) Successful in 3m38s
Added functionality necessary to extract the MPEG-DASH segments on the Arsat stream.
2025-11-23 00:27:00 +01:00

58 lines
1.7 KiB
C#

using skyscraper5.Skyscraper.IO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.DvbNip
{
public class NipActualCarrierInformation
{
public NipActualCarrierInformation(byte[] buffer)
{
MemoryStream ms = new MemoryStream(buffer, false);
NipNetworkId = ms.ReadUInt16BE();
NipCarrierId = ms.ReadUInt16BE();
NipLinkId = ms.ReadUInt16BE();
NipServiceId = ms.ReadUInt16BE();
byte reserved = ms.ReadUInt8();
byte length = ms.ReadUInt8();
NipStreamProviderName = Encoding.UTF8.GetString(ms.ReadBytes(length));
}
public NipActualCarrierInformation(ushort nipNetworkId, ushort nipCarrierId, ushort nipLinkId, ushort nipServiceId, string nipStreamProviderName)
{
NipNetworkId = nipNetworkId;
NipCarrierId = nipCarrierId;
NipLinkId = nipLinkId;
NipServiceId = nipServiceId;
NipStreamProviderName = nipStreamProviderName;
}
public ushort NipNetworkId { get; }
public ushort NipCarrierId { get; }
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);
}
}
}