示例#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 attributeCount = byteData[lastIndex] & 0x1f;
                lastIndex++;

                if (attributeCount != 0)
                {
                    attributes = new Collection <GenreAttribute>();

                    while (attributeCount != 0)
                    {
                        GenreAttribute attribute = new GenreAttribute();
                        attribute.Process(byteData, lastIndex);
                        attributes.Add(attribute);

                        lastIndex = attribute.Index;
                        attributeCount--;
                    }
                }

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

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

                if (attributeCount != 0)
                {
                    attributes = new Collection<GenreAttribute>();

                    while (attributeCount != 0)
                    {
                        GenreAttribute attribute = new GenreAttribute();
                        attribute.Process(byteData, lastIndex);
                        attributes.Add(attribute);

                        lastIndex = attribute.Index;
                        attributeCount--;
                    }
                }

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