Exemplo n.º 1
0
        /// <summary>
        /// Process an MPEG2 section from the Open TV Summary table.
        /// </summary>
        /// <param name="byteData">The MPEG2 section.</param>
        /// <returns>An Open TV Summary Section instance.</returns>
        public static OpenTVSummarySection ProcessOpenTVSummaryTable(byte[] byteData)
        {
            Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader();

            try
            {
                mpeg2Header.Process(byteData);

                if (mpeg2Header.Current)
                {
                    OpenTVSummarySection openTVSummarySection = new OpenTVSummarySection();
                    openTVSummarySection.Process(byteData, mpeg2Header);
                    openTVSummarySection.LogMessage();
                    return(openTVSummarySection);
                }
                else
                {
                    return(null);
                }
            }
            catch (ArgumentOutOfRangeException e)
            {
                Logger.Instance.Write("<e> Error processing Summary Section: " + e.Message);
                return(null);
            }
        }
Exemplo n.º 2
0
        private void processSummarySections(Collection <Mpeg2Section> sections)
        {
            OpenTVSummarySection.OpenTVSummarySections.Clear();

            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.DebugIDs.Contains("DUMPOPENTVSUMMARYSECTIONS"))
                {
                    Logger.Instance.Dump("Summary Section", section.Data, section.Length);
                }

                OpenTVSummarySection summarySection = OpenTVSummarySection.ProcessOpenTVSummaryTable(section.Data);
                if (summarySection != null)
                {
                    if (summarySection.SummaryHeader.SummaryData != null)
                    {
                        OpenTVChannel channel = (OpenTVChannel)Channel.FindChannel(summarySection.SummaryHeader.ChannelID);
                        if (channel != null)
                        {
                            foreach (OpenTVSummaryData summaryData in summarySection.SummaryHeader.SummaryData)
                            {
                                channel.AddSummaryData(summaryData);
                            }
                        }
                    }

                    /*OpenTVSummarySection.AddSection(summarySection);*/
                    /*summarySection.LogMessage();*/
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add a section to the collection.
        /// </summary>
        /// <param name="newSection">The section to be added.</param>
        public static void AddSection(OpenTVSummarySection newSection)
        {
            /*foreach (OpenTVSummarySection oldSection in OpenTVSummarySections)
             * {
             *  if (oldSection.sectionNumber == newSection.sectionNumber)
             *      return;
             *
             *  if (oldSection.SectionNumber > newSection.SectionNumber)
             *  {
             *      OpenTVSummarySections.Insert(OpenTVSummarySections.IndexOf(oldSection), newSection);
             *      return;
             *  }
             * }*/

            OpenTVSummarySections.Add(newSection);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Process an MPEG2 section from the Open TV Summary table.
        /// </summary>
        /// <param name="byteData">The MPEG2 section.</param>
        /// <returns>An Open TV Summary Section instance.</returns>
        public static OpenTVSummarySection ProcessOpenTVSummaryTable(byte[] byteData)
        {
            Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader();

            try
            {
                mpeg2Header.Process(byteData);

                if (mpeg2Header.Current)
                {
                    OpenTVSummarySection openTVSummarySection = new OpenTVSummarySection();
                    openTVSummarySection.Process(byteData, mpeg2Header);
                    openTVSummarySection.LogMessage();
                    return (openTVSummarySection);
                }
                else
                    return (null);
            }
            catch (ArgumentOutOfRangeException e)
            {
                Logger.Instance.Write("<e> Error processing Summary Section: " + e.Message);
                return (null);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Add a section to the collection.
        /// </summary>
        /// <param name="newSection">The section to be added.</param>
        public static void AddSection(OpenTVSummarySection newSection)
        {
            /*foreach (OpenTVSummarySection oldSection in OpenTVSummarySections)
            {
                if (oldSection.sectionNumber == newSection.sectionNumber)
                    return;

                if (oldSection.SectionNumber > newSection.SectionNumber)
                {
                    OpenTVSummarySections.Insert(OpenTVSummarySections.IndexOf(oldSection), newSection);
                    return;
                }
            }*/

            OpenTVSummarySections.Add(newSection);
        }