Example #1
0
        public PesStreamParameters(ITsPesPacketPool pesPacketPool)
        {
            if (null == pesPacketPool)
                throw new ArgumentNullException(nameof(pesPacketPool));

            _pesPacketPool = pesPacketPool;
        }
Example #2
0
 public TsMediaParser(ITsDecoder tsDecoder, ITsPesPacketPool tsPesPacketPool, IBufferPool bufferPool, ITsTimestamp tsTimemestamp, IPesHandlers pesHandlers)
 {
     if (null == tsDecoder)
     {
         throw new ArgumentNullException("tsDecoder");
     }
     if (null == tsPesPacketPool)
     {
         throw new ArgumentNullException("tsPesPacketPool");
     }
     if (null == bufferPool)
     {
         throw new ArgumentNullException("bufferPool");
     }
     if (null == tsTimemestamp)
     {
         throw new ArgumentNullException("tsTimemestamp");
     }
     if (null == pesHandlers)
     {
         throw new ArgumentNullException("pesHandlers");
     }
     this._tsPesPacketPool = tsPesPacketPool;
     this._bufferPool      = bufferPool;
     this._tsDecoder       = tsDecoder;
     this._tsTimemestamp   = tsTimemestamp;
     this._pesHandlers     = pesHandlers;
 }
Example #3
0
        public NullBufferingManager(ITsPesPacketPool packetPool)
        {
            if (null == packetPool)
                throw new ArgumentNullException(nameof(packetPool));

            _packetPool = packetPool;
        }
Example #4
0
 protected AudioStreamHandler(PesStreamParameters parameters, IAudioFrameHeader frameHeader, IAudioConfigurator configurator, int minimumPacketSize)
     : base(parameters)
 {
     if (null == parameters)
     {
         throw new ArgumentNullException("parameters");
     }
     if (null == parameters.PesPacketPool)
     {
         throw new ArgumentException("PesPacketPool cannot be null", "parameters");
     }
     if (null == parameters.NextHandler)
     {
         throw new ArgumentException("NextHandler cannot be null", "parameters");
     }
     if (minimumPacketSize < 1)
     {
         throw new ArgumentOutOfRangeException("minimumPacketSize", "minimumPacketSize must be positive: " + (object)minimumPacketSize);
     }
     if (null == frameHeader)
     {
         throw new ArgumentNullException("frameHeader");
     }
     this._pesPacketPool     = parameters.PesPacketPool;
     this.NextHandler        = parameters.NextHandler;
     this._frameHeader       = frameHeader;
     this.AudioConfigurator  = configurator;
     this._minimumPacketSize = minimumPacketSize;
 }
 public NullBufferingManager(ITsPesPacketPool packetPool)
 {
     if (null == packetPool)
     {
         throw new ArgumentNullException("packetPool");
     }
     this._packetPool = packetPool;
 }
Example #6
0
 public PesStreamParameters(ITsPesPacketPool pesPacketPool)
 {
     if (null == pesPacketPool)
     {
         throw new ArgumentNullException("pesPacketPool");
     }
     this._pesPacketPool = pesPacketPool;
 }
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
     {
         return;
     }
     this.FreeBuffer();
     this._pesPacketPool        = (ITsPesPacketPool)null;
     this._configurationHandler = (Action <IAudioFrameHeader>)null;
     this._submitPacket         = (Action <TsPesPacket>)null;
 }
Example #8
0
        public H262StreamHandler(PesStreamParameters parameters)
            : base(parameters)
        {
            if (null == parameters)
                throw new ArgumentNullException(nameof(parameters));
            if (null == parameters.PesPacketPool)
                throw new ArgumentException("PesPacketPool cannot be null", nameof(parameters));
            if (null == parameters.NextHandler)
                throw new ArgumentException("NextHandler cannot be null", nameof(parameters));

            _pesPacketPool = parameters.PesPacketPool;
            _nextHandler = parameters.NextHandler;
            _configurator = new H262Configurator(parameters.MediaStreamMetadata, parameters.StreamType.Description);
        }
