Ejemplo n.º 1
0
        /// <summary>
        /// Process the bouquet data.
        /// </summary>
        /// <param name="sections">A collection of MPEG2 sections containing the bouquet data.</param>
        protected override void ProcessBouquetSections(Collection <Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.TraceIDs.Contains("BOUQUETSECTIONS"))
                {
                    Logger.Instance.Dump("Bouquet Section", section.Data, section.Length);
                }

                BouquetAssociationSection bouquetSection = BouquetAssociationSection.ProcessBouquetAssociationTable(section.Data);
                if (bouquetSection != null)
                {
                    bool added = BouquetAssociationSection.AddSection(bouquetSection);
                    if (added)
                    {
                        if (bouquetSection.TransportStreams != null)
                        {
                            foreach (TransportStream transportStream in bouquetSection.TransportStreams)
                            {
                                if (transportStream.Descriptors != null)
                                {
                                    foreach (DescriptorBase descriptor in transportStream.Descriptors)
                                    {
                                        FreeSatChannelInfoDescriptor freeSatInfoDescriptor = descriptor as FreeSatChannelInfoDescriptor;
                                        if (freeSatInfoDescriptor != null)
                                        {
                                            if (freeSatInfoDescriptor.ChannelInfoEntries != null)
                                            {
                                                foreach (FreeSatChannelInfoEntry channelInfoEntry in freeSatInfoDescriptor.ChannelInfoEntries)
                                                {
                                                    FreeSatChannel channel = new FreeSatChannel();
                                                    channel.OriginalNetworkID = transportStream.OriginalNetworkID;
                                                    channel.TransportStreamID = transportStream.TransportStreamID;
                                                    channel.ServiceID         = channelInfoEntry.ServiceID;
                                                    channel.UserChannel       = channelInfoEntry.UserNumber;
                                                    channel.Unknown1          = channelInfoEntry.Unknown1;
                                                    channel.Unknown2          = channelInfoEntry.Unknown2;
                                                    channel.BouquetID         = bouquetSection.BouquetID;
                                                    FreeSatChannel.AddChannel(channel);

                                                    Bouquet bouquet = Bouquet.FindBouquet(channel.BouquetID);
                                                    if (bouquet == null)
                                                    {
                                                        bouquet = new Bouquet(channel.BouquetID, BouquetAssociationSection.FindBouquetName(channel.BouquetID));
                                                        Bouquet.AddBouquet(bouquet);
                                                    }

                                                    Region region = bouquet.FindRegion(channel.Region);
                                                    if (region == null)
                                                    {
                                                        region = new Region(string.Empty, channel.Region);
                                                        bouquet.AddRegion(region);
                                                    }

                                                    region.AddChannel(channel);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Process the bouquet data.
        /// </summary>
        /// <param name="sections">A collection of MPEG2 sections containing the bouquet data.</param>
        protected override void ProcessBouquetSections(Collection<Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.TraceIDs.Contains("BOUQUETSECTIONS"))
                    Logger.Instance.Dump("Bouquet Section", section.Data, section.Length);

                BouquetAssociationSection bouquetSection = BouquetAssociationSection.ProcessBouquetAssociationTable(section.Data);
                if (bouquetSection != null)
                {
                    bool added = BouquetAssociationSection.AddSection(bouquetSection);
                    if (added)
                    {
                        if (bouquetSection.TransportStreams != null)
                        {
                            foreach (TransportStream transportStream in bouquetSection.TransportStreams)
                            {
                                if (transportStream.Descriptors != null)
                                {
                                    foreach (DescriptorBase descriptor in transportStream.Descriptors)
                                    {
                                        FreeSatChannelInfoDescriptor freeSatInfoDescriptor = descriptor as FreeSatChannelInfoDescriptor;
                                        if (freeSatInfoDescriptor != null)
                                        {
                                            if (freeSatInfoDescriptor.ChannelInfoEntries != null)
                                            {
                                                foreach (FreeSatChannelInfoEntry channelInfoEntry in freeSatInfoDescriptor.ChannelInfoEntries)
                                                {
                                                    FreeSatChannel channel = new FreeSatChannel();
                                                    channel.OriginalNetworkID = transportStream.OriginalNetworkID;
                                                    channel.TransportStreamID = transportStream.TransportStreamID;
                                                    channel.ServiceID = channelInfoEntry.ServiceID;
                                                    channel.UserChannel = channelInfoEntry.UserNumber;
                                                    channel.Unknown1 = channelInfoEntry.Unknown1;
                                                    channel.Unknown2 = channelInfoEntry.Unknown2;
                                                    channel.BouquetID = bouquetSection.BouquetID;
                                                    FreeSatChannel.AddChannel(channel);

                                                    Bouquet bouquet = Bouquet.FindBouquet(channel.BouquetID);
                                                    if (bouquet == null)
                                                    {
                                                        bouquet = new Bouquet(channel.BouquetID, BouquetAssociationSection.FindBouquetName(channel.BouquetID));
                                                        Bouquet.AddBouquet(bouquet);
                                                    }

                                                    Region region = bouquet.FindRegion(channel.Region);
                                                    if (region == null)
                                                    {
                                                        region = new Region(string.Empty, channel.Region);
                                                        bouquet.AddRegion(region);
                                                    }

                                                    region.AddChannel(channel);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }