示例#1
0
        /// <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;
        }
示例#2
0
		/// <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;
		}