Exemple #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.DebugIDs.Contains("BOUQUETSECTIONS"))
                {
                    Logger.Instance.Dump("Bouquet Section", section.Data, section.Data.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)
                                    {
                                        FreeviewChannelInfoDescriptor freeviewInfoDescriptor = descriptor as FreeviewChannelInfoDescriptor;
                                        if (freeviewInfoDescriptor != null)
                                        {
                                            processFreeviewInfoDescriptor(freeviewInfoDescriptor, transportStream.OriginalNetworkID, transportStream.TransportStreamID, bouquetSection.BouquetID);
                                        }
                                        else
                                        {
                                            OpenTVChannelInfoDescriptor openTVInfoDescriptor = descriptor as OpenTVChannelInfoDescriptor;
                                            if (openTVInfoDescriptor != null)
                                            {
                                                processOpenTVInfoDescriptor(openTVInfoDescriptor, transportStream.OriginalNetworkID, transportStream.TransportStreamID, bouquetSection.BouquetID);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void processFreeviewInfoDescriptor(FreeviewChannelInfoDescriptor freeviewInfoDescriptor, int originalNetworkID, int transportStreamID, int bouquetID)
        {
            if (freeviewInfoDescriptor.ChannelInfoEntries == null)
            {
                return;
            }

            if (openTVChannels != 0)
            {
                return;
            }

            foreach (FreeviewChannelInfoEntry channelInfoEntry in freeviewInfoDescriptor.ChannelInfoEntries)
            {
                EITChannel channel = new EITChannel();
                channel.OriginalNetworkID = originalNetworkID;
                channel.TransportStreamID = transportStreamID;
                channel.ServiceID         = channelInfoEntry.ServiceID;
                channel.UserChannel       = channelInfoEntry.UserNumber;
                channel.Flags             = channelInfoEntry.Flags;
                channel.BouquetID         = bouquetID;
                EITChannel.AddChannel(channel);

                eitChannels++;

                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);
            }
        }
Exemple #3
0
        private void processFreeviewInfoDescriptor(FreeviewChannelInfoDescriptor freeviewInfoDescriptor, int originalNetworkID, int transportStreamID, int bouquetID)
        {
            if (freeviewInfoDescriptor.ChannelInfoEntries == null)
                return;

            if (openTVChannels != 0)
                return;

            foreach (FreeviewChannelInfoEntry channelInfoEntry in freeviewInfoDescriptor.ChannelInfoEntries)
            {
                EITChannel channel = new EITChannel();
                channel.OriginalNetworkID = originalNetworkID;
                channel.TransportStreamID = transportStreamID;
                channel.ServiceID = channelInfoEntry.ServiceID;
                channel.UserChannel = channelInfoEntry.UserNumber;
                channel.Flags = channelInfoEntry.Flags;
                channel.BouquetID = bouquetID;
                EITChannel.AddChannel(channel);

                eitChannels++;

                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);
            }
        }
Exemple #4
0
        /// <summary>
        /// Create an instance of the descriptor class.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the descriptor.</param>
        /// <param name="index">The index of the tag byte of the descriptor.</param>
        /// <param name="scope">The current scope.</param>
        /// <returns>A descriptor instance.</returns>
        internal static DescriptorBase Instance(byte[] byteData, int index, Scope scope)
        {
            DescriptorBase descriptor;

            switch ((int)byteData[index])
            {
            case NetworkNameDescriptorTag:
                descriptor = new DVBNetworkNameDescriptor();
                break;

            case SatelliteDeliverySystemDescriptorTag:
                descriptor = new DVBSatelliteDeliverySystemDescriptor();
                break;

            case ServiceDescriptorTag:
                descriptor = new DVBServiceDescriptor();
                break;

            case ServiceListDescriptorTag:
                descriptor = new DVBServiceListDescriptor();
                break;

            case ShortEventDescriptorTag:
                descriptor = new DVBShortEventDescriptor();
                break;

            case ExtendedEventDescriptorTag:
                descriptor = new DVBExtendedEventDescriptor();
                break;

            case ComponentDescriptorTag:
                descriptor = new DVBComponentDescriptor();
                break;

            case ContentDescriptorTag:
                descriptor = new DVBContentDescriptor();
                break;

            case ParentalRatingDescriptorTag:
                descriptor = new DVBParentalRatingDescriptor();
                break;

            case BouquetNameDescriptorTag:
                descriptor = new DVBBouquetNameDescriptor();
                break;

            case LocalTimeOffsetDescriptorTag:
                descriptor = new DVBLocalTimeOffsetDescriptor();
                break;

            case OpenTVChannelInfoDescriptorTag:
                descriptor = new OpenTVChannelInfoDescriptor();
                break;

            case GenericChannelInfoDescriptorTag:
                switch (scope)
                {
                case Scope.Bouquet:
                    descriptor = new FreeviewChannelInfoDescriptor();
                    break;

                case Scope.ServiceDescripton:
                    descriptor = new ServiceChannelDescriptor();
                    break;

                default:
                    descriptor = new DescriptorBase();
                    break;
                }
                break;

            case FreeviewChannelInfoDescriptorTag:
            case TurkeyChannelInfoDescriptorTag:
            case E2ChannelInfoDescriptorTag:
                if (scope == Scope.Bouquet)
                {
                    descriptor = new FreeviewChannelInfoDescriptor();
                }
                else
                {
                    descriptor = new DescriptorBase();
                }
                break;

            case FreeSatChannelInfoDescriptorTag:
                descriptor = new FreeSatChannelInfoDescriptor();
                break;

            case ContentIdentifierDescriptorTag:
                descriptor = new DVBContentIdentifierDescriptor();
                break;

            default:
                descriptor = new DescriptorBase();
                break;
            }

            descriptor.tag = (int)byteData[index];
            index++;

            descriptor.length = (int)byteData[index];
            index++;

            if (descriptor.Length != 0)
            {
                descriptor.Process(byteData, index);
            }

            return(descriptor);
        }
Exemple #5
0
        /// <summary>
        /// Create an instance of the descriptor class.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the descriptor.</param>
        /// <param name="index">The index of the tag byte of the descriptor.</param>
        /// <param name="scope">The current scope.</param>
        /// <returns>A descriptor instance.</returns>
        internal static DescriptorBase Instance(byte[] byteData, int index, Scope scope)
        {
            DescriptorBase descriptor;

            switch ((int)byteData[index])
            {
                case NetworkNameDescriptorTag:
                    descriptor = new DVBNetworkNameDescriptor();
                    break;
                case SatelliteDeliverySystemDescriptorTag:
                    descriptor = new DVBSatelliteDeliverySystemDescriptor();
                    break;
                case ServiceDescriptorTag:
                    descriptor = new DVBServiceDescriptor();
                    break;
                case ServiceListDescriptorTag:
                    descriptor = new DVBServiceListDescriptor();
                    break;
                case ShortEventDescriptorTag:
                    descriptor = new DVBShortEventDescriptor();
                    break;
                case ExtendedEventDescriptorTag:
                    descriptor = new DVBExtendedEventDescriptor();
                    break;
                case ComponentDescriptorTag:
                    descriptor = new DVBComponentDescriptor();
                    break;
                case ContentDescriptorTag:
                    descriptor = new DVBContentDescriptor();
                    break;
                case ParentalRatingDescriptorTag:
                    descriptor = new DVBParentalRatingDescriptor();
                    break;
                case BouquetNameDescriptorTag:
                    descriptor = new DVBBouquetNameDescriptor();
                    break;
                case LocalTimeOffsetDescriptorTag:
                    descriptor = new DVBLocalTimeOffsetDescriptor();
                    break;
                case OpenTVChannelInfoDescriptorTag:
                    descriptor = new OpenTVChannelInfoDescriptor();
                    break;
                case GenericChannelInfoDescriptorTag:
                    switch (scope)
                    {
                        case Scope.Bouquet:
                            descriptor = new FreeviewChannelInfoDescriptor();
                            break;
                        case Scope.ServiceDescripton:
                            descriptor = new ServiceChannelDescriptor();
                            break;
                        default:
                            descriptor = new DescriptorBase();
                            break;
                    }
                    break;
                case FreeviewChannelInfoDescriptorTag:
                case TurkeyChannelInfoDescriptorTag:
                case E2ChannelInfoDescriptorTag:
                    if (scope == Scope.Bouquet)
                        descriptor = new FreeviewChannelInfoDescriptor();
                    else
                        descriptor = new DescriptorBase();
                    break;
                case FreeSatChannelInfoDescriptorTag:
                    descriptor = new FreeSatChannelInfoDescriptor();
                    break;
                case ContentIdentifierDescriptorTag:
                    descriptor = new DVBContentIdentifierDescriptor();
                    break;
                default:
                    descriptor = new DescriptorBase();
                    break;
            }

            descriptor.tag = (int)byteData[index];
            index++;

            descriptor.length = (int)byteData[index];
            index++;

            if (descriptor.Length != 0)
                descriptor.Process(byteData, index);

            return (descriptor);
        }