private void processProgramMapSection(ProgramMapSection programMapSection, ProgramInfo programInfo, Collection <TVStation> tvStations) { TVStation tvStation = findTVStation(programInfo.ProgramNumber, tvStations); if (tvStation == null) { return; } foreach (StreamInfo streamInfo in programMapSection.StreamInfos) { if (streamInfo.StreamType == streamTypeVideo) { tvStation.VideoPID = streamInfo.ProgramID; } if (streamInfo.StreamType == streamTypeAudio) { tvStation.AudioPID = streamInfo.ProgramID; } if (streamInfo.StreamType == streamTypeDSMCCUserToNetwork) { tvStation.DSMCCPID = streamInfo.ProgramID; } } }
private void processProgramInfo(ProgramInfo programInfo, Collection <TVStation> tvStations) { dataProvider.ChangePidMapping(new int[] { programInfo.ProgramID }); TSReaderBase pmtReader = new TSStreamReader(BDAGraph.PmtTable, 2000, dataProvider.BufferAddress); pmtReader.Run(); Collection <Mpeg2Section> sections = new Collection <Mpeg2Section>(); int repeats = 0; bool done = false; while (!done) { Thread.Sleep(10); pmtReader.Lock("ProcessPMTSections"); if (pmtReader.Sections.Count != 0) { foreach (Mpeg2Section section in pmtReader.Sections) { sections.Add(section); } pmtReader.Sections.Clear(); } pmtReader.Release("ProcessPMTSections"); done = (sections.Count != 0); if (!done) { repeats++; done = (repeats == 500); } } pmtReader.Stop(); if (sections.Count == 0) { Logger.Instance.Write("No PMT sections received"); return; } else { foreach (Mpeg2Section section in sections) { ProgramMapSection programMapSection = ProgramMapSection.ProcessProgramMapTable(section.Data); processProgramMapSection(programMapSection, programInfo, tvStations); } } }
/// <summary> /// Process an MPEG2 section from the program map table. /// </summary> /// <param name="byteData">The MPEG2 section.</param> /// <returns>A ProgramMapSection instance.</returns> public static ProgramMapSection ProcessProgramMapTable(byte[] byteData) { Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader(); try { mpeg2Header.Process(byteData); if (mpeg2Header.Current) { ProgramMapSection programMapSection = new ProgramMapSection(); programMapSection.Process(byteData, mpeg2Header); return(programMapSection); } } catch (ArgumentOutOfRangeException e) { Logger.Instance.Write("<e> Error processing Program Map Section message: " + e.Message); } return(null); }
/// <summary> /// Process an MPEG2 section from the program map table. /// </summary> /// <param name="byteData">The MPEG2 section.</param> /// <returns>A ProgramMapSection instance.</returns> public static ProgramMapSection ProcessProgramMapTable(byte[] byteData) { Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader(); try { mpeg2Header.Process(byteData); if (mpeg2Header.Current) { ProgramMapSection programMapSection = new ProgramMapSection(); programMapSection.Process(byteData, mpeg2Header); return (programMapSection); } } catch (ArgumentOutOfRangeException e) { Logger.Instance.Write("<e> Error processing Program Map Section message: " + e.Message); } return (null); }
private void processProgramMapSection(ProgramMapSection programMapSection, ProgramInfo programInfo, Collection<TVStation> tvStations) { TVStation tvStation = findTVStation(programInfo.ProgramNumber, tvStations); if (tvStation == null) return; foreach (StreamInfo streamInfo in programMapSection.StreamInfos) { if (streamInfo.StreamType == streamTypeVideo) tvStation.VideoPID = streamInfo.ProgramID; if (streamInfo.StreamType == streamTypeAudio) tvStation.AudioPID = streamInfo.ProgramID; if (streamInfo.StreamType == streamTypeDSMCCUserToNetwork) tvStation.DSMCCPID = streamInfo.ProgramID; } }