예제 #1
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 override void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                int serviceCount = byteData[lastIndex] & 0x1f;
                lastIndex++;

                if (serviceCount != 0)
                {
                    services = new Collection <CaptionServiceDescriptorEntry>();

                    while (serviceCount != 0)
                    {
                        CaptionServiceDescriptorEntry service = new CaptionServiceDescriptorEntry();
                        service.Process(byteData, lastIndex);
                        services.Add(service);

                        lastIndex = service.Index;
                        serviceCount--;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Caption Service Descriptor 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
            {
                int serviceCount = byteData[lastIndex] & 0x1f;
                lastIndex++;

                if (serviceCount != 0)
                {
                    services = new Collection<CaptionServiceDescriptorEntry>();

                    while (serviceCount != 0)
                    {
                        CaptionServiceDescriptorEntry service = new CaptionServiceDescriptorEntry();
                        service.Process(byteData, lastIndex);
                        services.Add(service);

                        lastIndex = service.Index;
                        serviceCount--;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Caption Service Descriptor message is short"));
            }
        }