Example #1
0
        /// <summary>
        /// Add an entry to the EIT map table.
        /// </summary>
        /// <remarks>
        /// All parameters are extracted from the DVB protocol that delivers the EIT section.
        /// </remarks>
        /// <param name="tableID">The table ID of the new entry.</param>
        /// <param name="sectionNumber">The section number of the new entry.</param>
        /// <param name="lastTableID">The last table ID of the new entry.</param>
        /// <param name="lastSectionNumber">The last section number of the new entry.</param>
        /// <param name="segmentLastSectionNumber">The last section number of the segment for the new entry.</param>
        /// <returns></returns>
        public bool AddMapEntry(int tableID, int sectionNumber, int lastTableID, int lastSectionNumber, int segmentLastSectionNumber)
        {
            SectionMapEntry newEntry = new SectionMapEntry(tableID, sectionNumber, lastTableID, lastSectionNumber, segmentLastSectionNumber);

            foreach (SectionMapEntry oldEntry in SectionMap)
            {
                if (oldEntry.TableID == newEntry.TableID && oldEntry.SectionNumber == newEntry.SectionNumber)
                {
                    return(false);
                }

                if (oldEntry.TableID == newEntry.TableID)
                {
                    if (oldEntry.SectionNumber > newEntry.SectionNumber)
                    {
                        sectionMap.Insert(sectionMap.IndexOf(oldEntry), newEntry);
                        return(true);
                    }
                }
                else
                {
                    if (oldEntry.TableID > newEntry.TableID)
                    {
                        sectionMap.Insert(sectionMap.IndexOf(oldEntry), newEntry);
                        return(true);
                    }
                }
            }

            sectionMap.Add(newEntry);

            return(true);
        }
Example #2
0
        /// <summary>
        /// Add an entry to the EIT map table.
        /// </summary>
        /// <remarks>
        /// All parameters are extracted from the DVB protocol that delivers the EIT section.
        /// </remarks>
        /// <param name="tableID">The table ID of the new entry.</param>
        /// <param name="sectionNumber">The section number of the new entry.</param>
        /// <param name="lastTableID">The last table ID of the new entry.</param>
        /// <param name="lastSectionNumber">The last section number of the new entry.</param>
        /// <param name="segmentLastSectionNumber">The last section number of the segment for the new entry.</param>
        /// <returns></returns>
        public bool AddMapEntry(int tableID, int sectionNumber, int lastTableID, int lastSectionNumber, int segmentLastSectionNumber)
        {
            SectionMapEntry newEntry = new SectionMapEntry(tableID, sectionNumber, lastTableID, lastSectionNumber, segmentLastSectionNumber);

            foreach (SectionMapEntry oldEntry in SectionMap)
            {
                if (oldEntry.TableID == newEntry.TableID && oldEntry.SectionNumber == newEntry.SectionNumber)
                    return (false);

                if (oldEntry.TableID == newEntry.TableID)
                {
                    if (oldEntry.SectionNumber > newEntry.SectionNumber)
                    {
                        sectionMap.Insert(sectionMap.IndexOf(oldEntry), newEntry);
                        return (true);
                    }
                }
                else
                {
                    if (oldEntry.TableID > newEntry.TableID)
                    {
                        sectionMap.Insert(sectionMap.IndexOf(oldEntry), newEntry);
                        return(true);
                    }
                }
            }

            sectionMap.Add(newEntry);

            return (true);
        }