Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        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;
            }
        }