Example #9
0
        protected MediaDumpBase(Action<IProgramStreams> programStreamsHandler)
        {
            _programStreamsHandler = programStreamsHandler;
            BufferPool = new BufferPool(new DefaultBufferPoolParameters
            {
                BaseSize = 5 * 64 * 1024,
                Pools = 2
            });

            PacketPool = new TsPesPacketPool(BufferPool);
            _bufferingManager = new NullBufferingManager(PacketPool);

            _streamReader = new SignalTask(ReadStreams);
        }
        public TsPacketizedElementaryStream(IBufferPool bufferPool, ITsPesPacketPool pesPacketPool, Action<TsPesPacket> packetHandler, TsStreamType streamType, uint pid)
        {
            if (null == bufferPool)
                throw new ArgumentNullException(nameof(bufferPool));
            if (null == pesPacketPool)
                throw new ArgumentNullException(nameof(pesPacketPool));

            _bufferPool = bufferPool;
            _pesPacketPool = pesPacketPool;

            _streamType = streamType;
            _pid = pid;

            _handler = packetHandler;
        }
Example #11
0
        protected AudioParserBase(IAudioFrameHeader frameHeader, ITsPesPacketPool pesPacketPool, Action<IAudioFrameHeader> configurationHandler, Action<TsPesPacket> submitPacket)
        {
            if (frameHeader == null)
                throw new ArgumentNullException(nameof(frameHeader));
            if (pesPacketPool == null)
                throw new ArgumentNullException(nameof(pesPacketPool));
            if (configurationHandler == null)
                throw new ArgumentNullException(nameof(configurationHandler));
            if (submitPacket == null)
                throw new ArgumentNullException(nameof(submitPacket));

            _frameHeader = frameHeader;
            _pesPacketPool = pesPacketPool;
            _configurationHandler = configurationHandler;
            _submitPacket = submitPacket;
        }
 public TsPacketizedElementaryStream(IBufferPool bufferPool, ITsPesPacketPool pesPacketPool, Action <TsPesPacket> packetHandler, TsStreamType streamType, uint pid)
 {
     if (null == bufferPool)
     {
         throw new ArgumentNullException("bufferPool");
     }
     if (null == pesPacketPool)
     {
         throw new ArgumentNullException("pesPacketPool");
     }
     this._bufferPool    = bufferPool;
     this._pesPacketPool = pesPacketPool;
     this._streamType    = streamType;
     this._pid           = pid;
     this._handler       = packetHandler;
 }
Example #13
0
        public BufferingManager(IBufferingPolicy bufferingPolicy, ITsPesPacketPool packetPool)
        {
            if (null == bufferingPolicy)
                throw new ArgumentNullException(nameof(bufferingPolicy));
            if (null == packetPool)
                throw new ArgumentNullException(nameof(packetPool));

            _bufferingPolicy = bufferingPolicy;
            _packetPool = packetPool;

            _refreshTask = new SignalTask(() =>
            {
                RefreshHandler();

                return TplTaskExtensions.CompletedTask;
            }, _disposeCancellationTokenSource.Token);
        }
Example #14
0
 public BufferingManager(IBufferingPolicy bufferingPolicy, ITsPesPacketPool packetPool)
 {
     if (null == bufferingPolicy)
     {
         throw new ArgumentNullException("bufferingPolicy");
     }
     if (null == packetPool)
     {
         throw new ArgumentNullException("packetPool");
     }
     this._bufferingPolicy = bufferingPolicy;
     this._packetPool      = packetPool;
     this._refreshTask     = new SignalTask((Func <Task>)(() =>
     {
         this.RefreshHandler();
         return(TplTaskExtensions.CompletedTask);
     }), this._disposeCancellationTokenSource.Token);
 }
 public H262StreamHandler(PesStreamParameters parameters)
     : base(parameters)
 {
     if (null == parameters)
     {
         throw new ArgumentNullException("parameters");
     }
     if (null == parameters.PesPacketPool)
     {
         throw new ArgumentException("PesPacketPool cannot be null", "parameters");
     }
     if (null == parameters.NextHandler)
     {
         throw new ArgumentException("NextHandler cannot be null", "parameters");
     }
     this._pesPacketPool = parameters.PesPacketPool;
     this._nextHandler   = parameters.NextHandler;
     this._configurator  = new H262Configurator(parameters.MediaStreamMetadata, parameters.StreamType.Description);
 }
