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

            try
            {
                componentsCount = (int)byteData[lastIndex];
                lastIndex++;

                objectLocation = new BIOPObjectLocation();
                objectLocation.Process(byteData, lastIndex);
                lastIndex = objectLocation.Index;

                connectionBinder = new DSMConnBinder();
                connectionBinder.Process(byteData, lastIndex);
                lastIndex = connectionBinder.Index;

                if (componentsCount > 2)
                {
                    liteComponents = new Collection <BIOPLiteComponent>();

                    while (liteComponents.Count != componentsCount - 2)
                    {
                        BIOPLiteComponent liteComponent = new BIOPLiteComponent();
                        liteComponent.Process(byteData, lastIndex);
                        liteComponents.Add(liteComponent);

                        lastIndex = liteComponent.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Profile Body message is short"));
            }
        }
コード例 #2
0
ファイル: BIOPProfileBody.cs プロジェクト: esurharun/TSDumper
        /// <summary>
        /// Parse the profile body.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the profile body.</param>
        /// <param name="index">Index of the first byte of the profile body in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                componentsCount = (int)byteData[lastIndex];
                lastIndex++;

                objectLocation = new BIOPObjectLocation();
                objectLocation.Process(byteData, lastIndex);
                lastIndex = objectLocation.Index;

                connectionBinder = new DSMConnBinder();
                connectionBinder.Process(byteData, lastIndex);
                lastIndex = connectionBinder.Index;

                if (componentsCount > 2)
                {
                    liteComponents = new Collection<BIOPLiteComponent>();

                    while (liteComponents.Count != componentsCount - 2)
                    {
                        BIOPLiteComponent liteComponent = new BIOPLiteComponent();
                        liteComponent.Process(byteData, lastIndex);
                        liteComponents.Add(liteComponent);

                        lastIndex = liteComponent.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Profile Body message is short"));
            }
        }