private void Clear() { pps = new NALUnit[0]; sps = new NALUnit[0]; spsExt = new NALUnit[0]; pat = new ProgramAssociationTable(); pmt = new ProgramMapTable(); adtsHeader = ADTSHeader.Default; nalSizeLen = 0; ptsBase = -1; }
public void WritePAT(ProgramAssociationTable pat) { var body = new MemoryStream(); using (body) { body.WriteUInt16BE(pat.TransportStreamId); body.WriteByte((3 << 6) | (pat.Version << 1) | (pat.CurrentNextIndicator ? 1 : 0)); body.WriteByte(pat.SectionNumber); body.WriteByte(pat.LastSectionNumber); foreach (var kv in pat.PIDToProgramNumber) { body.WriteUInt16BE(kv.Value); body.WriteUInt16BE((7 << 13) | kv.Key); } } WriteSection(0x00, 0x00, body.ToArray()); }