Ejemplo n.º 1
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>
        internal void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header)
        {
            lastIndex         = mpeg2Header.Index;
            bouquetID         = mpeg2Header.TableIDExtension;
            sectionNumber     = mpeg2Header.SectionNumber;
            lastSectionNumber = mpeg2Header.LastSectionNumber;

            int bouquetDescriptorLength = ((byteData[lastIndex] & 0x0f) * 256) + byteData[lastIndex + 1];

            lastIndex += 2;

            if (bouquetDescriptorLength != 0)
            {
                bouquetDescriptors = new Collection <DescriptorBase>();

                while (bouquetDescriptorLength > 0)
                {
                    DescriptorBase descriptor = DescriptorBase.Instance(byteData, lastIndex, Scope.Bouquet);

                    if (!descriptor.IsEmpty)
                    {
                        bouquetDescriptors.Add(descriptor);
                        lastIndex = descriptor.Index;

                        bouquetDescriptorLength -= descriptor.TotalLength;
                    }
                    else
                    {
                        lastIndex += DescriptorBase.MinimumDescriptorLength;
                        bouquetDescriptorLength -= DescriptorBase.MinimumDescriptorLength;
                    }
                }
            }

            int transportStreamLoopLength = ((byteData[lastIndex] & 0x0f) * 256) + byteData[lastIndex + 1];

            lastIndex += 2;

            if (transportStreamLoopLength != 0)
            {
                transportStreams = new Collection <TransportStream>();

                while (transportStreamLoopLength > 0)
                {
                    TransportStream transportStream = new TransportStream();
                    transportStream.Process(byteData, lastIndex, Scope.Bouquet);
                    transportStreams.Add(transportStream);

                    lastIndex = transportStream.Index;
                    transportStreamLoopLength -= transportStream.TotalLength;
                }
            }

            lastIndex += transportStreamLoopLength;
        }
        /// <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>
        internal void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header)
        {
            lastIndex = mpeg2Header.Index;
            bouquetID = mpeg2Header.TableIDExtension;
            sectionNumber = mpeg2Header.SectionNumber;
            lastSectionNumber = mpeg2Header.LastSectionNumber;

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

            if (bouquetDescriptorLength != 0)
            {
                bouquetDescriptors = new Collection<DescriptorBase>();

                while (bouquetDescriptorLength > 0)
                {
                    DescriptorBase descriptor = DescriptorBase.Instance(byteData, lastIndex, Scope.Bouquet);

                    if (!descriptor.IsEmpty)
                    {
                        bouquetDescriptors.Add(descriptor);
                        lastIndex = descriptor.Index;

                        bouquetDescriptorLength -= descriptor.TotalLength;
                    }
                    else
                    {
                        lastIndex += DescriptorBase.MinimumDescriptorLength;
                        bouquetDescriptorLength -= DescriptorBase.MinimumDescriptorLength;
                    }
                }
            }

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

            if (transportStreamLoopLength != 0)
            {
                transportStreams = new Collection<TransportStream>();

                while (transportStreamLoopLength > 0)
                {
                    TransportStream transportStream = new TransportStream();
                    transportStream.Process(byteData, lastIndex, Scope.Bouquet);
                    transportStreams.Add(transportStream);

                    lastIndex = transportStream.Index;
                    transportStreamLoopLength -= transportStream.TotalLength;
                }
            }

            lastIndex += transportStreamLoopLength;
        }