Example #16
0
        public TsMediaParser(ITsDecoder tsDecoder, ITsPesPacketPool tsPesPacketPool, IBufferPool bufferPool, ITsTimestamp tsTimemestamp, IPesHandlers pesHandlers)
        {
            if (null == tsDecoder)
                throw new ArgumentNullException(nameof(tsDecoder));
            if (null == tsPesPacketPool)
                throw new ArgumentNullException(nameof(tsPesPacketPool));
            if (null == bufferPool)
                throw new ArgumentNullException(nameof(bufferPool));
            if (null == tsTimemestamp)
                throw new ArgumentNullException(nameof(tsTimemestamp));
            if (null == pesHandlers)
                throw new ArgumentNullException(nameof(pesHandlers));

            _tsPesPacketPool = tsPesPacketPool;
            _bufferPool = bufferPool;
            _tsDecoder = tsDecoder;
            _tsTimemestamp = tsTimemestamp;
            _pesHandlers = pesHandlers;
        }
 protected MediaParserBase(TsStreamType streamType, TConfigurator configurator, ITsPesPacketPool tsPesPacketPool)
 {
     if (null == streamType)
     {
         throw new ArgumentNullException("streamType");
     }
     if (object.ReferenceEquals((object)default(TConfigurator), (object)configurator))
     {
         throw new ArgumentNullException("configurator");
     }
     if (null == tsPesPacketPool)
     {
         throw new ArgumentNullException("tsPesPacketPool");
     }
     this._streamType      = streamType;
     this._configurator    = configurator;
     this._tsPesPacketPool = tsPesPacketPool;
     this._configurator.ConfigurationComplete += new EventHandler(this.OnConfigurationComplete);
 }
 public H264StreamHandler(PesStreamParameters parameters)
     : base(parameters)
 {
     if (null == parameters)
     {
         throw new ArgumentNullException("parameters");
     }
     if (null == parameters.PesPacketPool)
     {
         throw new ArgumentException("PesPacketPool cannot be null", "parameters");
     }
     if (null == parameters.NextHandler)
     {
         throw new ArgumentException("NextHandler cannot be null", "parameters");
     }
     this._pesPacketPool = parameters.PesPacketPool;
     this._nextHandler   = parameters.NextHandler;
     this._configurator  = new H264Configurator(parameters.MediaStreamMetadata, parameters.StreamType.Description);
     this._parser        = new NalUnitParser(new Func <byte, NalUnitParser.ParserStateHandler>(this.ResolveHandler));
 }
Example #19
0
        protected AudioStreamHandler(PesStreamParameters parameters, IAudioFrameHeader frameHeader, IAudioConfigurator configurator, int minimumPacketSize)
            : base(parameters)
        {
            if (null == parameters)
                throw new ArgumentNullException(nameof(parameters));
            if (null == parameters.PesPacketPool)
                throw new ArgumentException("PesPacketPool cannot be null", nameof(parameters));
            if (null == parameters.NextHandler)
                throw new ArgumentException("NextHandler cannot be null", nameof(parameters));
            if (minimumPacketSize < 1)
                throw new ArgumentOutOfRangeException(nameof(minimumPacketSize), "minimumPacketSize must be positive: " + minimumPacketSize);
            if (null == frameHeader)
                throw new ArgumentNullException(nameof(frameHeader));

            _pesPacketPool = parameters.PesPacketPool;
            NextHandler = parameters.NextHandler;
            _frameHeader = frameHeader;
            AudioConfigurator = configurator;
            _minimumPacketSize = minimumPacketSize;
        }
 protected AudioParserBase(IAudioFrameHeader frameHeader, ITsPesPacketPool pesPacketPool, Action <IAudioFrameHeader> configurationHandler, Action <TsPesPacket> submitPacket)
 {
     if (frameHeader == null)
     {
         throw new ArgumentNullException("frameHeader");
     }
     if (pesPacketPool == null)
     {
         throw new ArgumentNullException("pesPacketPool");
     }
     if (configurationHandler == null)
     {
         throw new ArgumentNullException("configurationHandler");
     }
     if (submitPacket == null)
     {
         throw new ArgumentNullException("submitPacket");
     }
     this._frameHeader          = frameHeader;
     this._pesPacketPool        = pesPacketPool;
     this._configurationHandler = configurationHandler;
     this._submitPacket         = submitPacket;
 }
