Esempio n. 1
0
        public void ToBuffer(ref TSMessagePackWriter writer)
        {
            Header.PackageType = PackageType.SDT;
            Header.ToBuffer(ref writer);
            writer.WriteByte(TableId);
            writer.Skip(2, out int SectionLengthPosition);
            writer.WriteUInt16(TransportStreamId);
            writer.WriteByte((byte)(Reserved2 << 6 | VersionNumber << 1 | CurrentNextIndicator));
            writer.WriteByte(SectionNumber);
            writer.WriteByte(LastSectionNumber);
            writer.WriteUInt16(OriginalNetworkId);
            writer.WriteByte(ReservedFutureUse2);
            foreach (var service in Services)
            {
                service.ToBuffer(ref writer);
            }
            ushort    servicesLength = (ushort)(writer.GetCurrentPosition() - SectionLengthPosition - 2);
            const int crcLength      = 4;

            writer.WriteUInt16Return((ushort)(SectionSyntaxIndicator << 15 | ReservedFutureUse1 << 14 | Reserved1 << 12 | servicesLength + crcLength), SectionLengthPosition);
            writer.WriteCRC32(5);
            var size = TSConstants.FiexdPackageLength - writer.GetCurrentPosition();

            writer.WriteArray(Enumerable.Range(0, size).Select(s => (byte)0xFF).ToArray());
        }
Esempio n. 2
0
 public void ToBuffer(ref TSMessagePackWriter writer)
 {
     writer.WriteUInt16(ServiceId);
     writer.WriteByte((byte)(ReservedFutureUse << 2 | EITScheduleFlag << 1 | EITPresentFollowingFlag));
     writer.Skip(2, out var position);
     foreach (var descriptor in Descriptors)
     {
         descriptor.ToBuffer(ref writer);
     }
     DescriptorsLoopLength = (ushort)(writer.GetCurrentPosition() - position - 2);
     writer.WriteUInt16Return((ushort)((ushort)RunningStatus << 13 | (ushort)FreeCAMode << 12 | DescriptorsLoopLength), position);
 }