/// <summary> /// Aktiviert die Entschlüsselung einer Quelle. /// </summary> /// <param name="token">Informationen zur gewählten Quelle.</param> private PipelineResult Decrypt( DataGraph.DecryptToken token ) { // Load graph if (token != null) m_DataGraph = token.Pipeline.Graph; // Get unique call identifier var callIdentifier = Interlocked.Increment( ref m_ChangeCounter ); // Check mode of operation var sources = (token == null) ? null : token.Sources; var noSources = (sources == null) || (sources.Length < 1); if (noSources) { // Shutdown all if (m_DataGraph != null) if (m_DataGraph.TunerFilter != null) lock (m_deviceAccess) Decrypt( null, (token == null) || (sources == null) ); // Next return PipelineResult.Continue; } // Start processor token.WaitForPMTs( ( pmt, first ) => { // See if we are still allowed to process and do so lock (m_deviceAccess) if (Thread.VolatileRead( ref m_ChangeCounter ) == callIdentifier) Decrypt( pmt, false ); else return false; // Next return true; }, sources ); // Next return PipelineResult.Continue; }
/// <summary> /// Aktiviert die Entschlüsselung einer Quelle. /// </summary> /// <param name="token">Informationen zur gewählten Quelle.</param> public PipelineResult Decrypt( DataGraph.DecryptToken token ) { // Load graph if (token != null) m_dataGraph = token.Pipeline.Graph; // Get unique call identifier var callIdentifier = Interlocked.Increment( ref m_changeCounter ); // See if we can do anything if (m_dataGraph == null) return PipelineResult.Continue; if (m_filterIndex < 0) return PipelineResult.Continue; if (m_filterIndex >= m_dataGraph.AdditionalFilters.Count) return PipelineResult.Continue; // Deactivate if CAM reset is forbidden var sources = (token == null) ? null : token.Sources; var noSources = (sources == null) || (sources.Length < 1); if ((noSources && (m_suppress != SuppressionMode.Complete)) || !m_hasBeenReset) lock (m_deviceAccess) { // Check COM interface var controlPtr = ComIdentity.QueryInterface( m_dataGraph.AdditionalFilters[m_filterIndex].Interface, typeof( KsControl.Interface ) ); if (controlPtr == IntPtr.Zero) return PipelineResult.Continue; // Process using (var control = new KsControl( controlPtr )) { // Report if (BDASettings.BDATraceSwitch.Enabled) Trace.WriteLine( Properties.Resources.Trace_ResetCAM, BDASettings.BDATraceSwitch.DisplayName ); // Reset the CAM control.Reset(); // We did it once m_hasBeenReset = true; } } // Start processor token.WaitForPMTs( ( pmt, first ) => { // See if we are still allowed to process and do so lock (m_deviceAccess) { // No longer current if (Thread.VolatileRead( ref m_changeCounter ) != callIdentifier) return false; // Try reset if (!first) if (m_disableOnChange) Decrypt( 0, m_dataGraph ); // Wait for it if (m_changeDelay > 0) Thread.Sleep( m_changeDelay ); // Regular Decrypt( pmt.ProgramNumber, m_dataGraph ); } // Next return true; }, sources ); // Next return PipelineResult.Continue; }
/// <summary> /// Aktiviert die Entschlüsselung einer Quelle. /// </summary> /// <param name="token">Informationen zur gewählten Quelle.</param> /// <exception cref="NotSupportedException">Aktuell kann immer nur eine Quelle entschlüsselt werden.</exception> private PipelineResult Decrypt( DataGraph.DecryptToken token ) { // Load graph if (token != null) m_DataGraph = token.Pipeline.Graph; // Get unique call identifier var callIdentifier = Interlocked.Increment( ref m_ChangeCounter ); // Check mode of operation var sources = (token == null) ? null : token.Sources; if ((sources == null) || (sources.Length < 1)) { // Shutdown if (sources == null) lock (m_deviceAccess) Close(); // Next return PipelineResult.Continue; } // Check request if (sources.Length != 1) throw new NotSupportedException( Properties.Resources.Exception_DecryptSingle ); // Wait for PMT token.WaitForPMTs( ( pmt, first ) => { // See if we are still allowed to process and do so lock (m_deviceAccess) if (Thread.VolatileRead( ref m_ChangeCounter ) == callIdentifier) Decrypt( pmt ); else return false; // Next return true; }, sources ); // Next return PipelineResult.Continue; }