.NET library for parsing and generating SCTE-35 cue messages (port of Comcast/scte35-go)
$ dotnet add package Scte35.NetA .NET 8 library for parsing and generating SCTE‑35 cue messages, adapted to idiomatic C# with guardrails around binary parsing and validation.
Based in part on Comcast's scte35-go, with C#/.NET adaptations and additional validation.
src/Scte35.Nettests/Scte35.Net.Testssplice_info_section to/from bytes, Hex, and Base64.FromHex, FromBase64, TryDecode, ToHex, ToBase64.Crc32Valid.Scte35.Net):
dotnet add package Scte35.NetScte35.Net.sln, then and .dotnet restoredotnet buildusing Scte35.Net;
using Scte35.Net.Model;
// Base64
SpliceInfoSection section = Scte35.FromBase64("/DABAAAAAAAAAP/wFAUAAABf+/w==");
// Hex ("0x" prefix optional)
section = Scte35.FromHex("FC300000000000000FFF0140500000017FEFF");
// Raw bytes
if (Scte35.TryDecode(mySpan, out var parsed)) {
// parsed.SpliceCommandType, parsed.SpliceDescriptors, parsed.Crc32Valid, ...
}using Scte35.Net;
using Scte35.Net.Model;
using Scte35.Net.Model.Enums;
using Scte35.Net.Model.SpliceCommand;
var section = new SpliceInfoSection {
SapType = SapType.NotSpecified,
Tier = 0x0FFF,
SpliceCommand = new TimeSignalCommand {
TimeSpecifiedFlag = true,
// 10 seconds in 90kHz ticks
PtsTime90K = 10UL * 90_000
}
};
byte[] wire = Scte35.Encode(section);
string b64 = Scte35.ToBase64(section);
string hex = Scte35.ToHex(section);using Scte35.Net.Model.SpliceCommand;
var insert = new SpliceInsertCommand {
SpliceEventId = 1,
OutOfNetworkIndicator = true,
ProgramSpliceFlag = true,
SpliceImmediateFlag = true,
DurationFlag = false,
UniqueProgramId = 1,
AvailNum = 0,
AvailsExpected = 0
};
var msg = new SpliceInfoSection { SpliceCommand = insert };
string insertHex = Scte35.ToHex(msg);dotnet test -c Releasetests/Scte35.Net.Tests/Model/SpliceInsertTests.cs).tests/Scte35.Net.Tests/Conformance.Scte35.FromHex(hex, privateId => privateId == 0x43554549 /* CUEI */);Scte35.ToHex/ToBase64 and Bytes utilities.Use Conventional Commits; include tests for new behavior. Ensure dotnet build and dotnet test pass locally. CI builds, tests, and packs.