コード例 #1
0
 /// <summary>
 /// Erzeugt eine neue Beschreibung.
 /// </summary>
 /// <param name="pipeline">Die zugehörige Gesamtliste aller Aktionen gleicher Art.</param>
 /// <param name="location">Der Ursprung für die angegebene Quellgruppe.</param>
 /// <param name="group">Die neue Quellgruppe.</param>
 private TuneToken(ActionPipeline <TuneToken> pipeline, GroupLocation location, SourceGroup group)
     : base(pipeline)
 {
     // Remember
     GroupLocation = location;
     SourceGroup   = group;
 }
コード例 #2
0
        /// <summary>
        /// Wählt eine Quellgruppe aus.
        /// </summary>
        /// <param name="group">Díe Daten der Quellgruppe.</param>
        /// <param name="location">Die Wahl des Ursprungs, über den die Quellgruppe empfangen werden kann.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-S Quellgruppe handelt.</returns>
        public void SetChannel(SourceGroup group, GroupLocation location)
        {
            // Stop all filters
            StopFilters();

            // May repeat some times
            for (int nRetry = 3; nRetry-- > 0;)
            {
                // Supported types in order of importance
                if (!SendChannel(group as SatelliteGroup, location as SatelliteLocation))
                {
                    if (!SendChannel(group as CableGroup))
                    {
                        if (!SendChannel(group as TerrestrialGroup))
                        {
                            throw new DVBException("Unsupported Channel Type " + group.GetType().FullName);
                        }
                    }
                }

                // Wait for the signal
                for (int n = 10; n-- > 0; Thread.Sleep(50))
                {
                    if (SignalStatus.Locked)
                    {
                        return;
                    }
                }

                // Force to resend DiSEqC command
                m_lastMessage = null;
            }
        }
コード例 #3
0
		private void IndexSourceGroup (SourceGroup group, bool all_items)
		{
			group.SourceAdded += OnSourceAdded;
			group.SourceRemoved += OnSourceRemoved;

			foreach (Evolution.Source src in group.Sources) {
				object[] args = new object [this.ctor_args.Length + 3];
				args [0] = src;
				args [1] = this.queryable;
				args [2] = this.fingerprint;
				Array.Copy (this.ctor_args, 0, args, 3, this.ctor_args.Length);

				Container cont = (Container) Activator.CreateInstance (this.container_type, args);
				if (!cont.OpenClient ())
					continue;

				src_to_cont_map [src] = cont;

				if (all_items)
					cont.IndexAll ();
				else
					cont.IndexChanges ();

				cont.OpenView ();
			}
		}
コード例 #4
0
        private void IndexSourceGroup(SourceGroup group, bool all_items)
        {
            group.SourceAdded   += OnSourceAdded;
            group.SourceRemoved += OnSourceRemoved;

            foreach (Evolution.Source src in group.Sources)
            {
                object[] args = new object [this.ctor_args.Length + 3];
                args [0] = src;
                args [1] = this.queryable;
                args [2] = this.fingerprint;
                Array.Copy(this.ctor_args, 0, args, 3, this.ctor_args.Length);

                Container cont = (Container)Activator.CreateInstance(this.container_type, args);
                if (!cont.OpenClient())
                {
                    continue;
                }

                src_to_cont_map [src] = cont;

                if (all_items)
                {
                    cont.IndexAll();
                }
                else
                {
                    cont.IndexChanges();
                }

                cont.OpenView();
            }
        }
コード例 #5
0
        /// <summary>
        /// Wählt eine Quellgruppe aus.
        /// </summary>
        /// <param name="group">Díe Daten der Quellgruppe.</param>
        /// <param name="location">Die Wahl des Ursprungs, über den die Quellgruppe empfangen werden kann.</param>
        public void Tune(SourceGroup group, GroupLocation location)
        {
            // May repeat some times
            for (int retryCount = 3; retryCount-- > 0; Thread.Sleep(250))
            {
                // All supported in order of importance
                if (!Tune(group as SatelliteGroup, location as SatelliteLocation).HasValue)
                {
                    if (!Tune(group as CableGroup).HasValue)
                    {
                        if (!Tune(group as TerrestrialGroup).HasValue)
                        {
                            throw new DVBException("Unsupported channel type " + group.GetType().FullName);
                        }
                    }
                }

                // Done if locked
                if (SignalStatus.Locked)
                {
                    break;
                }

                // Enforce reset
                m_lastMessage = null;
            }
        }
コード例 #6
0
        /// <summary>
        /// Meldet, dass eine Quelle erkennt wurde und zur Senderliste hinzugeführt wurde.
        /// </summary>
        /// <param name="location">Der Ursprung, auf dem der Sender gefunden wurde.</param>
        /// <param name="group">Die Quellgruppe (Transponder), die den Sender anbietet.</param>
        /// <param name="station">Der gefundene Sender.</param>
        /// <returns>Gesetzt, wenn der Suchlauf fortgesetzt werden soll.</returns>
        private bool StationFound(GroupLocation location, SourceGroup group, Station station)
        {
            // Report
            if (ScannerTraceSwitch.Level >= TraceLevel.Info)
            {
                Trace.WriteLine(string.Format(Properties.Resources.Trace_Scanner_Station, location, group, station), ScannerTraceSwitch.DisplayName);
            }

            // See if handler is provided
            Func <GroupLocation, SourceGroup, Station, TransponderScanner, bool> onStationAdded = OnStationAdded;

            if (null == onStationAdded)
            {
                return(true);
            }

            // Ask caller
            if (onStationAdded(location, group, station, this))
            {
                return(true);
            }

            // Mark stop
            m_Aborted = true;

            // Done
            return(false);
        }
