/// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        /// <param name="region">The region being processed.</param>
        internal void Process(byte[] byteData, int index, int region)
        {
            lastIndex   = index;
            this.region = region;

            int nameLength = (int)byteData[lastIndex];

            lastIndex++;

            if (nameLength != 0)
            {
                name = new MultipleString();
                name.Process(byteData, lastIndex);
                name.LogMessage();

                lastIndex = name.Index;
            }

            int dimensionCount = (int)byteData[lastIndex];

            lastIndex++;

            if (dimensionCount != 0)
            {
                dimensions = new Collection <RatingRegionDimension>();

                while (dimensionCount != 0)
                {
                    RatingRegionDimension dimension = new RatingRegionDimension();
                    dimension.Process(byteData, lastIndex);

                    dimensions.Add(dimension);

                    lastIndex = dimension.Index;
                    dimensionCount--;
                }
            }

            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();
        }
Exemple #2
0
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        /// <param name="region">The region being processed.</param>
        internal void Process(byte[] byteData, int index, int region)
        {
            lastIndex = index;
            this.region = region;

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

            if (nameLength != 0)
            {
                name = new MultipleString();
                name.Process(byteData, lastIndex);
                name.LogMessage();

                lastIndex = name.Index;
            }

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

            if (dimensionCount != 0)
            {
                dimensions = new Collection<RatingRegionDimension>();

                while (dimensionCount != 0)
                {
                    RatingRegionDimension dimension = new RatingRegionDimension();
                    dimension.Process(byteData, lastIndex);

                    dimensions.Add(dimension);

                    lastIndex = dimension.Index;
                    dimensionCount--;
                }
            }

            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();
        }