/// <summary> /// Wertet die nächste Tabelle aus. /// </summary> /// <param name="table">Eine aktuelle Tabelle.</param> private void ProcessNext( PMT table ) { // Got new data if (table != null) if (table.IsValid) { // See of there is a previous one PMT previous; if (m_lastTable.TryGetValue( table.ProgramNumber, out previous )) { // Report on change or first request if ((previous == null) || (previous.Version != table.Version)) if (!m_processor( table, previous == null )) return; // Update m_lastTable[table.ProgramNumber] = table; } } // Next source to request var source = m_services[m_index++]; // Clip if (m_index == m_services.Length) m_index = 0; // Fire up m_graph.ActivatePMTWatchDog( source, ProcessNext ); }
/// <summary> /// Aktiviert die Entschlüsselung eines Senders. /// </summary> /// <param name="pmt">Daten zum Sender.</param> /// <returns>Die neue Befehlssequenz.</returns> public static CACommand CreateDecrypt( PMT pmt ) { // Create helper byte[] table = pmt.Section.CreateSITable(); // Create CACommand command = new CACommand(); // Fill command command.Tag = (byte) CACommandTags.Decrypt; command.CommandData = new byte[MaxDataLength]; // Fill data command.CommandData[0] = (byte) CAListTypes.One; command.CommandData[1] = (byte) PMTCommands.Descramble; // Calculate the length - we are in trouble if PMT is too long! command.Length = (ushort) (2 + Math.Min( command.CommandData.Length - 2, table.Length - 1 )); // Copy over and get rid of the offset byte Array.Copy( table, 1, command.CommandData, 2, command.Length - 2 ); // Report return command; }
/// <summary> /// Wertet eine SI Tabelle aus. /// </summary> /// <param name="pmt"></param> private void OnPMTFound( PMT pmt ) { // Validate if (pmt != null) if (pmt.ProgramNumber != m_WaitForService) pmt = null; // Disable or restart m_WaitForService = m_ResetAfterServiceFound; m_WaitForPID = 0; // Nothing to do if (pmt == null) return; // Forward var callback = PMTFound; if (callback != null) callback( pmt ); }