コード例 #7
0
 private void RemoveSourceGroup(SourceGroup group)
 {
     foreach (Evolution.Source src in group.Sources)
     {
         Container cont = (Container)src_to_cont_map [src];
         cont.Remove();
         src_to_cont_map.Remove(src);
     }
 }
コード例 #8
0
        /// <summary>
        /// Erzeugt einen Schlüssel zu einer Quelle.
        /// </summary>
        /// <param name="source">Die Informationen zur Quelle.</param>
        /// <exception cref="ArgumentNullException">Es wurde keine Quelle angegeben.</exception>
        public GroupKey( SourceSelection source )
        {
            // Validate
            if (null == source)
                throw new ArgumentNullException( "source" );

            // Just remember
            Location = source.Location;
            Group = source.Group;
        }
コード例 #9
0
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Quellgruppe.</param>
        /// <param name="location">Der Ursprung zur Quellgruppe.</param>
        public void Tune(SourceGroup group, GroupLocation location)
        {
            // Attach to hardware
            Open();

            // Invalidate all filters
            StopFilters();

            // Send request
            m_Frontend.Tune(group, location);
        }
コード例 #10
0
        /// <summary>
        /// 权限检查/越权警告
        /// </summary>
        internal async Task <bool> AuthCheck()
        {
            if (IsAdmin)
            {
                return(true);
            }
            else
            {
                await SourceGroup.SendGroupMessage(CQCode.CQAt(Sender.Id),
                                                   " 你没有执行此指令的权限");

                ConsoleLog.Warning($"会战[群:{SourceGroup.Id}]", $"群成员{MessageEventArgs.SenderInfo.Nick}正在尝试执行指令{CommandType}");
                return(false);
            }
        }
コード例 #11
0
        /// <summary>
        /// Meldet eine relative Nummer einer Quellgruppe bezüglich dieser Auswahl.
        /// </summary>
        /// <param name="group">Die zu prüfende Quellgruppe.</param>
        /// <returns>Eine bei 0 beginnenden laufende Nummer, die in eine Farbcodierung umgesetzt wird.</returns>
        public override int GetSubGroupIndex(SourceGroup group)
        {
            // Convert
            CableGroup cab = (CableGroup)group;

            // Check mode
            switch (cab.Modulation)
            {
            case CableModulations.QAM64: return(0);

            case CableModulations.QAM256: return(1);

            default: return(2);
            }
        }
コード例 #12
0
        /// <summary>
        /// Meldet eine relative Nummer einer Quellgruppe bezüglich dieser Auswahl.
        /// </summary>
        /// <param name="group">Die zu prüfende Quellgruppe.</param>
        /// <returns>Eine bei 0 beginnenden laufende Nummer, die in eine Farbcodierung umgesetzt wird.</returns>
        public override int GetSubGroupIndex(SourceGroup group)
        {
            // Convert
            SatelliteGroup sat = (SatelliteGroup)group;

            // Check mode
            switch (sat.Polarization)
            {
            case Polarizations.Horizontal: return(0);

            case Polarizations.Vertical: return(1);

            default: return(2);
            }
        }
コード例 #13
0
        /// <summary>
        /// Vergleicht diese Quellgruppe (Transponder) mit einer anderen.
        /// </summary>
        /// <param name="group">Die andere Quellgruppe.</param>
        /// <param name="legacy">Gesetzt, wenn ein partieller Vergleich erfolgen soll.</param>
        /// <returns>Gesetzt, wenn die Gruppen identisch sind.</returns>
        protected override bool OnCompare( SourceGroup group, bool legacy )
        {
            // Change type
            var other = (TerrestrialGroup) group;

            // Most groups can be uniquely identified by the frequency
            if (Frequency != other.Frequency)
                return false;

            // See if full check is required
            if (!legacy)
            {
                // Not so probable
                if (Bandwidth != other.Bandwidth)
                    return false;
            }

            // Same
            return true;
        }
