public override void ToBuffer(ref TSMessagePackWriter writer) { writer.WriteByte(Tag); writer.Skip(1, out var position); writer.WriteByte((byte)ServiceType); writer.Skip(1, out var serviceProviderLengthPosition); writer.WriteString(ServiceProvider); writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - serviceProviderLengthPosition - 1), serviceProviderLengthPosition); writer.Skip(1, out int SeviceNameLengthPosition); writer.WriteString(ServiceName); writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - SeviceNameLengthPosition - 1), SeviceNameLengthPosition); writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - position - 1), position); }
public void ToBuffer(ref TSMessagePackWriter writer) { writer.WriteByte(SyncByte); //TransportErrorIndicator PayloadUnitStartIndicator TransportPriority PID //0 1 0 0000 0000 0000 0 //writer.WriteUInt16((ushort)((0b_0100_0000_0000_0000 & (PayloadUnitStartIndicator<<14)) | PID)); writer.WriteUInt16((ushort)((TransportErrorIndicator << 15) | (PayloadUnitStartIndicator << 14) | PID)); writer.WriteByte((byte)((byte)AdaptationFieldControl | ContinuityCounter)); if (PackageType == PackageType.PAT || PackageType == PackageType.PMT || PackageType == PackageType.Data_Start || PackageType == PackageType.Data_End || PackageType == PackageType.SDT) { if (Adaptation != null) { writer.Skip(1, out int AdaptationLengthPosition); Adaptation.ToBuffer(ref writer); writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AdaptationLengthPosition - 1), AdaptationLengthPosition); } else { writer.WriteByte(0); } } }
public void ToBuffer(ref TSMessagePackWriter writer) { writer.WriteByte(SyncByte); //TransportErrorIndicator PayloadUnitStartIndicator TransportPriority PID //0 1 0 0000 0000 0000 0 writer.WriteUInt16((ushort)(0b_0100_0000_0000_0000 | PID)); writer.WriteByte((byte)((byte)AdaptationFieldControl | ContinuityCounter)); if (Adaptation != null) { writer.Skip(1, out int AdaptationLengthPosition); Adaptation.ToBuffer(ref writer); writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AdaptationLengthPosition - 1), AdaptationLengthPosition); } else { writer.WriteByte(0); } }
public override void ToBuffer(ref TSMessagePackWriter writer) { writer.WriteByte(Tag); if (ISO_639_Language_Infos != null) { writer.Skip(1, out int DescriptorLengthPosition); foreach (var item in ISO_639_Language_Infos) { writer.WriteUInt3(item.ISO_639_Language_Code >> 8); writer.WriteByte(item.Audio_Type); } writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - DescriptorLengthPosition - 1), DescriptorLengthPosition); } else { writer.WriteByte(0); } }