private void processProgramAssociationSection(ProgramAssociationSection programAssociationSection, Collection <TVStation> tvStations) { foreach (ProgramInfo programInfo in programAssociationSection.ProgramInfos) { if (programInfo.ProgramNumber != 0) { processProgramInfo(programInfo, tvStations); } } }
private void processPATSections(Collection <TVStation> tvStations) { dataProvider.ChangePidMapping(new int[] { BDAGraph.PatPid }); TSReaderBase patReader = new TSStreamReader(BDAGraph.PatTable, 2000, dataProvider.BufferAddress); patReader.Run(); Thread.Sleep(2000); Collection <Mpeg2Section> sections = new Collection <Mpeg2Section>(); patReader.Lock("ProcessPATSections"); if (patReader.Sections.Count != 0) { foreach (Mpeg2Section section in patReader.Sections) { sections.Add(section); } patReader.Sections.Clear(); } patReader.Release("ProcessPATSections"); patReader.Stop(); Collection <int> sectionNumbers = new Collection <int>(); if (sections == null) { Logger.Instance.Write("No PAT sections received"); return; } else { foreach (Mpeg2Section section in sections) { ProgramAssociationSection programAssociationSection = ProgramAssociationSection.ProcessProgramAssociationTable(section.Data); if (programAssociationSection != null) { if (!sectionNumbers.Contains(programAssociationSection.SectionNumber)) { processProgramAssociationSection(programAssociationSection, tvStations); sectionNumbers.Add(programAssociationSection.SectionNumber); } } } } }
/// <summary> /// Process an MPEG2 section from the program association table. /// </summary> /// <param name="byteData">The MPEG2 section.</param> /// <returns>A ProgramAssociationSection instance.</returns> public static ProgramAssociationSection ProcessProgramAssociationTable(byte[] byteData) { Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader(); try { mpeg2Header.Process(byteData); if (mpeg2Header.Current) { int lastIndex = mpeg2Header.Index; ProgramAssociationSection programAssociationSection = new ProgramAssociationSection(); programAssociationSection.Process(byteData, mpeg2Header); return(programAssociationSection); } } catch (ArgumentOutOfRangeException e) { Logger.Instance.Write("<e> Error processing Program Association Section message: " + e.Message); } return(null); }
private void processProgramAssociationSection(ProgramAssociationSection programAssociationSection, Collection<TVStation> tvStations) { foreach (ProgramInfo programInfo in programAssociationSection.ProgramInfos) { if (programInfo.ProgramNumber != 0) processProgramInfo(programInfo, tvStations); } }
/// <summary> /// Process an MPEG2 section from the program association table. /// </summary> /// <param name="byteData">The MPEG2 section.</param> /// <returns>A ProgramAssociationSection instance.</returns> public static ProgramAssociationSection ProcessProgramAssociationTable(byte[] byteData) { Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader(); try { mpeg2Header.Process(byteData); if (mpeg2Header.Current) { int lastIndex = mpeg2Header.Index; ProgramAssociationSection programAssociationSection = new ProgramAssociationSection(); programAssociationSection.Process(byteData, mpeg2Header); return (programAssociationSection); } } catch (ArgumentOutOfRangeException e) { Logger.Instance.Write("<e> Error processing Program Association Section message: " + e.Message); } return (null); }