コード例 #14
0
 public ConfigPage()
 {
     InitializeComponent();
     Configs = new List <ConfigItem>()
     {
         new LabelConfigItem("下载", "DownloadFolder", "下载位置"),
         new ButtonConfigItem("下载", "浏览", btn_browse_Click),
         new ComboConfigItem("下载", "FolderPattern", "目录名称规则"),
         new ComboConfigItem("下载", "SongnamePattern", "歌曲名称规则"),
         new ComboConfigItem("下载", "MaxConnection", "同时下载数量"),
         new ComboConfigItem("外观", "Theme", "主题"),
         new ColorConfigItem("外观", "ColorSkin", "特殊颜色"),
         new ToggleConfigItem("外观", "ShowNowPlaying", "显示正在播放悬浮窗"),
         new ToggleConfigItem("外观", "ShowLyric", "显示歌词"),
         new ToggleConfigItem("外观", "EnableMagnet", "边界停靠"),
         new ToggleConfigItem("外观", "TitleMarquee", "标题滚动显示"),
         new InputConfigItem("nest", "url_nest", "nest服务地址"),
         new InputConfigItem("虾米账户", "xiami_username", "用户名"),
         new PasswordConfigItem("虾米账户", "xiami_password", "密码"),
         new ButtonConfigItem("虾米账户", "登录", btn_xiami_login_Click),
         new ButtonConfigItem("百度云账户", "登录", btn_baidu_login_Click),
         new LabelConfigItem("百度云账户", "baidu_access_token", "令牌"),
         new LabelConfigItem("软件更新", "UpdateInfo", ""),
         new ButtonConfigItem("软件更新", "检查更新", btn_check_update_Click),
     };
     foreach (var item in Configs)
     {
         if (!groups.ContainsKey(item.GroupName))
         {
             groups[item.GroupName] = new List <ConfigItem>();
         }
         groups[item.GroupName].Add(item);
     }
     foreach (var item in Configs.Select(x => x.GroupName).Distinct())
     {
         SourceGroup.Add(item);
     }
     list_groups.SelectionChanged += OnList_groupsSelectionChanged;
 }
コード例 #15
0
        /// <summary>
        /// Vergleicht diese Quellgruppe (Transponder) mit einer anderen.
        /// </summary>
        /// <param name="group">Die andere Quellgruppe.</param>
        /// <param name="legacy">Gesetzt, wenn ein partieller Vergleich erfolgen soll.</param>
        /// <returns>Gesetzt, wenn die Gruppen identisch sind.</returns>
        protected override bool OnCompare( SourceGroup group, bool legacy )
        {
            // Change type
            var other = (CableGroup) group;

            // Most groups can be uniquely identified by the frequency
            if (Frequency != other.Frequency)
                return false;

            // Check for near exact comparision
            if (!legacy)
            {
                // Not so probable
                if (Modulation != other.Modulation)
                    return false;

                // The rest is more or less for completeness
                if (SymbolRate != other.SymbolRate)
                    return false;
                if (Bandwidth != other.Bandwidth)
                    return false;
                if (SpectrumInversion != other.SpectrumInversion)
                    return false;
            }

            // Same
            return true;
        }
コード例 #16
0
        /// <summary>
        /// Wählt eine Quellgruppe aus.
        /// </summary>
        /// <param name="group">Díe Daten der Quellgruppe.</param>
        /// <param name="location">Die Wahl des Ursprungs, über den die Quellgruppe empfangen werden kann.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-S Quellgruppe handelt.</returns>
        public void SetChannel( SourceGroup group, GroupLocation location )
        {
            // Stop all filters
            StopFilters();

            // May repeat some times
            for (int nRetry = 3; nRetry-- > 0; )
            {
                // Supported types in order of importance
                if (!SendChannel( group as SatelliteGroup, location as SatelliteLocation ))
                    if (!SendChannel( group as CableGroup ))
                        if (!SendChannel( group as TerrestrialGroup ))
                            throw new DVBException( "Unsupported Channel Type " + group.GetType().FullName );

                // Wait for the signal
                for (int n = 10; n-- > 0; Thread.Sleep( 50 ))
                    if (SignalStatus.Locked)
                        return;

                // Force to resend DiSEqC command
                m_lastMessage = null;
            }
        }
コード例 #17
0
        /// <summary>
        /// Wählt eine Quellgruppe (Transponder) an und prüft, ob ein Signal anliegt.
        /// </summary>
        /// <param name="device">Das aktuell verwendete DVB.NET Geräte.</param>
        /// <param name="location">Optional der Ursprung der Quellgruppe (Transponder).</param>
        /// <param name="group">Die gewünschte Quellgruppe (Transponder).</param>
        /// <param name="lastInversion">Bei DVB-C die zuletzt erfolgreich verwendete spektrale Inversion.</param>
        /// <returns>Die Informationen zu den Quellen oder <i>null</i>.</returns>
        private GroupInformation SelectGroup( Hardware device, GroupLocation location, SourceGroup group, ref SpectrumInversions lastInversion )
        {
            // See if this is a cable group
            var cableGroup = group as CableGroup;
            if (cableGroup != null)
                if (cableGroup.SpectrumInversion == SpectrumInversions.Auto)
                    cableGroup.SpectrumInversion = lastInversion;

            // Report
            if (ScannerTraceSwitch.Level >= TraceLevel.Verbose)
                Trace.WriteLine( string.Format( Properties.Resources.Trace_Scanner_1stTune, location, group ), ScannerTraceSwitch.DisplayName );

            // Choose group
            device.SelectGroup( location, group );

            // Did it
            var info = device.GetGroupInformation( 5000 );
            if (info != null)
                return info;

            // Report
            if (ScannerTraceSwitch.Level >= TraceLevel.Warning)
                Trace.WriteLine( string.Format( Properties.Resources.Trace_Scanner_NoGroupInfo, location, group ), ScannerTraceSwitch.DisplayName );

            // Not cable
            if (cableGroup == null)
                return null;

            // Swap inversion
            lastInversion = (lastInversion == SpectrumInversions.On) ? SpectrumInversions.Off : SpectrumInversions.On;

            // Put into group
            cableGroup.SpectrumInversion = lastInversion;

            // Report
            if (ScannerTraceSwitch.Level >= TraceLevel.Verbose)
                Trace.WriteLine( string.Format( Properties.Resources.Trace_Scanner_2ndTune, location, group ), ScannerTraceSwitch.DisplayName );

            // Choose group
            device.SelectGroup( location, group );

            // Final try
            return device.GetGroupInformation( 5000 );
        }
