예제 #1
0
        /// <summary>
        /// Process an MPEG2 section from the Open TV Title table.
        /// </summary>
        /// <param name="byteData">The MPEG2 section.</param>
        /// <param name="pid">The PID containing the section.</param>
        /// <param name="table">The table ID containing the section.</param>
        /// <returns>An Open TV Title Section instance or null if a section is not created.</returns>
        public static OpenTVTitleSection ProcessOpenTVTitleTable(byte[] byteData, int pid, int table)
        {
            Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader();

            try
            {
                mpeg2Header.Process(byteData);

                if (mpeg2Header.Current)
                {
                    OpenTVTitleSection openTVTitleSection = new OpenTVTitleSection();
                    openTVTitleSection.Process(byteData, mpeg2Header, pid, table);
                    openTVTitleSection.LogMessage();
                    return(openTVTitleSection);
                }
                else
                {
                    return(null);
                }
            }
            catch (ArgumentOutOfRangeException e)
            {
                Logger.Instance.Write("<e> Error processing Title Section: " + e.Message);

                if (RunParameters.Instance.DebugIDs.Contains("TITLESECTION"))
                {
                    Logger.Instance.Write(e.Message);
                    Logger.Instance.Write(e.StackTrace);
                    Logger.Instance.Dump("Title Section", byteData, byteData.Length);
                }

                return(null);
            }
        }
예제 #2
0
        private void processTitleSections(Collection <Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                /*Logger.Instance.Dump("Title Section", section.Data, section.Length);*/

                OpenTVTitleSection titleSection = OpenTVTitleSection.ProcessOpenTVTitleTable(section.Data, section.PID, section.Table);
                if (titleSection != null)
                {
                    if (titleSection.TitleHeader.TitleData != null)
                    {
                        OpenTVChannel channel = (OpenTVChannel)Channel.FindChannel(titleSection.TitleHeader.ChannelID);
                        if (channel != null)
                        {
                            foreach (OpenTVTitleData titleData in titleSection.TitleHeader.TitleData)
                            {
                                channel.AddTitleData(titleData);
                            }
                        }
                    }

                    titleSection.LogMessage();
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Process an MPEG2 section from the Open TV Title table.
        /// </summary>
        /// <param name="byteData">The MPEG2 section.</param>
        /// <param name="pid">The PID containing the section.</param>
        /// <param name="table">The table ID containing the section.</param>
        /// <returns>An Open TV Title Section instance or null if a section is not created.</returns>
        public static OpenTVTitleSection ProcessOpenTVTitleTable(byte[] byteData, int pid, int table)
        {
            Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader();

            try
            {
                mpeg2Header.Process(byteData);

                if (mpeg2Header.Current)
                {
                    OpenTVTitleSection openTVTitleSection = new OpenTVTitleSection();
                    openTVTitleSection.Process(byteData, mpeg2Header, pid, table);
                    openTVTitleSection.LogMessage();
                    return (openTVTitleSection);
                }
                else
                    return (null);
            }
            catch (ArgumentOutOfRangeException e)
            {
                Logger.Instance.Write("<e> Error processing Title Section: " + e.Message);

                if (RunParameters.Instance.DebugIDs.Contains("TITLESECTION"))
                {
                    Logger.Instance.Write(e.Message);
                    Logger.Instance.Write(e.StackTrace);
                    Logger.Instance.Dump("Title Section", byteData, byteData.Length);
                }

                return (null);
            }
        }