예제 #1
0
        /// <summary>
        /// Parse the entry.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the transport stream.</param>
        /// <param name="index">Index of the first byte of the transport stream in the MPEG2 section.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                eventID    = ((byteData[lastIndex] & 0x3f) * 256) + byteData[lastIndex + 1];
                lastIndex += 2;

                startTime  = new DateTime(1980, 1, 6, 0, 0, 0, DateTimeKind.Utc) + new TimeSpan(Utils.Convert4BytesToInt(byteData, lastIndex) * TimeSpan.TicksPerSecond);
                lastIndex += 4;

                etmLocation = (byteData[lastIndex] & 0x30) >> 4;
                duration    = new TimeSpan(
                    ((byteData[lastIndex] & 0x0f) * 16384) +
                    ((byteData[lastIndex + 1] * 256) +
                     byteData[lastIndex + 2])
                    * TimeSpan.TicksPerSecond);
                lastIndex += 3;

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

                if (titleLength != 0)
                {
                    eventName = new MultipleString();
                    eventName.Process(byteData, lastIndex);
                    lastIndex += titleLength;
                }

                int descriptorLoopLength = ((byteData[lastIndex] & 0x03) * 256) + (int)byteData[lastIndex + 1];
                lastIndex += 2;

                totalLength = (lastIndex - index) + descriptorLoopLength;

                if (descriptorLoopLength != 0)
                {
                    descriptors = new Collection <DescriptorBase>();

                    while (descriptorLoopLength != 0)
                    {
                        DescriptorBase descriptor = DescriptorBase.AtscInstance(byteData, lastIndex);
                        descriptors.Add(descriptor);

                        lastIndex             = descriptor.Index;
                        descriptorLoopLength -= descriptor.TotalLength;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The Event Information Table entry message is short"));
            }
        }
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

                if (nameLength != 0)
                {
                    name = new MultipleString();
                    name.Process(byteData, lastIndex);
                    name.LogMessage();

                    lastIndex = name.Index;
                }

                graduatedScale = ((byteData[lastIndex] & 0x10) != 0);

                int valueCount = byteData[lastIndex] & 0x0f;
                lastIndex++;

                if (valueCount != 0)
                {
                    values = new Collection <RatingRegionValue>();

                    while (valueCount != 0)
                    {
                        RatingRegionValue value = new RatingRegionValue();
                        value.Process(byteData, lastIndex);
                        values.Add(value);

                        lastIndex = value.Index;
                        valueCount--;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Rating Region Dimension message is short"));
            }
        }
예제 #3
0
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

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

                if (dimensionCount != 0)
                {
                    dimensions = new Collection <ContentAdvisoryRatingDimension>();

                    while (dimensionCount != 0)
                    {
                        ContentAdvisoryRatingDimension dimension = new ContentAdvisoryRatingDimension();
                        dimension.Process(byteData, lastIndex);
                        dimensions.Add(dimension);

                        lastIndex = dimension.Index;
                        dimensionCount--;
                    }
                }

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

                if (descriptionLength != 0)
                {
                    description = new MultipleString();
                    description.Process(byteData, lastIndex);
                    lastIndex = description.Index;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Content Advisory Rating Region message is short"));
            }
        }
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        internal override void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                if (Length != 0)
                {
                    longName = new MultipleString();
                    longName.Process(byteData, lastIndex);
                    lastIndex = longName.Index;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Extended Channel Name Descriptor message is short"));
            }
        }
        /// <summary>
        /// Parse the entry.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the transport stream.</param>
        /// <param name="index">Index of the first byte of the transport stream in the MPEG2 section.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

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

                text = new MultipleString();
                text.Process(byteData, lastIndex);
                lastIndex = text.Index;

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The Extended Text Table entry message is short"));
            }
        }
예제 #6
0
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

                if (abbreviatedTextLength != 0)
                {
                    abbreviatedText = new MultipleString();
                    abbreviatedText.Process(byteData, lastIndex);
                    abbreviatedText.LogMessage();

                    lastIndex = abbreviatedText.Index;
                }

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

                if (fullTextLength != 0)
                {
                    fullText = new MultipleString();
                    fullText.Process(byteData, lastIndex);
                    fullText.LogMessage();

                    lastIndex = fullText.Index;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Rating Region Value message is short"));
            }
        }
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

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

                if (dimensionCount != 0)
                {
                    dimensions = new Collection<ContentAdvisoryRatingDimension>();

                    while (dimensionCount != 0)
                    {
                        ContentAdvisoryRatingDimension dimension = new ContentAdvisoryRatingDimension();
                        dimension.Process(byteData, lastIndex);
                        dimensions.Add(dimension);

                        lastIndex = dimension.Index;
                        dimensionCount--;
                    }
                }

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

                if (descriptionLength != 0)
                {
                    description = new MultipleString();
                    description.Process(byteData, lastIndex);
                    lastIndex = description.Index;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Content Advisory Rating Region message is short"));
            }
        }