コード例 #18
0
 /// <summary>
 /// Meldet eine relative Nummer einer Quellgruppe bezüglich dieser Auswahl.
 /// </summary>
 /// <param name="group">Die zu prüfende Quellgruppe.</param>
 /// <returns>Eine bei 0 beginnenden laufende Nummer, die in eine Farbcodierung umgesetzt wird.</returns>
 public override int GetSubGroupIndex( SourceGroup group )
 {
     // Always one
     return 0;
 }
コード例 #19
0
        /// <summary>
        /// Meldet eine relative Nummer einer Quellgruppe bezüglich dieser Auswahl.
        /// </summary>
        /// <param name="group">Die zu prüfende Quellgruppe.</param>
        /// <returns>Eine bei 0 beginnenden laufende Nummer, die in eine Farbcodierung umgesetzt wird.</returns>
        public override int GetSubGroupIndex( SourceGroup group )
        {
            // Convert
            SatelliteGroup sat = (SatelliteGroup) group;

            // Check mode
            switch (sat.Polarization)
            {
                case Polarizations.Horizontal: return 0;
                case Polarizations.Vertical: return 1;
                default: return 2;
            }
        }
コード例 #20
0
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Quellgruppe.</param>
        /// <param name="location">Der Ursprung zur Quellgruppe.</param>
        public void Tune( SourceGroup group, GroupLocation location )
        {
            // Attach to hardware
            Open();

            // Invalidate all filters
            StopFilters();

            // Send request
            m_Frontend.Tune( group, location );
        }
コード例 #21
0
		private void RemoveSourceGroup (SourceGroup group)
		{
			foreach (Evolution.Source src in group.Sources) {
				Container cont = (Container) src_to_cont_map [src];
				cont.Remove ();
				src_to_cont_map.Remove (src);
			}
		}
コード例 #22
0
ファイル: EDSBackends.cs プロジェクト: nolith/tasque
        private void ListenForSources(SourceGroup group)
        {
            Logger.Debug ("ListenForSources.");

               //FIXME : Bug in e-sharp :( ?
               group.SourceAdded += OnSourceAdded;
               group.SourceRemoved += OnSourceRemoved;

               foreach (Evolution.Source source in group.Sources) {
                   AddCategory (source);
               }
        }
コード例 #23
0
        /// <summary>
        /// Vergleicht diese Quellgruppe (Transponder) mit einer anderen.
        /// </summary>
        /// <param name="group">Die andere Quellgruppe.</param>
        /// <param name="legacy">Gesetzt, wenn ein partieller Vergleich erfolgen soll.</param>
        /// <returns>Gesetzt, wenn die Gruppen identisch sind.</returns>
        protected override bool OnCompare( SourceGroup group, bool legacy )
        {
            // Change type
            SatelliteGroup other = (SatelliteGroup) group;

            // Most groups can be uniquely identified by the frequency
            if (legacy)
            {
                // Allow shift by 5 MHz
                if (Math.Abs( (long) Frequency - (long) other.Frequency ) > 5000)
                    return false;
            }
            else
            {
                // Exact match
                if (Frequency != other.Frequency)
                    return false;
            }

            // In rare cases both polarisations are needed
            if (Polarization != other.Polarization)
                return false;

            // Location in the sky
            if (!legacy)
            {
                // All of it
                if (IsWestPosition != other.IsWestPosition)
                    return false;
                if (!Equals( (null == OrbitalPosition) ? string.Empty : OrbitalPosition, (null == other.OrbitalPosition) ? string.Empty : other.OrbitalPosition ))
                    return false;
            }

            // The rest is more or less for completeness
            if (UsesS2Modulation != other.UsesS2Modulation)
                return false;

            // See if we should include the modulation
            if (!legacy)
            {
                // All of it
                if (SymbolRate != other.SymbolRate)
                    return false;
                if (Modulation != other.Modulation)
                    return false;
                if (RollOff != other.RollOff)
                    return false;
                if (InnerFEC != other.InnerFEC)
                    return false;
            }

            // Same
            return true;

        }
