Beispiel #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>
        public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header)
        {
            lastIndex = mpeg2Header.Index;

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

            int tableCount = Utils.Convert2BytesToInt(byteData, lastIndex);

            lastIndex += 2;

            if (tableCount != 0)
            {
                tableEntries = new Collection <MasterGuideTableEntry>();

                while (tableCount != 0)
                {
                    MasterGuideTableEntry tableEntry = new MasterGuideTableEntry();
                    tableEntry.Process(byteData, lastIndex);

                    tableEntries.Add(tableEntry);

                    lastIndex += tableEntry.TotalLength;
                    tableCount--;
                }
            }

            int descriptorLoopLength = ((byteData[lastIndex] & 0x0f) * 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();
        }
Beispiel #2
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>
        public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header)
        {
            lastIndex = mpeg2Header.Index;

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

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

            if (tableCount != 0)
            {
                tableEntries = new Collection<MasterGuideTableEntry>();

                while (tableCount != 0)
                {
                    MasterGuideTableEntry tableEntry = new MasterGuideTableEntry();
                    tableEntry.Process(byteData, lastIndex);

                    tableEntries.Add(tableEntry);

                    lastIndex += tableEntry.TotalLength;
                    tableCount--;
                }
            }

            int descriptorLoopLength = ((byteData[lastIndex] & 0x0f) * 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();
        }