/// <summary>
        /// Steuerung der Aktivierung der Programmzeitschrift.
        /// </summary>
        /// <param name="device">Das aktuell verwendete DVB.NET Gerät.</param>
        private void CollectProgramGuide( Hardware device )
        {
            // Not necessary
            if (!EPGProgress.HasValue)
                return;

            // Be safe
            try
            {
                // Load interval once
                if (!EPGItemCountCheckInterval.HasValue)
                    try
                    {
                        // Load setting
                        string interval = ConfigurationManager.AppSettings["CardServerProgramGuideCountCheckInterval"];

                        // Load data
                        uint value;
                        if (!string.IsNullOrEmpty( interval ))
                            if (uint.TryParse( interval, out value ))
                                if ((value > 0) && (value < int.MaxValue))
                                    EPGItemCountCheckInterval = (int) value;
                    }
                    finally
                    {
                        // Load default
                        if (!EPGItemCountCheckInterval.HasValue)
                            EPGItemCountCheckInterval = 10;
                    }

                // Time since we last checked the item count
                TimeSpan countDelta = DateTime.UtcNow - m_EPGLastItemCheck;

                // Must recheck
                if (countDelta.TotalSeconds >= EPGItemCountCheckInterval.Value)
                    if (m_EPGLastItemCount == m_EPGItemCount)
                    {
                        // Early stop
                        m_EPGLastTune = DateTime.MinValue;
                    }
                    else
                    {
                        // Remember item count
                        m_EPGLastItemCheck = DateTime.UtcNow;
                        m_EPGLastItemCount = m_EPGItemCount;
                    }

                // Read the interval since the last tune
                TimeSpan delta = DateTime.UtcNow - m_EPGLastTune;

                // Check for change interval
                if (delta.TotalSeconds < 60)
                    return;

                // Always shut down receivers
                device.SelectGroup( null, null );

                // Get the current state
                int total = m_EPGGroups.Count, left = m_EPGPending.Count;

                // Set the progress value
                if (total < 1)
                    EPGProgress = 1;
                else
                    EPGProgress = 1.0 * (total - left) / total;

                // See if we are fully done
                if (left < 1)
                    return;

                // Load next
                GroupKey next = m_EPGPending[0];

                // Remove from list
                m_EPGPending.RemoveAt( 0 );

                // Tune to transponder
                device.SelectGroup( next.Location, next.Group );

                // See if there is something on this group
                if (null == device.GetGroupInformation( 5000 ))
                {
                    // Push back
                    m_EPGPending.Add( next );

                    // Next after a short delay
                    return;
                }

                // Add standard EPG
                device.AddProgramGuideConsumer( OnStandardEPGEvent );

                // Check PREMIERE Direct
                if (0 != (m_EPGExtensions & EPGExtensions.PREMIEREDirect))
                    foreach (SourceSelection selection in Profile.FindSource( DirectCIT.TriggerSource ))
                        if (Equals( selection.Location, device.CurrentLocation ))
                            if (Equals( selection.Group, device.CurrentGroup ))
                            {
                                // Register
                                device.SetConsumerState( device.AddConsumer<DirectCIT>( OnPremiereEPGEvent ), true );

                                // Did it
                                break;
                            }

                // Check PREMIERE Sport
                if (0 != (m_EPGExtensions & EPGExtensions.PREMIERESport))
                    foreach (SourceSelection selection in Profile.FindSource( SportCIT.TriggerSource ))
                        if (Equals( selection.Location, device.CurrentLocation ))
                            if (Equals( selection.Group, device.CurrentGroup ))
                            {
                                // Register
                                device.SetConsumerState( device.AddConsumer<SportCIT>( OnPremiereEPGEvent ), true );

                                // Did it
                                break;
                            }

                // Check FreeSat UK
                if (0 != (m_EPGExtensions & EPGExtensions.FreeSatUK))
                    foreach (SourceSelection selection in Profile.FindSource( EIT.FreeSatEPGTriggerSource ))
                        if (Equals( selection.Location, device.CurrentLocation ))
                            if (Equals( selection.Group, device.CurrentGroup ))
                            {
                                // Register
                                Guid consumerId = device.AddConsumer<EIT>( EIT.FreeSatEPGPID, OnStandardEPGEvent );
                                device.SetConsumerState( consumerId, true );

                                // Did it
                                break;
                            }

                // Reset time
                m_EPGLastTune = DateTime.UtcNow;

                // Remember item count
                m_EPGLastItemCheck = DateTime.UtcNow;
                m_EPGLastItemCount = m_EPGItemCount;
            }
            catch
            {
                // Just go on
            }
        }
