/// <summary>
        /// Erzeugt eine exakte Kopie dieser Information.
        /// </summary>
        /// <returns>Die gewünschte Kopie.</returns>
        public SubtitleInformation Clone()
        {
            // Create empty
            SubtitleInformation clone = new SubtitleInformation();

            // Fill
            clone.CompositionPage = CompositionPage;
            clone.SubtitleStream = SubtitleStream;
            clone.AncillaryPage = AncillaryPage;
            clone.SubtitleType = SubtitleType;
            clone.Language = Language;

            // Report
            return clone;
        }
        /// <summary>
        /// Erzeugt eine exakte Kopie dieser Information.
        /// </summary>
        /// <returns>Die gewünschte Kopie.</returns>
        public SubtitleInformation Clone()
        {
            // Create empty
            SubtitleInformation clone = new SubtitleInformation();

            // Fill
            clone.CompositionPage = CompositionPage;
            clone.SubtitleStream  = SubtitleStream;
            clone.AncillaryPage   = AncillaryPage;
            clone.SubtitleType    = SubtitleType;
            clone.Language        = Language;

            // Report
            return(clone);
        }
        /// <summary>
        /// Ergänzt die Informationen zu einer DVB Untertitelspur.
        /// </summary>
        /// <param name="subtitle">Die Untertitelspur.</param>
        /// <param name="subtitles">Alle bisher aufgenommenen Spuren.</param>
        private void AddSubtitleInformation(SubtitleInformation subtitle, Dictionary <ushort, List <EPG.SubtitleInfo> > subtitles)
        {
            // Attach to the list
            List <EPG.SubtitleInfo> list;

            if (!subtitles.TryGetValue(subtitle.SubtitleStream, out list))
            {
                // Create new
                list = new List <EPG.SubtitleInfo>();

                // Remember it
                subtitles[subtitle.SubtitleStream] = list;
            }

            // Register
            list.Add(
                new EPG.SubtitleInfo
                (
                    subtitle.Language.ToISOLanguage(),
                    (EPG.SubtitleTypes)subtitle.SubtitleType,
                    subtitle.CompositionPage,
                    subtitle.AncillaryPage
                ));
        }
        /// <summary>
        /// Ergänzt die Informationen zu einer DVB Untertitelspur.
        /// </summary>
        /// <param name="subtitle">Die Untertitelspur.</param>
        /// <param name="subtitles">Alle bisher aufgenommenen Spuren.</param>
        private void AddSubtitleInformation( SubtitleInformation subtitle, Dictionary<ushort, List<EPG.SubtitleInfo>> subtitles )
        {
            // Attach to the list
            List<EPG.SubtitleInfo> list;
            if (!subtitles.TryGetValue( subtitle.SubtitleStream, out list ))
            {
                // Create new
                list = new List<EPG.SubtitleInfo>();

                // Remember it
                subtitles[subtitle.SubtitleStream] = list;
            }

            // Register
            list.Add(
                new EPG.SubtitleInfo
                    (
                        subtitle.Language.ToISOLanguage(),
                        (EPG.SubtitleTypes) subtitle.SubtitleType,
                        subtitle.CompositionPage,
                        subtitle.AncillaryPage
                    ) );
        }
Пример #5
0
        /// <summary>
        /// Übernimmt Informationen aus einer SI Programmbeschreibung in die Informationen
        /// eines Senders.
        /// </summary>
        /// <param name="source">Die Daten zu einer Quelle, die vervollständigt werden sollen.</param>
        /// <param name="program">Die SI Programmbeschreibung.</param>
        public static void Update(this SourceInformation source, EPG.ProgramEntry program)
        {
            // MPEG-2 Video
            if (EPG.StreamTypes.Video13818 == program.StreamType)
            {
                // Remember
                source.VideoType   = VideoTypes.MPEG2;
                source.VideoStream = program.ElementaryPID;

                // Done
                return;
            }

            // H.264 Video
            if (EPG.StreamTypes.H264 == program.StreamType)
            {
                // Remember
                source.VideoType   = VideoTypes.H264;
                source.VideoStream = program.ElementaryPID;

                // Done
                return;
            }

            // MP2 Audio
            if ((EPG.StreamTypes.Audio11172 == program.StreamType) || (EPG.StreamTypes.Audio13818 == program.StreamType))
            {
                // Create new entry
                AudioInformation audio = new AudioInformation {
                    AudioType = AudioTypes.MP2, AudioStream = program.ElementaryPID, Language = program.ProgrammeName.Trim()
                };

                // Remember it
                source.AudioTracks.Add(audio);

                // Done
                return;
            }

            // AC3, TTX or DVB subtitles
            if (EPG.StreamTypes.PrivateData != program.StreamType)
            {
                return;
            }

            // Direct processing of descriptor list
            foreach (var descriptor in program.Descriptors)
            {
                // Check for AC3
                var ac3 = descriptor as EPG.Descriptors.AC3;
                if (null != ac3)
                {
                    // Create new entry
                    AudioInformation audio = new AudioInformation {
                        AudioType = AudioTypes.AC3, AudioStream = program.ElementaryPID, Language = program.ProgrammeName.Trim()
                    };

                    // Remember it
                    source.AudioTracks.Add(audio);

                    // Done
                    return;
                }

                // Check for videotext
                var ttx = descriptor as EPG.Descriptors.Teletext;
                if (null != ttx)
                {
                    // Remember
                    source.TextStream = program.ElementaryPID;

                    // Done
                    return;
                }

                // Check for DVB sub-titles
                var sub = descriptor as EPG.Descriptors.Subtitle;
                if (null != sub)
                {
                    // Process all items
                    foreach (var subTitle in sub.Subtitles)
                    {
                        // Create the information
                        var info = new SubtitleInformation
                        {
                            SubtitleStream  = program.ElementaryPID,
                            Language        = subTitle.Language,
                            SubtitleType    = (SubtitleTypes)subTitle.Type,
                            CompositionPage = subTitle.CompositionPage,
                            AncillaryPage   = subTitle.AncillaryPage
                        };

                        // Remember
                        source.Subtitles.Add(info);
                    }

                    // Done
                    return;
                }
            }
        }