} //Leave empty for futher use. public AdaptionFieldStuct(byte[] data) { var packet = new BitPacket(data); //Adaptation Field Length this.FieldLength = packet.ReadInt(8); //Discontinuity indicator this.IsDiscontinue = packet.ReadBool(); // Random Access indicator this.IsRandomAccess = packet.ReadBool(); // Elementary stream priority indicator this.IsHighPriority = packet.ReadBool(); // PCR flag this.HasPCR = packet.ReadBool(); // OPCR flag this.HasOPCR = packet.ReadBool(); //Splicing point flag this.HasSplicingPoint = packet.ReadBool(); //Transport private data flag this.HasPrivateData = packet.ReadBool(); //Adaptation field extension flag this.HasExtension = packet.ReadBool(); //Option field: var counter = 0; if (this.HasPCR) { this.MainPCR = new PCR(packet); counter += 6; } if (this.HasOPCR) { this.OriginalPCR = new PCR(packet); counter += 6; } if (this.HasSplicingPoint) { this.SpliceCountdown = packet.ReadByte(); counter += 1; } if (this.HasPrivateData) { this.PrivateDataLength = packet.ReadByte(); counter += 1; this.PrivateData = packet.ReadBlock(this.PrivateDataLength); } if (this.HasExtension) { this.AdaptationExtension = new AdaptationExtension(packet); } //the counter is in byte but data length is in what ? //the stuffing byes position must be in here. }
public AdaptationExtension(BitPacket packet) { this.Length = packet.ReadByte(); this.LTWFlag = packet.ReadBool(); this.PicewiseRateFlag = packet.ReadBool(); this.SeamlessSpliceFlag = packet.ReadBool(); this.Reserved = packet.ReadByte(5); if (this.LTWFlag) { this.LTWValidFlag = packet.ReadBool(); this.LTWOffset = packet.ReadInt(15); } else { this.LTWValidFlag = false; this.LTWOffset = 0; } if (this.PicewiseRateFlag) { this._Reserved = packet.ReadByte(2); this.PicewiseRate = packet.ReadInt(22); } else { this._Reserved = 0; this.PicewiseRate = 0; } if (this.SeamlessSpliceFlag) { this.SpliceType = packet.ReadByte(4); this.DTSNextAccessUnit = packet.ReadBlock(36); } else { this.SpliceType = 0; this.DTSNextAccessUnit = null; } }
public PCR(BitPacket packet) { this.CLK_Base = packet.ReadLong(33); this.Reserved = (byte)packet.ReadInt(6); this.Extension = packet.ReadInt(9); }