Exemple #1
0
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the descriptor.</param>
        /// <param name="index">Index of the first byte of the descriptor in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                descriptorLength = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex       += 2;

                descriptorCount = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex      += 2;

                if (descriptorCount != 0)
                {
                    descriptorEntries = new Collection <DSMCCCompatibilityDescriptorEntry>();

                    while (descriptorEntries.Count != descriptorCount)
                    {
                        DSMCCCompatibilityDescriptorEntry descriptorEntry = new DSMCCCompatibilityDescriptorEntry();
                        descriptorEntry.Process(byteData, lastIndex);
                        descriptorEntries.Add(descriptorEntry);

                        lastIndex = descriptorEntry.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The DSMCC Compatability 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 first byte of the descriptor in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                descriptorLength = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex += 2;

                descriptorCount = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex += 2;

                if (descriptorCount != 0)
                {
                    descriptorEntries = new Collection<DSMCCCompatibilityDescriptorEntry>();

                    while (descriptorEntries.Count != descriptorCount)
                    {
                        DSMCCCompatibilityDescriptorEntry descriptorEntry = new DSMCCCompatibilityDescriptorEntry();
                        descriptorEntry.Process(byteData, lastIndex);
                        descriptorEntries.Add(descriptorEntry);

                        lastIndex = descriptorEntry.Index;
                    }
                }

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