/// <summary>
        /// Parse the section.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the section.</param>
        /// <param name="mpeg2Header">The MPEG2 header that preceedes the section.</param>
        /// <param name="isCable">True is the section is a virtual cable section;false otherwise.</param>
        /// <param name="frequency">The frequency being processed.</param>
        public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header, bool isCable, int frequency)
        {
            lastIndex         = mpeg2Header.Index;
            lastSectionNumber = mpeg2Header.LastSectionNumber;

            protocolVersion = (int)byteData[lastIndex];
            lastIndex++;

            int channelCount = (int)byteData[lastIndex];

            lastIndex++;

            if (channelCount != 0)
            {
                if (channels == null)
                {
                    channels = new Collection <VirtualChannel>();
                }

                while (channelCount != 0)
                {
                    VirtualChannel channel = new VirtualChannel(frequency);
                    channel.Process(byteData, lastIndex, isCable);

                    addChannel(channel);

                    lastIndex += channel.TotalLength;
                    channelCount--;
                }
            }

            int descriptorLoopLength = ((byteData[lastIndex] & 0x03) * 256) + (int)byteData[lastIndex + 1];

            lastIndex += 2;

            if (descriptorLoopLength != 0)
            {
                descriptors = new Collection <DescriptorBase>();

                while (descriptorLoopLength != 0)
                {
                    while (descriptorLoopLength != 0)
                    {
                        DescriptorBase descriptor = DescriptorBase.AtscInstance(byteData, lastIndex);
                        descriptors.Add(descriptor);

                        lastIndex             = descriptor.Index;
                        descriptorLoopLength -= descriptor.TotalLength;
                    }
                }
            }

            Validate();
        }
        private void addChannel(VirtualChannel newChannel)
        {
            foreach (VirtualChannel oldChannel in Channels)
            {
                if (oldChannel.CollectionFrequency == newChannel.CollectionFrequency && oldChannel.SourceID == newChannel.SourceID)
                {
                    return;
                }
            }

            Channels.Add(newChannel);
        }
        private void processEvent(int frequency, int sourceID, EventInformationTableEntry eventEntry)
        {
            VirtualChannel channel = VirtualChannelTable.FindChannel(frequency, sourceID);

            if (channel == null)
            {
                return;
            }

            EPGEntry epgEntry = new EPGEntry();

            epgEntry.EventID = eventEntry.EventID;

            if (eventEntry.EventName != null)
            {
                epgEntry.EventName = eventEntry.EventName.ToString().Replace("\0", "");
            }
            else
            {
                epgEntry.EventName = "No Event Name";
            }

            if (eventEntry.ETMLocation == 1 || eventEntry.ETMLocation == 2)
            {
                ExtendedTextTableEntry textEntry = ExtendedTextTable.FindEntry(sourceID, eventEntry.EventID);
                if (textEntry != null)
                {
                    epgEntry.ShortDescription = textEntry.Text.ToString().Replace("\0", "");
                }
            }

            epgEntry.StartTime            = Utils.RoundTime(TimeOffsetEntry.GetAdjustedTime(eventEntry.StartTime));
            epgEntry.Duration             = Utils.RoundTime(eventEntry.Duration);
            epgEntry.EventCategory        = getEventCategory(epgEntry.EventName, epgEntry.ShortDescription, eventEntry);
            epgEntry.ParentalRating       = eventEntry.ParentalRating;
            epgEntry.ParentalRatingSystem = "VCHIP";
            epgEntry.AudioQuality         = eventEntry.AudioQuality;
            epgEntry.EPGSource            = EPGSource.PSIP;

            channel.AddEPGEntry(epgEntry);
        }
示例#4
0
        private void addChannel(VirtualChannel newChannel)
        {
            foreach (VirtualChannel oldChannel in Channels)
            {
                if (oldChannel.CollectionFrequency == newChannel.CollectionFrequency && oldChannel.SourceID == newChannel.SourceID)
                    return;
            }

            Channels.Add(newChannel);
        }
示例#5
0
        /// <summary>
        /// Parse the section.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the section.</param>
        /// <param name="mpeg2Header">The MPEG2 header that preceedes the section.</param>
        /// <param name="isCable">True is the section is a virtual cable section;false otherwise.</param>
        /// <param name="frequency">The frequency being processed.</param>
        public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header, bool isCable, int frequency)
        {
            lastIndex = mpeg2Header.Index;
            lastSectionNumber = mpeg2Header.LastSectionNumber;

            protocolVersion = (int)byteData[lastIndex];
            lastIndex++;

            int channelCount = (int)byteData[lastIndex];
            lastIndex++;

            if (channelCount != 0)
            {
                if (channels == null)
                    channels = new Collection<VirtualChannel>();

                while (channelCount != 0)
                {
                    VirtualChannel channel = new VirtualChannel(frequency);
                    channel.Process(byteData, lastIndex, isCable);

                    addChannel(channel);

                    lastIndex += channel.TotalLength;
                    channelCount--;
                }
            }

            int descriptorLoopLength = ((byteData[lastIndex] & 0x03) * 256) + (int)byteData[lastIndex + 1];
            lastIndex += 2;

            if (descriptorLoopLength != 0)
            {
                descriptors = new Collection<DescriptorBase>();

                while (descriptorLoopLength != 0)
                {
                    while (descriptorLoopLength != 0)
                    {
                        DescriptorBase descriptor = DescriptorBase.AtscInstance(byteData, lastIndex);
                        descriptors.Add(descriptor);

                        lastIndex = descriptor.Index;
                        descriptorLoopLength -= descriptor.TotalLength;
                    }
                }
            }

            Validate();
        }