예제 #8
0
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        /// <param name="region">The region being processed.</param>
        internal void Process(byte[] byteData, int index, int region)
        {
            lastIndex   = index;
            this.region = region;

            int nameLength = (int)byteData[lastIndex];

            lastIndex++;

            if (nameLength != 0)
            {
                name = new MultipleString();
                name.Process(byteData, lastIndex);
                name.LogMessage();

                lastIndex = name.Index;
            }

            int dimensionCount = (int)byteData[lastIndex];

            lastIndex++;

            if (dimensionCount != 0)
            {
                dimensions = new Collection <RatingRegionDimension>();

                while (dimensionCount != 0)
                {
                    RatingRegionDimension dimension = new RatingRegionDimension();
                    dimension.Process(byteData, lastIndex);

                    dimensions.Add(dimension);

                    lastIndex = dimension.Index;
                    dimensionCount--;
                }
            }

            int descriptorLoopLength = ((byteData[lastIndex] & 0x03) * 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();
        }
예제 #9
0
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

                if (nameLength != 0)
                {
                    name = new MultipleString();
                    name.Process(byteData, lastIndex);
                    name.LogMessage();

                    lastIndex = name.Index;
                }

                graduatedScale = ((byteData[lastIndex] & 0x10) != 0);

                int valueCount = byteData[lastIndex] & 0x0f;
                lastIndex++;

                if (valueCount != 0)
                {
                    values = new Collection<RatingRegionValue>();

                    while (valueCount != 0)
                    {
                        RatingRegionValue value = new RatingRegionValue();
                        value.Process(byteData, lastIndex);
                        values.Add(value);

                        lastIndex = value.Index;
                        valueCount--;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Rating Region Dimension message is short"));
            }
        }
        /// <summary>
        /// Parse the entry.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the transport stream.</param>
        /// <param name="index">Index of the first byte of the transport stream in the MPEG2 section.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                eventID = ((byteData[lastIndex] & 0x3f) * 256) + byteData[lastIndex + 1];
                lastIndex += 2;

                startTime = new DateTime(1980, 1, 6, 0, 0, 0, DateTimeKind.Utc) + new TimeSpan(Utils.Convert4BytesToInt(byteData, lastIndex) * TimeSpan.TicksPerSecond);
                lastIndex+= 4;

                etmLocation = (byteData[lastIndex] &0x30) >> 4;
                duration = new TimeSpan(
                    ((byteData[lastIndex] & 0x0f) * 16384) +
                    ((byteData[lastIndex + 1] * 256) +
                    byteData[lastIndex + 2])
                    * TimeSpan.TicksPerSecond);
                lastIndex += 3;

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

                if (titleLength != 0)
                {
                    eventName = new MultipleString();
                    eventName.Process(byteData, lastIndex);
                    lastIndex += titleLength;
                }

                int descriptorLoopLength = ((byteData[lastIndex] & 0x03) * 256) + (int)byteData[lastIndex + 1];
                lastIndex += 2;

                totalLength = (lastIndex - index) + descriptorLoopLength;

                if (descriptorLoopLength != 0)
                {
                    descriptors = new Collection<DescriptorBase>();

                    while (descriptorLoopLength != 0)
                    {
                        DescriptorBase descriptor = DescriptorBase.AtscInstance(byteData, lastIndex);
                        descriptors.Add(descriptor);

                        lastIndex = descriptor.Index;
                        descriptorLoopLength -= descriptor.TotalLength;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The Event Information Table entry message is short"));
            }
        }
예제 #11
0
        /// <summary>
        /// Parse the entry.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the transport stream.</param>
        /// <param name="index">Index of the first byte of the transport stream in the MPEG2 section.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

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

                text = new MultipleString();
                text.Process(byteData, lastIndex);
                lastIndex = text.Index;

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The Extended Text Table entry message is short"));
            }
        }
예제 #12
0
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

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

                if (abbreviatedTextLength != 0)
                {
                    abbreviatedText = new MultipleString();
                    abbreviatedText.Process(byteData, lastIndex);
                    abbreviatedText.LogMessage();

                    lastIndex = abbreviatedText.Index;
                }

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

                if (fullTextLength != 0)
                {
                    fullText = new MultipleString();
                    fullText.Process(byteData, lastIndex);
                    fullText.LogMessage();

                    lastIndex = fullText.Index;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Rating Region Value message is short"));
            }
        }
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        internal override void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                if (Length != 0)
                {
                    longName = new MultipleString();
                    longName.Process(byteData, lastIndex);
                    lastIndex = longName.Index;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Extended Channel Name Descriptor message is short"));
            }
        }
예제 #14
0
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The mpeg2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the mpeg2 section following the descriptor length.</param>
        /// <param name="region">The region being processed.</param>
        internal void Process(byte[] byteData, int index, int region)
        {
            lastIndex = index;
            this.region = region;

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

            if (nameLength != 0)
            {
                name = new MultipleString();
                name.Process(byteData, lastIndex);
                name.LogMessage();

                lastIndex = name.Index;
            }

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

            if (dimensionCount != 0)
            {
                dimensions = new Collection<RatingRegionDimension>();

                while (dimensionCount != 0)
                {
                    RatingRegionDimension dimension = new RatingRegionDimension();
                    dimension.Process(byteData, lastIndex);

                    dimensions.Add(dimension);

                    lastIndex = dimension.Index;
                    dimensionCount--;
                }
            }

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