private void Activate() { foreach (TsProgramAssociationTable.ProgramAssociation programAssociation in this._programs) { if (!this._newPrograms.Contains(programAssociation)) { this._decoder.UnregisterHandler(programAssociation.Pid); this._oldPrograms.Add(programAssociation); } } foreach (TsProgramAssociationTable.ProgramAssociation program in this._oldPrograms) { this.CloseProgram(program); } this._oldPrograms.Clear(); foreach (TsProgramAssociationTable.ProgramAssociation programAssociation in this._newPrograms) { if (0 != programAssociation.ProgramNumber && !this._programs.Contains(programAssociation)) { TsProgramMapTable tsProgramMapTable = this._programMapTableFactory.Create(this._decoder, programAssociation.ProgramNumber, programAssociation.Pid, this._streamFilter); programAssociation.MapTable = tsProgramMapTable; this._decoder.RegisterHandler(programAssociation.Pid, new Action <TsPacket>(((TsProgramSpecificInformation)tsProgramMapTable).Add)); this._programs.Add(programAssociation); } } this._newPrograms.Clear(); }
private void CloseProgram(TsProgramAssociationTable.ProgramAssociation program) { Debug.Assert(this._programs.Remove(program)); TsProgramMapTable tsProgramMapTable = program.MapTable; if (null == tsProgramMapTable) { return; } tsProgramMapTable.Clear(); }