private void processTitleSections(Collection <Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.TraceIDs.Contains("DUMPTITLESECTIONS"))
                {
                    Logger.Instance.Dump("Title Section", section.Data, section.Length);
                }

                MediaHighway1TitleSection titleSection = MediaHighway1TitleSection.ProcessMediaHighwayTitleTable(section.Data);
                if (titleSection != null && titleSection.TitleData != null)
                {
                    MediaHighwayChannel channel = (MediaHighwayChannel)MediaHighwayChannel.FindChannel(titleSection.TitleData.ChannelID);
                    if (channel != null)
                    {
                        MediaHighwayTitle title = new MediaHighwayTitle();
                        title.CategoryID       = titleSection.TitleData.CategoryID;
                        title.Duration         = titleSection.TitleData.Duration;
                        title.EventID          = titleSection.TitleData.EventID;
                        title.EventName        = titleSection.TitleData.EventName;
                        title.StartTime        = titleSection.TitleData.StartTime;
                        title.SummaryAvailable = titleSection.TitleData.SummaryAvailable;
                        title.Day          = titleSection.TitleData.Day;
                        title.Hours        = titleSection.TitleData.Hours;
                        title.Minutes      = titleSection.TitleData.Minutes;
                        title.LogDay       = titleSection.TitleData.LogDay;
                        title.LogHours     = titleSection.TitleData.LogHours;
                        title.LogYesterday = titleSection.TitleData.LogYesterday;
                        channel.AddTitleData(title);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Process an MPEG2 section from the MediaHighway title table.
        /// </summary>
        /// <param name="byteData">The MPEG2 section.</param>
        /// <returns>A MediaHighway1TitleSection instance.</returns>
        public static MediaHighway1TitleSection ProcessMediaHighwayTitleTable(byte[] byteData)
        {
            Mpeg2BasicHeader mpeg2Header = new Mpeg2BasicHeader();

            try
            {
                mpeg2Header.Process(byteData);

                MediaHighway1TitleSection titleSection = new MediaHighway1TitleSection();
                titleSection.Process(byteData, mpeg2Header.Index);
                if (!titleSection.TitleData.IsEmpty)
                {
                    titleSection.LogMessage();
                    return(titleSection);
                }
                else
                {
                    return(null);
                }
            }
            catch (ArgumentOutOfRangeException e)
            {
                Logger.Instance.Write("<e> Title section parsing failed: " + e.Message);
                return(null);
            }
        }
        /// <summary>
        /// Process an MPEG2 section from the MediaHighway title table.
        /// </summary>
        /// <param name="byteData">The MPEG2 section.</param>
        /// <returns>A MediaHighway1TitleSection instance.</returns>
        public static MediaHighway1TitleSection ProcessMediaHighwayTitleTable(byte[] byteData)
        {
            Mpeg2BasicHeader mpeg2Header = new Mpeg2BasicHeader();

            try
            {
                mpeg2Header.Process(byteData);

                MediaHighway1TitleSection titleSection = new MediaHighway1TitleSection();
                titleSection.Process(byteData, mpeg2Header.Index);
                if (!titleSection.TitleData.IsEmpty)
                {
                    titleSection.LogMessage();
                    return (titleSection);
                }
                else
                    return (null);
            }
            catch (ArgumentOutOfRangeException e)
            {
                Logger.Instance.Write("<e> Title section parsing failed: " + e.Message);
                return (null);
            }
        }