Example #21
0
 public Mp3Parser(ITsPesPacketPool pesPacketPool, Action <IAudioFrameHeader> configurationHandler, Action <TsPesPacket> submitPacket)
     : base((IAudioFrameHeader) new Mp3FrameHeader(), pesPacketPool, configurationHandler, submitPacket)
 {
 }
Example #22
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
                return;

            FreeBuffer();

            _pesPacketPool = null;
            _configurationHandler = null;
            _submitPacket = null;
        }
Example #23
0
 public AacParser(ITsPesPacketPool pesPacketPool, Action <IAudioFrameHeader> configurationHandler, Action <TsPesPacket> submitPacket)
     : base(new AacFrameHeader(), pesPacketPool, configurationHandler, submitPacket)
 {
 }
 public Ac3MediaParser(ITsPesPacketPool pesPacketPool, IShoutcastMetadataFilterFactory shoutcastMetadataFilterFactory, IMetadataSink metadataSink)
     : base(Ac3MediaParser.StreamType, new Ac3Configurator((IMediaStreamMetadata)null, (string)null), pesPacketPool, shoutcastMetadataFilterFactory, metadataSink)
 {
     this.Parser = new Ac3Parser(pesPacketPool, new Action <IAudioFrameHeader>(this.Configurator.Configure), new Action <TsPesPacket>(((MediaParserBase <Ac3Configurator>) this).SubmitPacket));
 }
Example #25
0
 public Mp3Parser(ITsPesPacketPool pesPacketPool, Action<IAudioFrameHeader> configurationHandler, Action<TsPesPacket> submitPacket)
     : base(new Mp3FrameHeader(), pesPacketPool, configurationHandler, submitPacket)
 { }
 public AacMediaParser(ITsPesPacketPool pesPacketPool, IShoutcastMetadataFilterFactory shoutcastMetadataFilterFactory, IMetadataSink metadataSink)
     : base(StreamType, new AacConfigurator((IMediaStreamMetadata)null, null), pesPacketPool, shoutcastMetadataFilterFactory, metadataSink)
 {
     Parser = new AacParser(pesPacketPool, Configurator.Configure, SubmitPacket);
 }
 public Mp3MediaParser(ITsPesPacketPool pesPacketPool, IShoutcastMetadataFilterFactory shoutcastMetadataFilterFactory, IMetadataSink metadataSink)
     : base(StreamType, new Mp3Configurator(null), pesPacketPool, shoutcastMetadataFilterFactory, metadataSink)
 {
     Parser = new Mp3Parser(pesPacketPool, Configurator.Configure, SubmitPacket);
 }
Example #28
0
 protected AudioMediaParser(TsStreamType streamType, TConfigurator configurator, ITsPesPacketPool pesPacketPool, IShoutcastMetadataFilterFactory shoutcastMetadataFilterFactory, IMetadataSink metadataSink)
     : base(streamType, configurator, pesPacketPool)
 {
     if (null == shoutcastMetadataFilterFactory)
     {
         throw new ArgumentNullException("shoutcastMetadataFilterFactory");
     }
     if (null == metadataSink)
     {
         throw new ArgumentNullException("metadataSink");
     }
     this._shoutcastMetadataFilterFactory = shoutcastMetadataFilterFactory;
     this._metadataSink = metadataSink;
 }