Пример #1
0
        /// <summary>
        /// Parse the header.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the header.</param>
        /// <param name="mpeg2Header">Header of the MPEG2 section.</param>
        public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header)
        {
            lastIndex = mpeg2Header.Index;

            this.mpeg2Header = mpeg2Header;

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

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

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

                transactionID = new DSMCCTransactionID(Utils.Convert4BytesToInt(byteData, lastIndex));
                lastIndex    += 4;

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

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

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

                if (adaptionLength != 0)
                {
                    adaptionData = Utils.GetBytes(byteData, lastIndex, adaptionLength);
                    lastIndex   += adaptionLength;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The DSMCC header is short"));
            }
        }
Пример #2
0
        /// <summary>
        /// Parse the tap selector.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the tap selector.</param>
        /// <param name="index">Index of the first byte of the tap selector in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

                transactionID = new DSMCCTransactionID(Utils.Convert4BytesToInt(byteData, lastIndex));
                lastIndex    += 4;

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

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Tap Selector message is short"));
            }
        }
Пример #3
0
        /// <summary>
        /// Parse the tap selector.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the tap selector.</param>
        /// <param name="index">Index of the first byte of the tap selector in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

                transactionID = new DSMCCTransactionID(Utils.Convert4BytesToInt(byteData, lastIndex));
                lastIndex += 4;

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

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Tap Selector message is short"));
            }
        }
Пример #4
0
        /// <summary>
        /// Parse the header.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the header.</param>
        /// <param name="mpeg2Header">Header of the MPEG2 section.</param>
        public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header)
        {
            lastIndex = mpeg2Header.Index;

            this.mpeg2Header = mpeg2Header;

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

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

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

                transactionID = new DSMCCTransactionID(Utils.Convert4BytesToInt(byteData, lastIndex));
                lastIndex += 4;

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

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

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

                if (adaptionLength != 0)
                {
                    adaptionData = Utils.GetBytes(byteData, lastIndex, adaptionLength);
                    lastIndex += adaptionLength;
                }

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