예제 #2
0
        /// <summary>
        /// Steuerung der Aktivierung der Programmzeitschrift.
        /// </summary>
        /// <param name="device">Das aktuell verwendete DVB.NET Gerät.</param>
        private void CollectProgramGuide(Hardware device)
        {
            // Not necessary
            if (!EPGProgress.HasValue)
            {
                return;
            }

            // Be safe
            try
            {
                // Load interval once
                if (!EPGItemCountCheckInterval.HasValue)
                {
                    try
                    {
                        // Load setting
                        string interval = ConfigurationManager.AppSettings["CardServerProgramGuideCountCheckInterval"];

                        // Load data
                        uint value;
                        if (!string.IsNullOrEmpty(interval))
                        {
                            if (uint.TryParse(interval, out value))
                            {
                                if ((value > 0) && (value < int.MaxValue))
                                {
                                    EPGItemCountCheckInterval = (int)value;
                                }
                            }
                        }
                    }
                    finally
                    {
                        // Load default
                        if (!EPGItemCountCheckInterval.HasValue)
                        {
                            EPGItemCountCheckInterval = 10;
                        }
                    }
                }

                // Time since we last checked the item count
                TimeSpan countDelta = DateTime.UtcNow - m_EPGLastItemCheck;

                // Must recheck
                if (countDelta.TotalSeconds >= EPGItemCountCheckInterval.Value)
                {
                    if (m_EPGLastItemCount == m_EPGItemCount)
                    {
                        // Early stop
                        m_EPGLastTune = DateTime.MinValue;
                    }
                    else
                    {
                        // Remember item count
                        m_EPGLastItemCheck = DateTime.UtcNow;
                        m_EPGLastItemCount = m_EPGItemCount;
                    }
                }

                // Read the interval since the last tune
                TimeSpan delta = DateTime.UtcNow - m_EPGLastTune;

                // Check for change interval
                if (delta.TotalSeconds < 60)
                {
                    return;
                }

                // Always shut down receivers
                device.SelectGroup(null, null);

                // Get the current state
                int total = m_EPGGroups.Count, left = m_EPGPending.Count;

                // Set the progress value
                if (total < 1)
                {
                    EPGProgress = 1;
                }
                else
                {
                    EPGProgress = 1.0 * (total - left) / total;
                }

                // See if we are fully done
                if (left < 1)
                {
                    return;
                }

                // Load next
                GroupKey next = m_EPGPending[0];

                // Remove from list
                m_EPGPending.RemoveAt(0);

                // Tune to transponder
                device.SelectGroup(next.Location, next.Group);

                // See if there is something on this group
                if (null == device.GetGroupInformation(5000))
                {
                    // Push back
                    m_EPGPending.Add(next);

                    // Next after a short delay
                    return;
                }

                // Add standard EPG
                device.AddProgramGuideConsumer(OnStandardEPGEvent);

                // Check PREMIERE Direct
                if (0 != (m_EPGExtensions & EPGExtensions.PREMIEREDirect))
                {
                    foreach (SourceSelection selection in Profile.FindSource(DirectCIT.TriggerSource))
                    {
                        if (Equals(selection.Location, device.CurrentLocation))
                        {
                            if (Equals(selection.Group, device.CurrentGroup))
                            {
                                // Register
                                device.SetConsumerState(device.AddConsumer <DirectCIT>(OnPremiereEPGEvent), true);

                                // Did it
                                break;
                            }
                        }
                    }
                }

                // Check PREMIERE Sport
                if (0 != (m_EPGExtensions & EPGExtensions.PREMIERESport))
                {
                    foreach (SourceSelection selection in Profile.FindSource(SportCIT.TriggerSource))
                    {
                        if (Equals(selection.Location, device.CurrentLocation))
                        {
                            if (Equals(selection.Group, device.CurrentGroup))
                            {
                                // Register
                                device.SetConsumerState(device.AddConsumer <SportCIT>(OnPremiereEPGEvent), true);

                                // Did it
                                break;
                            }
                        }
                    }
                }

                // Check FreeSat UK
                if (0 != (m_EPGExtensions & EPGExtensions.FreeSatUK))
                {
                    foreach (SourceSelection selection in Profile.FindSource(EIT.FreeSatEPGTriggerSource))
                    {
                        if (Equals(selection.Location, device.CurrentLocation))
                        {
                            if (Equals(selection.Group, device.CurrentGroup))
                            {
                                // Register
                                Guid consumerId = device.AddConsumer <EIT>(EIT.FreeSatEPGPID, OnStandardEPGEvent);
                                device.SetConsumerState(consumerId, true);

                                // Did it
                                break;
                            }
                        }
                    }
                }

                // Reset time
                m_EPGLastTune = DateTime.UtcNow;

                // Remember item count
                m_EPGLastItemCheck = DateTime.UtcNow;
                m_EPGLastItemCount = m_EPGItemCount;
            }
            catch
            {
                // Just go on
            }
        }