コード例 #24
0
            /// <summary>
            /// Erzeugt ein neue Zustandsinformation.
            /// </summary>
            /// <param name="pipeline">Die zugehörige Gesamtliste aller Aktionen gleicher Art.</param>
            /// <param name="location">Der Ursprung für die angegebene Quellgruppe.</param>
            /// <param name="group">Die neue Quellgruppe.</param>
            /// <returns>Die gewünschte Information.</returns>
            /// <exception cref="ArgumentNullException">Es wurde kein Graph übergeben.</exception>
            internal static TuneToken Create(ActionPipeline <TuneToken> pipeline, GroupLocation location, SourceGroup group)
            {
                // Create new
                var token = new TuneToken(pipeline, location, group);

                // Configure
                IDVBTuningSpace2  tuningSpace;
                Action <ILocator> initializer;

                switch (pipeline.Graph.DVBType)
                {
                case DVBSystemType.Terrestrial: tuningSpace = token.PrepareTerrestrial(out initializer); break;

                case DVBSystemType.Satellite: tuningSpace = token.PrepareSatellite(out initializer); break;

                case DVBSystemType.Cable: tuningSpace = token.PrepareCable(out initializer); break;

                default: throw new NotImplementedException(pipeline.Graph.DVBType.ToString());
                }

                // With cleanup
                try
                {
                    // Create a new tune request
                    token.CreateTuneRequest(tuningSpace, initializer);
                }
                finally
                {
                    // No longer used
                    BDAEnvironment.Release(ref tuningSpace);
                }

                // Report
                return(token);
            }
コード例 #25
0
ファイル: Profile.cs プロジェクト: davinx/DVB.NET---VCR.NET
 /// <summary>
 /// Prüft, ob das zugehörige Gerät eine bestimmte Quellgruppe überhaupt unterstützt.
 /// </summary>
 /// <param name="group">Die zu prüfende Quellgruppe.</param>
 /// <returns>Gesetzt, wenn die Quellgruppe unterstützt wird.</returns>
 public abstract bool SupportsGroup( SourceGroup group );
コード例 #26
0
ファイル: DataGraph.cs プロジェクト: davinx/DVB.NET---VCR.NET
        /// <summary>
        /// Erzeugt einen Graphen und startet ihn.
        /// </summary>
        /// <param name="location">Der Ursprung, über den die Quellgruppe empfangen wird.</param>
        /// <param name="group">Die gewünschte Quellgruppe.</param>
        /// <exception cref="ArgumentException">Es wurden nicht alle Parameter gesetzt.</exception>
        public void Create( GroupLocation location, SourceGroup group )
        {
            // Get rid of it
            Destroy();

            // Create new graph builder
            var graph = Activator.CreateInstance( Type.GetTypeFromCLSID( BDAEnvironment.GraphBuilderClassIdentifier ) );
            try
            {
                // Convert interface
                m_Graph = (IMediaFilter) graph;
            }
            catch
            {
                // Cleanup
                BDAEnvironment.Release( ref graph );

                // Forward
                throw;
            }

            // See if we should register the graph
            m_ExternalRegistration = BDASettings.RegisterBDAGRaph( m_Graph, false );

            // Attach to alternate interface
            var builder = (IGraphBuilder) m_Graph;

            // Check log 
            var logFile = BDASettings.BDALogPath;
            if (logFile != null)
            {
                // Open path
                m_LogFile = new FileStream( logFile.FullName, FileMode.Create, FileAccess.Write, FileShare.Read );

                // Enable logging on graph builder
                builder.SetLogFile( m_LogFile.SafeFileHandle );
            }

            // Start with network provider
            NetworkProvider = AddFilter( "Network Provider", BDAEnvironment.GetNetworkProviderMoniker( DVBType ) );

            // Initialize provider
            Tune( location, group );

            // Always create the tuner
            if (TunerInformation != null)
                TunerFilter = AddFilter( "Tuner", TunerInformation );
            else
                throw new ArgumentException( Properties.Resources.Exception_MissingTuner, "Tuner" );

            // Optionally create capture
            if (CaptureInformation != null)
                CaptureFilter = AddFilter( "Capture", CaptureInformation );

            // Add additional filter
            foreach (var additionalFilter in AdditionalFilterInformations)
                if (additionalFilter == null)
                    throw new ArgumentNullException( "AdditionalFilters" );
                else
                    AdditionalFilters.Add( AddFilter( additionalFilter.DisplayName, additionalFilter ) );

            // Connect network provider to streaming instance
            Connect( NetworkProvider, CaptureFilter ?? TunerFilter );

            // Initialize provider
            Tune( location, group );

            // Create the primary filter and add it
            AddFilter( "TS", TransportStreamAnalyser = new InputFilter() );

            // Connect device output for analysis
            Connect( CaptureFilter ?? TunerFilter, TransportStreamAnalyser );

            // Create the demultiplexer - needed to keep the infrastructure alive
            using (var demux = AddFilter( "TIF", BDAEnvironment.MicrosoftDemultiplexerMoniker ))
            {
                // Connect to the dedicated pin of our analyser
                TransportStreamAnalyser.DataManager.TIFConnector.Connect( demux, BDAEnvironment.TransportStreamMediaType1 );

                // Pins to remove
                var remove = new List<string>();

                // Prepare the demultiplexer pins
                demux.InspectAllPins( pin =>
                    {
                        // See if this is the SI pin
                        bool isSectionPin = false;
                        pin.InspectAllMediaTypes( type =>
                            {
                                // Check major
                                if (!type.MajorType.Equals( BDAEnvironment.DataFormatTypeSections ))
                                    return true;

                                // Check minor
                                isSectionPin = type.SubType.Equals( BDAEnvironment.DataFormatSubtypeSI );

                                // Report
                                return !isSectionPin;
                            } );

                        // Check the mode
                        if (isSectionPin)
                        {
                            // Connect
                            using (var comPin = ComIdentity.Create( pin ))
                                builder.Render( comPin.Interface );

                            // Load connection data
                            IntPtr tifIn = IntPtr.Zero;
                            if (pin.ConnectedTo( ref tifIn ) < 0)
                                throw new InvalidOperationException( Properties.Resources.Exception_TIF );

                            // Reconstruct
                            var tifPin = Marshal.GetObjectForIUnknown( tifIn );
                            try
                            {
                                // Request pin context
                                var info = new PinInfo();
                                ((IPin) tifPin).QueryPinInfo( ref info );

                                // Request from pin
                                m_TIF = info.GetAndDisposeFilter();
                            }
                            finally
                            {
                                // Cleanup
                                BDAEnvironment.Release( ref tifPin );
                            }
                        }
                        else if (pin.QueryDirection() == PinDirection.Output)
                        {
                            // Prepare to kill
                            remove.Add( pin.QueryId() );
                        }

                    } );

                // Prepare to remove all unconnected pins
                if (remove.Count > 0)
                    using (var demuxInstance = demux.MarshalToManaged())
                    {
                        // Change type
                        var mpeg2 = (IMpeg2Demultiplexer) demuxInstance.Object;

                        // Remove all
                        foreach (var id in remove)
                            mpeg2.DeleteOutputPin( id );
                    }
            }

            // Install the PMT watchdog
            TransportStreamAnalyser.DataManager.TSParser.PMTFound += ProcessPMT;
        }
