コード例 #1
0
        private void setSeriesEpisode(EPGEntry epgEntry, FreeSatEntry freeSatEntry)
        {
            if (freeSatEntry.SeriesID == null && freeSatEntry.SeasonID == null && freeSatEntry.EpisodeID == null)
            {
                return;
            }

            if (RunParameters.Instance.Options.Contains("USENUMERICCRID"))
            {
                processCRIDNumeric(epgEntry, freeSatEntry.SeriesID, freeSatEntry.SeasonID, freeSatEntry.EpisodeID);
                return;
            }

            if (RunParameters.Instance.Options.Contains("USEBSEPG"))
            {
                processCRIDBSEPG(epgEntry, freeSatEntry.SeriesID, freeSatEntry.SeasonID, freeSatEntry.EpisodeID);
                return;
            }
        }
コード例 #2
0
ファイル: FreeSatSection.cs プロジェクト: esurharun/TSDumper
        private void setSeriesEpisode(EPGEntry epgEntry, FreeSatEntry freeSatEntry)
        {
            if (freeSatEntry.SeriesID == null && freeSatEntry.SeasonID == null && freeSatEntry.EpisodeID == null)
                return;

            if (RunParameters.Instance.Options.Contains("USENUMERICCRID"))
            {
                processCRIDNumeric(epgEntry, freeSatEntry.SeriesID, freeSatEntry.SeasonID, freeSatEntry.EpisodeID);
                return;
            }

            if (RunParameters.Instance.Options.Contains("USEBSEPG"))
            {
                processCRIDBSEPG(epgEntry, freeSatEntry.SeriesID, freeSatEntry.SeasonID, freeSatEntry.EpisodeID);
                return;
            }
        }
コード例 #3
0
ファイル: FreeSatSection.cs プロジェクト: esurharun/TSDumper
        /// <summary>
        /// Parse the section.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the section.</param>
        /// <param name="mpeg2Header">The MPEG2 header that preceedes the section.</param>
        public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header)
        {
            lastIndex = mpeg2Header.Index;
            serviceID = mpeg2Header.TableIDExtension;

            try
            {
                transportStreamID = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex += 2;

                originalNetworkID = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex += 2;

                segmentLastSectionNumber = (int)byteData[lastIndex];
                lastIndex++;

                lastTableID = (int)byteData[lastIndex];
                lastIndex++;
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The FreeSat EIT section is short"));
            }

            TVStation tvStation = TVStation.FindStation(originalNetworkID, transportStreamID, serviceID);
            if (tvStation == null)
                return;

            bool newSection = tvStation.AddMapEntry(mpeg2Header.TableID, mpeg2Header.SectionNumber, lastTableID, mpeg2Header.LastSectionNumber, segmentLastSectionNumber);
            if (!newSection)
                return;

            while (lastIndex < byteData.Length - 4)
            {
                FreeSatEntry freeSatEntry = new FreeSatEntry();
                freeSatEntry.Process(byteData, lastIndex);

                EPGEntry epgEntry = new EPGEntry();
                epgEntry.OriginalNetworkID = tvStation.OriginalNetworkID;
                epgEntry.TransportStreamID = tvStation.TransportStreamID;
                epgEntry.ServiceID = tvStation.ServiceID;
                epgEntry.EPGSource = EPGSource.FreeSat;

                switch (freeSatEntry.ComponentTypeAudio)
                {
                    case 3:
                        epgEntry.AudioQuality = "stereo";
                        break;
                    case 5:
                        epgEntry.AudioQuality = "dolby digital";
                        break;
                    default:
                        break;
                }

                if (freeSatEntry.ComponentTypeVideo > 9)
                    epgEntry.VideoQuality = "HDTV";

                epgEntry.Duration = Utils.RoundTime(freeSatEntry.Duration);
                epgEntry.EventID = freeSatEntry.EventID;
                epgEntry.EventName = freeSatEntry.EventName;

                if (freeSatEntry.ParentalRating > 11)
                    epgEntry.ParentalRating = "AO";
                else
                {
                    if (freeSatEntry.ParentalRating > 8)
                        epgEntry.ParentalRating = "PGR";
                    else
                        epgEntry.ParentalRating = "G";
                }

                setSeriesEpisode(epgEntry, freeSatEntry);

                epgEntry.RunningStatus = freeSatEntry.RunningStatus;
                epgEntry.Scrambled = freeSatEntry.Scrambled;
                epgEntry.ShortDescription = freeSatEntry.ShortDescription;
                epgEntry.StartTime = Utils.RoundTime(TimeOffsetEntry.GetOffsetTime(freeSatEntry.StartTime));

                epgEntry.EventCategory = getEventCategory(epgEntry.EventName, epgEntry.ShortDescription, freeSatEntry.ContentType, freeSatEntry.ContentSubType);

                tvStation.AddEPGEntry(epgEntry);

                if (titleLogger != null)
                    logTitle(freeSatEntry.EventName, epgEntry, titleLogger);
                if (descriptionLogger != null)
                    logDescription(freeSatEntry.ShortDescription, epgEntry, descriptionLogger);

                lastIndex = freeSatEntry.Index;
            }
        }
