Esempio n. 1
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>
        internal override void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                int regionCount = byteData[lastIndex] & 0x1f;
                lastIndex++;

                if (regionCount != 0)
                {
                    regions = new Collection <ContentAdvisoryRatingRegion>();

                    while (regionCount != 0)
                    {
                        ContentAdvisoryRatingRegion region = new ContentAdvisoryRatingRegion();
                        region.Process(byteData, lastIndex);
                        regions.Add(region);

                        lastIndex = region.Index;
                        regionCount--;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Content Advisory Descriptor message is short"));
            }
        }
        /// <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>
        internal override void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                int regionCount = byteData[lastIndex] & 0x1f;
                lastIndex++;

                if (regionCount != 0)
                {
                    regions = new Collection<ContentAdvisoryRatingRegion>();

                    while (regionCount != 0)
                    {
                        ContentAdvisoryRatingRegion region = new ContentAdvisoryRatingRegion();
                        region.Process(byteData, lastIndex);
                        regions.Add(region);

                        lastIndex = region.Index;
                        regionCount--;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Content Advisory Descriptor message is short"));
            }
        }