コード例 #27
0
ファイル: DataGraph.cs プロジェクト: davinx/DVB.NET---VCR.NET
        /// <summary>
        /// Wählt eine neue Quellgruppe aus.
        /// </summary>
        /// <param name="location">Der Ursprung, über den die Quellgruppe empfangen wird.</param>
        /// <param name="group">Die gewünschte Quellgruppe.</param>
        /// <exception cref="NotSupportedException">Der Graph wurde noch nicht erzeugt.</exception>
        public void Tune( GroupLocation location, SourceGroup group )
        {
            // Validate
            if (NetworkProvider == null)
                throw new NotSupportedException( Properties.Resources.Exception_NotStarted );

            // PAT wait configuration - will use 1/10sec per retry
            var patRetries = Configuration.MinimumPATCountWaitTime;
            var patsExpected = Configuration.MinimumPATCount;

            // Attach to helper
            var analyser = TransportStreamAnalyser;
            var manager = (analyser == null) ? null : analyser.DataManager;
            var parser = (manager == null) ? null : manager.TSParser;

            // May want to retry at least four times
            for (var outerRetry = 4; outerRetry-- > 0; patsExpected += 5, patRetries += 25)
            {
                // Always stop raw dump
                if (manager != null)
                    manager.StopDump();

                // Report
                if (BDASettings.BDATraceSwitch.Enabled)
                    Trace.WriteLine( string.Format( Properties.Resources.Trace_TuneStart, location, group ), BDASettings.BDATraceSwitch.DisplayName );

                // Route request through the current pipeline
                using (var tune = TuneToken.Create( TunePipeline, location, group ))
                    tune.Execute();

                // Not yet up
                if (analyser == null)
                    return;

                // Attach to statistics interface
                var statistics = TunerFilter.GetSignalStatistics();
                if (statistics != null)
                    try
                    {
                        // Set counter
                        var tuneRetry = 10;

                        // Wait
                        for (; tuneRetry-- > 0; Thread.Sleep( 100 ))
                        {
                            // Load the signal information
                            var locked = statistics.SignalLocked;
                            if (locked != 0)
                                break;
                        }

                        // Report
                        if (BDASettings.BDATraceSwitch.Enabled)
                            Trace.WriteLine( string.Format( Properties.Resources.Trace_Lock, 10 - tuneRetry, tuneRetry, BDASettings.FastTune ), BDASettings.BDATraceSwitch.DisplayName );

                        // Final check
                        if (BDASettings.FastTune)
                            if (statistics.SignalLocked == 0)
                                return;
                    }
                    catch
                    {
                        // Just ignore any error
                    }
                    finally
                    {
                        // Back to COM
                        BDAEnvironment.Release( ref statistics );
                    }

                // Check for dump
                StartDump();

                // Reset PAT detection
                parser.RestartPATCounter();

                // Request the number of bytes currently processed
                var bytes = parser.BytesReceived;
                var limit = patsExpected;
                var retry = patRetries;

                // Wait a bit
                for (; (parser.ValidPATCount < limit) && (retry-- > 0); )
                    Thread.Sleep( 100 );

                // Report
                if (BDASettings.BDATraceSwitch.Enabled)
                    Trace.WriteLine( string.Format( Properties.Resources.Trace_StreamOk, patRetries - retry, retry, parser.ValidPATCount, parser.BytesReceived - bytes ), BDASettings.BDATraceSwitch.DisplayName );

                // Disable retry if PATs are received 
                if (parser.ValidPATCount >= limit)
                    break;

                // Disable retry if no data is on the transponder
                if (bytes == parser.BytesReceived)
                    if (outerRetry != 3)
                        break;

                // Report for debugging purposes
                if (BDASettings.BDATraceSwitch.Enabled)
                    Trace.WriteLine( Properties.Resources.Trace_TuneFailed, BDASettings.BDATraceSwitch.DisplayName );

                // Inform all helpers on reset
                SendEmptyTuneRequest( DisableCIResetOnTuneFailure );
            }
        }
