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

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

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

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

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

                if (selectorLength != 0)
                {
                    selectorData = Utils.GetBytes(byteData, lastIndex, selectorLength);
                }

                if (selectorLength == BIOPTapSelector.TapSelectorLength)
                {
                    tapSelector = new BIOPTapSelector();
                    tapSelector.Process(byteData, lastIndex);
                }

                lastIndex += selectorLength;

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

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

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

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

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

                if (selectorLength != 0)
                    selectorData = Utils.GetBytes(byteData, lastIndex, selectorLength);

                if (selectorLength == BIOPTapSelector.TapSelectorLength)
                {
                    tapSelector = new BIOPTapSelector();
                    tapSelector.Process(byteData, lastIndex);
                }

                lastIndex += selectorLength;

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