public void Initialize(Func<TsStreamType, uint, IMediaStreamMetadata, TsPacketizedElementaryStream> pesStreamFactory, Action<IProgramStreams> programStreamsHandler = null) { if (pesStreamFactory == null) throw new ArgumentNullException(nameof(pesStreamFactory)); _pesStreamFactory = pesStreamFactory; Clear(); // Bootstrap with the program association handler _programAssociationTable = _programAssociationTableFactory.Create(this, program => true, programStreamsHandler); //_transportStreamDescriptionTable = new TsTransportStreamDescriptionTable(); _packetHandlers[0x0000] = _programAssociationTable.Add; //_packetHandlers[0x0002] = _transportStreamDescriptionTable.Add; _tsIndex = 0; }
void Clear() { if (null != _programAssociationTable) { _programAssociationTable.Clear(); _programAssociationTable = null; } _packetHandlers.Clear(); _destinationLength = 0; }