/// <summary>
        /// Process an MPEG2 section from the time offset table.
        /// </summary>
        /// <param name="byteData">The MPEG2 section.</param>
        /// <returns>A TimeOffsetSection instance.</returns>
        public static TimeOffsetSection ProcessTimeOffsetTable(byte[] byteData)
        {
            Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader();

            try
            {
                mpeg2Header.Process(byteData);

                TimeOffsetSection timeOffsetSection = new TimeOffsetSection();
                timeOffsetSection.Process(byteData, mpeg2Header);
                return(timeOffsetSection);
            }
            catch (ArgumentOutOfRangeException e)
            {
                Logger.Instance.Write("<e> Error processing Time Offset Section message: " + e.Message);
            }

            return(null);
        }
示例#2
0
        /// <summary>
        /// Process an MPEG2 section from the time offset table.
        /// </summary>
        /// <param name="byteData">The MPEG2 section.</param>
        /// <returns>A TimeOffsetSection instance.</returns>
        public static TimeOffsetSection ProcessTimeOffsetTable(byte[] byteData)
        {
            Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader();

            try
            {
                mpeg2Header.Process(byteData);

                TimeOffsetSection timeOffsetSection = new TimeOffsetSection();
                timeOffsetSection.Process(byteData, mpeg2Header);
                return (timeOffsetSection);
            }
            catch (ArgumentOutOfRangeException e)
            {
                Logger.Instance.Write("<e> Error processing Time Offset Section message: " + e.Message);
            }

            return (null);
        }
示例#3
0
        private void processTimeOffsetSections(Collection <Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                TimeOffsetSection timeOffsetSection = TimeOffsetSection.ProcessTimeOffsetTable(section.Data);
                if (timeOffsetSection != null)
                {
                    if (timeOffsetSection.Descriptors != null)
                    {
                        foreach (DescriptorBase descriptor in timeOffsetSection.Descriptors)
                        {
                            DVBLocalTimeOffsetDescriptor timeOffsetDescriptor = descriptor as DVBLocalTimeOffsetDescriptor;
                            if (timeOffsetDescriptor != null)
                            {
                                foreach (DVBLocalTimeOffsetEntry entry in timeOffsetDescriptor.TimeOffsetEntries)
                                {
                                    TimeOffsetEntry offsetEntry = new TimeOffsetEntry();
                                    offsetEntry.CountryCode = entry.CountryCode;
                                    offsetEntry.Region      = entry.Region;

                                    if (entry.OffsetPositive)
                                    {
                                        offsetEntry.TimeOffset     = entry.TimeOffset;
                                        offsetEntry.NextTimeOffset = entry.NextTimeOffset;
                                    }
                                    else
                                    {
                                        offsetEntry.TimeOffset     = new TimeSpan() - entry.TimeOffset;
                                        offsetEntry.NextTimeOffset = new TimeSpan() - entry.NextTimeOffset;
                                    }

                                    offsetEntry.ChangeTime = entry.ChangeTime;

                                    TimeOffsetEntry.AddEntry(offsetEntry);
                                }
                            }
                        }
                    }
                }
            }
        }