コード例 #28
0
ファイル: Context.cs プロジェクト: davinx/DVB.NET---VCR.NET
        /// <summary>
        /// Wählt eine Quellgruppe aus.
        /// </summary>
        /// <param name="group">Díe Daten der Quellgruppe.</param>
        /// <param name="location">Die Wahl des Ursprungs, über den die Quellgruppe empfangen werden kann.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-S Quellgruppe handelt.</returns>
        public void SetChannel( SourceGroup group, GroupLocation location )
        {
            // Always stop CI
            Decrypt( 0 );

            // Store
            Frontend.SetChannel( group, location );
        }
コード例 #29
0
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Quellgruppe.</param>
        /// <param name="location">Der Ursprung zur Quellgruppe.</param>
        public void Tune( SourceGroup group, GroupLocation location )
        {
            // Must register
            Register();

            // Forward
            Context.TheContext.SetChannel( group, location );
        }
コード例 #30
0
 /// <summary>
 /// Ermittelt die Einschränkungen des Sendersuchlaufs bezüglich einer Quellgruppe (Transponder).
 /// </summary>
 /// <param name="group">Die gewünschte Quellgruppe.</param>
 /// <returns>Informationen zur Quellgruppe.</returns>
 /// <exception cref="ArgumentNullException">Es wurde keine Quellgruppe angegeben.</exception>
 public abstract SourceGroupFilter GetFilter( SourceGroup group );
コード例 #31
0
        /// <summary>
        /// Übernimmt das Ergebnis des Sendersuchlaufs in das Geräteprofil.
        /// </summary>
        public void UpdateProfile()
        {
            // Create a map of all current locations
            Dictionary <GroupLocation, GroupLocation> newLocations = new Dictionary <GroupLocation, GroupLocation>();

            // Fill current locations
            foreach (GroupLocation location in m_ScanResults)
            {
                newLocations[location] = location;
            }

            // All previous locations
            List <GroupLocation> oldLocations = new List <GroupLocation>();

            // Fill all which are still active
            foreach (GroupLocation location in Profile.Locations)
            {
                if (newLocations.ContainsKey(location))
                {
                    oldLocations.Add(location);
                }
            }

            // Wipe out
            Profile.Locations.Clear();

            // Reload
            foreach (GroupLocation location in m_ScanResults)
            {
                Profile.Locations.Add(location);
            }

            // All locations to process
            Dictionary <GroupLocation, bool> unprocessedLocations = newLocations.Keys.ToDictionary(l => l, l => true);

            // Process each location individually for a possible merge
            foreach (GroupLocation location in oldLocations)
            {
                // Find the related new location
                GroupLocation newLocation = newLocations[location];

                // No need to check for protocol
                unprocessedLocations.Remove(newLocation);

                // Create a map of all source groups we found
                Dictionary <SourceIdentifier, SourceIdentifier> found = new Dictionary <SourceIdentifier, SourceIdentifier>();

                // Fill it
                foreach (SourceGroup newGroup in newLocation.Groups)
                {
                    foreach (SourceIdentifier newSource in newGroup.Sources)
                    {
                        found[newSource] = newSource;
                    }
                }

                // Already processed
                Dictionary <SourceIdentifier, bool> updatedSources = new Dictionary <SourceIdentifier, bool>();

                // Now see which old sources are no longer available
                foreach (SourceGroup oldGroup in location.Groups)
                {
                    foreach (SourceIdentifier oldSource in oldGroup.Sources)
                    {
                        // Load the new source
                        if (found.ContainsKey(oldSource))
                        {
                            // Mark
                            updatedSources[oldSource] = true;

                            // Next
                            continue;
                        }

                        // At least a group must exist
                        SourceGroup newGroup = null;

                        // Find it
                        foreach (SourceGroup testGroup in newLocation.Groups)
                        {
                            if (testGroup.CompareTo(oldGroup, true))
                            {
                                // Nearly the same
                                newGroup = testGroup;

                                // Done
                                break;
                            }
                        }

                        // Must create the group
                        if (null == newGroup)
                        {
                            // Clone it
                            newGroup = SourceGroup.FromString <SourceGroup>(oldGroup.ToString());

                            // Remember it
                            newLocation.Groups.Add(newGroup);
                        }

                        // Add the missing source
                        newGroup.Sources.Add(oldSource);

                        // Remember
                        m_Protocol.Add(new ProtocolRecord {
                            Mode = ProtocolRecordMode.NotFound, Location = newLocation, Group = newGroup, Source = oldSource
                        });
                    }
                }

                // Finish
                foreach (SourceGroup newGroup in newLocation.Groups)
                {
                    foreach (SourceIdentifier newSource in newGroup.Sources)
                    {
                        if (found.ContainsKey(newSource))
                        {
                            // Check mode
                            ProtocolRecordMode mode;
                            if (updatedSources.ContainsKey(newSource))
                            {
                                mode = ProtocolRecordMode.Found;
                            }
                            else
                            {
                                mode = ProtocolRecordMode.Added;
                            }

                            // Add to protocol
                            m_Protocol.Add(new ProtocolRecord {
                                Mode = mode, Location = newLocation, Group = newGroup, Source = newSource
                            });
                        }
                    }
                }
            }

            // Add all sources to protocol
            foreach (GroupLocation newLocation in unprocessedLocations.Keys)
            {
                foreach (SourceGroup newGroup in newLocation.Groups)
                {
                    foreach (SourceIdentifier newSource in newGroup.Sources)
                    {
                        m_Protocol.Add(new ProtocolRecord {
                            Mode = ProtocolRecordMode.Added, Location = newLocation, Group = newGroup, Source = newSource
                        });
                    }
                }
            }
        }