コード例 #4
0
        /// <summary>
        /// Parse the section.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the section.</param>
        /// <param name="mpeg2Header">The MPEG2 header that preceedes the section.</param>
        public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header)
        {
            lastIndex = mpeg2Header.Index;
            serviceID = mpeg2Header.TableIDExtension;

            try
            {
                transportStreamID = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex        += 2;

                originalNetworkID = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex        += 2;

                segmentLastSectionNumber = (int)byteData[lastIndex];
                lastIndex++;

                lastTableID = (int)byteData[lastIndex];
                lastIndex++;
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The FreeSat EIT section is short"));
            }

            TVStation tvStation = TVStation.FindStation(originalNetworkID, transportStreamID, serviceID);

            if (tvStation == null)
            {
                return;
            }

            bool newSection = tvStation.AddMapEntry(mpeg2Header.TableID, mpeg2Header.SectionNumber, lastTableID, mpeg2Header.LastSectionNumber, segmentLastSectionNumber);

            if (!newSection)
            {
                return;
            }

            while (lastIndex < byteData.Length - 4)
            {
                FreeSatEntry freeSatEntry = new FreeSatEntry();
                freeSatEntry.Process(byteData, lastIndex);

                EPGEntry epgEntry = new EPGEntry();
                epgEntry.OriginalNetworkID = tvStation.OriginalNetworkID;
                epgEntry.TransportStreamID = tvStation.TransportStreamID;
                epgEntry.ServiceID         = tvStation.ServiceID;
                epgEntry.EPGSource         = EPGSource.FreeSat;

                switch (freeSatEntry.ComponentTypeAudio)
                {
                case 3:
                    epgEntry.AudioQuality = "stereo";
                    break;

                case 5:
                    epgEntry.AudioQuality = "dolby digital";
                    break;

                default:
                    break;
                }

                if (freeSatEntry.ComponentTypeVideo > 9)
                {
                    epgEntry.VideoQuality = "HDTV";
                }

                epgEntry.Duration  = Utils.RoundTime(freeSatEntry.Duration);
                epgEntry.EventID   = freeSatEntry.EventID;
                epgEntry.EventName = freeSatEntry.EventName;

                if (freeSatEntry.ParentalRating > 11)
                {
                    epgEntry.ParentalRating = "AO";
                }
                else
                {
                    if (freeSatEntry.ParentalRating > 8)
                    {
                        epgEntry.ParentalRating = "PGR";
                    }
                    else
                    {
                        epgEntry.ParentalRating = "G";
                    }
                }

                setSeriesEpisode(epgEntry, freeSatEntry);

                epgEntry.RunningStatus    = freeSatEntry.RunningStatus;
                epgEntry.Scrambled        = freeSatEntry.Scrambled;
                epgEntry.ShortDescription = freeSatEntry.ShortDescription;
                epgEntry.StartTime        = Utils.RoundTime(TimeOffsetEntry.GetOffsetTime(freeSatEntry.StartTime));

                epgEntry.EventCategory = getEventCategory(epgEntry.EventName, epgEntry.ShortDescription, freeSatEntry.ContentType, freeSatEntry.ContentSubType);

                tvStation.AddEPGEntry(epgEntry);

                if (titleLogger != null)
                {
                    logTitle(freeSatEntry.EventName, epgEntry, titleLogger);
                }
                if (descriptionLogger != null)
                {
                    logDescription(freeSatEntry.ShortDescription, epgEntry, descriptionLogger);
                }

                lastIndex = freeSatEntry.Index;
            }
        }