/// <summary>
 /// Erzeugt eine neue Information für eine Tonspur.
 /// </summary>
 /// <param name="entry">Informationen zur Tonspur.</param>
 /// <param name="ac3">Gesetzt, wenn es sich um eine AC3 Tonspur handelt.</param>
 /// <param name="index">Laufender Index dieser Tonspur.</param>
 public AudioItem( ProgramEntry entry, bool ac3, int index )
 {
     // Remember
     Name = string.Format( "{0}{2} [{1}]", entry.ProgrammeName.Trim(), 1 + index, ac3 ? " (AC3)" : string.Empty );
     PID = entry.ElementaryPID;
     AC3 = ac3;
 }
Пример #2
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;
                }
            }
        }