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

            try
            {
                profileIDTag = Utils.GetBytes(byteData, lastIndex, 4);
                lastIndex   += 4;

                dataLength = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

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

                if (Utils.CompareBytes(profileIDTag, BIOPProfileBody.Tag))
                {
                    profileBody = new BIOPProfileBody();
                    profileBody.Process(byteData, lastIndex);
                    lastIndex = profileBody.Index;
                }
                else
                {
                    if (Utils.CompareBytes(profileIDTag, BIOPLiteOptionsProfileBody.Tag))
                    {
                        liteOptionsProfileBody = new BIOPLiteOptionsProfileBody();
                        liteOptionsProfileBody.Process(byteData, lastIndex);
                        lastIndex = liteOptionsProfileBody.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Profile message is short"));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Parse the profile.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the profile.</param>
        /// <param name="index">Index of the first byte of the profile in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                profileIDTag = Utils.GetBytes(byteData, lastIndex, 4);
                lastIndex += 4;

                dataLength = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

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

                if (Utils.CompareBytes(profileIDTag, BIOPProfileBody.Tag))
                {
                    profileBody = new BIOPProfileBody();
                    profileBody.Process(byteData, lastIndex);
                    lastIndex = profileBody.Index;
                }
                else
                {
                    if (Utils.CompareBytes(profileIDTag, BIOPLiteOptionsProfileBody.Tag))
                    {
                        liteOptionsProfileBody = new BIOPLiteOptionsProfileBody();
                        liteOptionsProfileBody.Process(byteData, lastIndex);
                        lastIndex = liteOptionsProfileBody.Index;
                    }
                }

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