コード例 #32
0
ファイル: AudioManager.cs プロジェクト: AreonDev/NoWayOut
 /// <summary>
 /// Sets the group gain.
 /// </summary>
 /// <param name="sourceGroup">Source group.</param>
 /// <param name="gain">Gain.</param>
 public void SetGroupGain (SourceGroup sourceGroup, float gain)
 {
     Logger.Log.AddLogEntry (LogLevel.Debug, ClassName, "Setting group gain of '{0}' to {1}",
         sourceGroup.ToString (), gain.ToString ());
     Groups[sourceGroup] = gain;
 }
コード例 #33
0
ファイル: Frontend.cs プロジェクト: davinx/DVB.NET---VCR.NET
        /// <summary>
        /// Wählt eine Quellgruppe aus.
        /// </summary>
        /// <param name="group">Díe Daten der Quellgruppe.</param>
        /// <param name="location">Die Wahl des Ursprungs, über den die Quellgruppe empfangen werden kann.</param>
        public void Tune( SourceGroup group, GroupLocation location )
        {
            // May repeat some times
            for (int retryCount = 3; retryCount-- > 0; Thread.Sleep( 250 ))
            {
                // All supported in order of importance
                if (!Tune( group as SatelliteGroup, location as SatelliteLocation ).HasValue)
                    if (!Tune( group as CableGroup ).HasValue)
                        if (!Tune( group as TerrestrialGroup ).HasValue)
                            throw new DVBException( "Unsupported channel type " + group.GetType().FullName );

                // Done if locked
                if (SignalStatus.Locked)
                    break;

                // Enforce reset
                m_lastMessage = null;
            }
        }
コード例 #34
0
ファイル: AudioManager.cs プロジェクト: AreonDev/NoWayOut
 /// <summary>
 /// Gets the group gain.
 /// </summary>
 /// <returns>The group gain.</returns>
 /// <param name="sourceGroup">Source group.</param>
 public float GetGroupGain (SourceGroup sourceGroup)
 {
     float gain;
     if (!Groups.TryGetValue (sourceGroup, out gain))
         gain = 0;
     return gain;
 }
コード例 #35
0
        /// <summary>
        /// Meldet eine relative Nummer einer Quellgruppe bezüglich dieser Auswahl.
        /// </summary>
        /// <param name="group">Die zu prüfende Quellgruppe.</param>
        /// <returns>Eine bei 0 beginnenden laufende Nummer, die in eine Farbcodierung umgesetzt wird.</returns>
        public override int GetSubGroupIndex( SourceGroup group )
        {
            // Convert
            CableGroup cab = (CableGroup) group;

            // Check mode
            switch (cab.Modulation)
            {
                case CableModulations.QAM64: return 0;
                case CableModulations.QAM256: return 1;
                default: return 2;
            }
        }
コード例 #36
0
 public override bool Equals(SourceGroup x, SourceGroup y)
 {
     // Compare if two collection of SyntaxTree are the same
     // Not the best perf-wise, but should be good enough for now
     return(new HashSet <SyntaxTree>(x.Vertices).SetEquals(y.Vertices));
 }
コード例 #37
0
 /// <summary>
 /// Meldet eine relative Nummer einer Quellgruppe bezüglich dieser Auswahl.
 /// </summary>
 /// <param name="group">Die zu prüfende Quellgruppe.</param>
 /// <returns>Eine bei 0 beginnenden laufende Nummer, die in eine Farbcodierung umgesetzt wird.</returns>
 public abstract int GetSubGroupIndex( SourceGroup group );
コード例 #38
0
        /// <summary>
        /// Prüft nach der Untersuchung einer Quellgruppe (Transponder), ob der
        /// Suchlauf abgebrochen werden soll.
        /// </summary>
        /// <param name="location">Der Ursprung zur Quellgruppe.</param>
        /// <param name="group">Die zu Quellgruppe, die gerade bearbeitet wurde.</param>
        /// <returns>Gesetzt, wenn der Suchlauf fortgesetzt werden soll.</returns>
        private bool GroupDone( GroupLocation location, SourceGroup group )
        {
            // Report
            if (ScannerTraceSwitch.Level >= TraceLevel.Info)
                Trace.WriteLine( string.Format( Properties.Resources.Trace_Scanner_DoneGroup, location, group ), ScannerTraceSwitch.DisplayName );

            // See if handler is provided
            Func<GroupLocation, SourceGroup, TransponderScanner, bool> onDoneGroup = OnDoneGroup;
            if (null == onDoneGroup)
                return true;

            // Ask caller
            if (onDoneGroup( location, group, this ))
                return true;

            // Mark stop
            m_Aborted = true;

            // Done
            return false;
        }