internal NetworkEntry(Table table, int offset, int length) : base(table) { // Access section Section section = Section; // Load TransportStreamIdentifier = (ushort)Tools.MergeBytesToWord(section[offset + 1], section[offset + 0]); OriginalNetworkIdentifier = (ushort)Tools.MergeBytesToWord(section[offset + 3], section[offset + 2]); // Read the length int descrLength = 0xfff & Tools.MergeBytesToWord(section[offset + 5], section[offset + 4]); // Caluclate the total length Length = 6 + descrLength; // Verify if ( Length > length ) return; // Try to load descriptors Descriptors = Descriptor.Load(this, offset + 6, descrLength); // Can use it IsValid = true; }
/// <summary> /// Create a new program instance. /// </summary> /// <param name="table">The related <see cref="Tables.PMT"/> table.</param> /// <param name="offset">The first byte of this program in the <see cref="EPG.Table.Section"/> /// for the related <see cref="Table"/>.</param> /// <param name="length">The maximum number of bytes available. If this number /// is greater than the <see cref="Length"/> of this program another event will /// follow in the same table.</param> internal ProgramEntry(Table table, int offset, int length) : base(table) { // Access section Section section = Section; // Load ElementaryPID = (ushort)(0x1fff & Tools.MergeBytesToWord(section[offset + 2], section[offset + 1])); StreamType = (StreamTypes)section[offset + 0]; // Read the length int descrLength = 0xfff & Tools.MergeBytesToWord(section[offset + 4], section[offset + 3]); // Caluclate the total length Length = 5 + descrLength; // Verify if ( Length > length ) return; // Try to load descriptors Descriptors = Descriptor.Load(this, offset + 5, descrLength); // Can use it IsValid = true; }
/// <summary> /// Create a new service instance. /// </summary> /// <param name="table">The related <see cref="Tables.SDT"/> table.</param> /// <param name="offset">The first byte of this service in the <see cref="EPG.Table.Section"/> /// for the related <see cref="Table"/>.</param> /// <param name="length">The maximum number of bytes available. If this number /// is greater than the <see cref="Length"/> of this service another event will /// follow in the same table.</param> internal ServiceEntry(Table table, int offset, int length) : base(table) { // Access section Section section = Section; // Read statics ServiceIdentifier = Tools.MergeBytesToWord(section[offset + 1], section[offset + 0]); Scrambled = (0 != (section[offset + 3] & 0x10)); // Decode int highLoop = section[offset + 3] & 0xf; int lowLoop = section[offset + 4]; // Number of descriptors int loop = lowLoop + 256 * highLoop; // Caluclate the total length Length = 5 + loop; // Verify if (Length > length) return; // Try to load descriptors Descriptors = Descriptor.Load(this, offset + 5, loop); // Can use it IsValid = true; }
internal static NetworkEntry Create(Table table, int offset, int length) { // Validate if ( length < 6 ) return null; // Create return new NetworkEntry(table, offset, length); }
/// <summary> /// Initialize a new entry. /// </summary> /// <param name="table">The related <see cref="Table"/>.</param> protected EntryBase(Table table) { // Remember Table = table; }
/// <summary> /// Process a table. /// </summary> /// <param name="table">The SI table found.</param> /// <returns>Set if the filter can be stopped.</returns> protected abstract bool OnTableFound(Table table);
/// <summary> /// Create a new instance. /// </summary> /// <remarks> /// A private copy of the raw data will be created exclusivly for this instance. /// If the checksum could be validated the constructor tries to use /// <see cref="EPG.Table.Create"/> to create our <see cref="Table"/>. The /// result of the call will only be used if <see cref="EPG.Table.IsValid"/> /// is set. /// </remarks> /// <param name="tableIdentifier">The related table indentifier.</param> /// <param name="syntax">The syntax indicator.</param> /// <param name="rawData">Raw data from some external buffer.</param> /// <param name="offset">First byte of our raw data in the buffer - actually /// the first byte for our <see cref="Table"/>.</param> /// <param name="length">Number of bytes in our raw data.</param> /// <param name="isValid">Set if the <see cref="CRC32"/> checksum could be validated.</param> private Section(byte tableIdentifier, bool syntax, byte[] rawData, int offset, int length, bool isValid) { // Remember TableIdentifier = tableIdentifier; Length = 3 + length; IsValid = isValid; Syntax = syntax; // Create helper m_RawData = new byte[length]; // Fill helper Array.Copy(rawData, offset, m_RawData, 0, length); // Don't try to create table if (!IsValid) return; // Create the table Table = EPG.Table.Create(this); // Discard if (!Table.IsValid) Table = null; }
/// <summary> /// Create a new event instance. /// </summary> /// <param name="table">The related <see cref="Tables.EIT"/> table.</param> /// <param name="offset">The first byte of this event in the <see cref="EPG.Table.Section"/> /// for the related <see cref="Table"/>.</param> /// <param name="length">The maximum number of bytes available. If this number /// is greater than the <see cref="Length"/> of this event another event will /// follow in the same table.</param> internal EventEntry(Table table, int offset, int length) : base(table) { // Access section Section section = Section; // Helper byte flags = section[offset + 10]; // Decode int highLoop = flags&0xf; int lowLoop = section[offset + 11]; // Construct EventIdentifier = Tools.MergeBytesToWord(section[offset + 1], section[offset + 0]); // Remember offset to delay load times m_Offset = offset; // Direct FreeCA = (0 != (flags&0x10)); Status = (EventStatus)((flags>>5)&0x7); // Number of descriptors int loop = lowLoop + 256 * highLoop; // Caluclate the total length Length = 12 + loop; // Verify if ( Length > length ) return; // Install delay load of descriptors m_Loader = new Descriptors.DescriptorLoader(this, offset + 12, loop); // Can use it IsValid = true; }
/// <summary> /// Create a new event instance. /// </summary> /// <param name="table">The related <see cref="Tables.EIT"/> table.</param> /// <param name="offset">The first byte of this event in the <see cref="EPG.Table.Section"/> /// for the related <see cref="Table"/>.</param> /// <param name="length">The maximum number of bytes available. If this number /// is greater than the <see cref="Length"/> of this event another event will /// follow in the same table.</param> /// <returns>A new event instance or <i>null</i> if there are less than /// 12 bytes available.</returns> static internal EventEntry Create(Table table, int offset, int length) { // Validate if ( length < 12 ) return null; // Create return new EventEntry(table, offset, length); }
/// <summary> /// Create a new program instance. /// </summary> /// <param name="table">The related <see cref="Tables.PMT"/> table.</param> /// <param name="offset">The first byte of this service in the <see cref="EPG.Table.Section"/> /// for the related <see cref="Table"/>.</param> /// <param name="length">The maximum number of bytes available. If this number /// is greater than the <see cref="Length"/> of this program entry another entry will /// follow in the same table.</param> /// <returns>A new service instance or <i>null</i> if there are less than /// 5 bytes available.</returns> internal static ProgramEntry Create(Table table, int offset, int length) { // Validate if ( length < 5 ) return null; // Create return new ProgramEntry(table, offset, length); }
/// <summary> /// Create a new service instance. /// </summary> /// <param name="table">The related <see cref="Tables.SDT"/> table.</param> /// <param name="offset">The first byte of this service in the <see cref="EPG.Table.Section"/> /// for the related <see cref="Table"/>.</param> /// <param name="length">The maximum number of bytes available. If this number /// is greater than the <see cref="Length"/> of this event another event will /// follow in the same table.</param> /// <returns>A new service instance or <i>null</i> if there are less than /// 5 bytes available.</returns> static internal ServiceEntry Create(Table table, int offset, int length) { // Validate if (length < 5) return null; // Create return new ServiceEntry(table, offset, length); }
/// <summary> /// Create a new event instance. /// </summary> /// <param name="table">The related <see cref="Tables.EIT"/> table.</param> /// <param name="offset">The first byte of this event in the <see cref="EPG.Table.Section"/> /// for the related <see cref="Table"/>.</param> /// <param name="length">The maximum number of bytes available. If this number /// is greater than the <see cref="Length"/> of this event another event will /// follow in the same table.</param> internal EventEntry(Table table, int offset, int length) : base(table) { // Access section Section section = Section; // Helper byte flags = section[offset + 10]; // Decode int highLoop = flags&0xf; int lowLoop = section[offset + 11]; // Construct EventIdentifier = Tools.MergeBytesToWord(section[offset + 1], section[offset + 0]); // Times StartTime = Tools.DecodeTime(section, offset + 2); Duration = Tools.DecodeDuration(section, offset + 7); // Direct FreeCA = (0 != (flags&0x10)); Status = (EventStatus)((flags>>5)&0x7); // Number of descriptors int loop = lowLoop + 256 * highLoop; // Caluclate the total length Length = 12 + loop; // Verify if ( Length > length ) return; // Try to load descriptors Descriptors = Descriptor.Load(this, offset + 12, loop); // Can use it IsValid = true; }