예제 #3
0
        /// <summary>
        /// Zeigt Bild, Ton und Videotext an.
        /// </summary>
        /// <param name="audio">Die zu verwendende Tonspur.</param>
        private void Activate(AudioInformation audio)
        {
            // Stop current
            StopReceivers(true);

            // Reset anything in queue
            Accessor.ClearBuffers();

            // Mode of operation
            bool mpeg4 = ((0 != CurrentSourceConfiguration.VideoStream) && (VideoTypes.H264 == CurrentSourceConfiguration.VideoType)), ac3 = false;

            // Configure video
            if (0 != CurrentSourceConfiguration.VideoStream)
            {
                VideoId = Device.AddConsumer(CurrentSourceConfiguration.VideoStream, StreamTypes.Video, Accessor.AddVideo);
            }

            // Use default audio
            if (null == audio)
            {
                if (CurrentSourceConfiguration.AudioTracks.Count > 0)
                {
                    audio = CurrentSourceConfiguration.AudioTracks[0];
                }
            }

            // Configure audio
            if (null != audio)
            {
                // Remember the type
                ac3 = (AudioTypes.AC3 == audio.AudioType);

                // Create the filter
                AudioId = Device.AddConsumer(audio.AudioStream, StreamTypes.Audio, Accessor.AddAudio);
            }

            // Remember for update
            CurrentAudio = audio;

            // Start streaming
            Device.SetConsumerState(VideoId, true);
            Device.SetConsumerState(AudioId, true);

            // Check for video text
            if (0 != CurrentSourceConfiguration.TextStream)
            {
                // Create the PES analyser
                TTXStream stream = new TTXStream(m_TTXConnector, (short)CurrentSourceConfiguration.TextStream, false);

                // Create the filter
                TextId = Device.AddConsumer(CurrentSourceConfiguration.TextStream, StreamTypes.VideoText, stream.AddPayload);

                // Start the filter
                Device.SetConsumerState(TextId, true);
            }

            // Now restart data transmission
            Accessor.StartGraph(mpeg4, ac3);

            // Enable service parser if we are allowed to to so
            if (!Profile.DisableProgramGuide)
            {
                if (!Profile.GetFilter(CurrentSelection.Source).DisableProgramGuide)
                {
                    Device.AddProgramGuideConsumer(ReceiveEPG);
                }
            }
        }