Example #1
0
        public PesStreamHandler CreateHandler(PesStreamParameters parameters)
        {
            IPesStreamFactoryInstance factory;
            if (!_factories.TryGetValue(parameters.StreamType.StreamType, out factory))
                return new DefaultPesStreamHandler(parameters);

            return factory.Create(parameters);
        }
Example #2
0
        protected PesStreamHandler(PesStreamParameters parameters)
        {
            if (null == parameters)
                throw new ArgumentNullException(nameof(parameters));

            StreamType = parameters.StreamType;
            Pid = parameters.Pid;
        }
        public DefaultPesStreamHandler(PesStreamParameters parameters)
            : base(parameters)
        {
            if (null == parameters)
                throw new ArgumentNullException(nameof(parameters));
            if (null == parameters.NextHandler)
                throw new ArgumentException("NextHandler cannot be null", nameof(parameters));

            _nextHandler = parameters.NextHandler;
        }
Example #4
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 #5
0
        public PesStreamCopyHandler(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");

            _nextHandler = parameters.NextHandler;

            var ext = parameters.StreamType.FileExtension;

            if (string.IsNullOrWhiteSpace(ext))
                ext = "_" + parameters.StreamType.StreamType.ToString("x2") + ".bin";

            _stream = File.Create(string.Format("TS_PID{0}{1}", parameters.Pid, ext), 256 * 1024, FileOptions.Asynchronous | FileOptions.SequentialScan);
        }
Example #6
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;
        }
 public PesStreamHandler Create(PesStreamParameters parameters)
 {
     return new H264StreamHandler(parameters);
 }
Example #8
0
        const bool UseParser = true; // Have Mp3Parser parse the stream and submit frames to the OS.

        public Mp3StreamHandler(PesStreamParameters parameters)
            : base(parameters, new Mp3FrameHeader(), new Mp3Configurator(parameters.MediaStreamMetadata , parameters.StreamType.Description), MinimumPacketSize)
        {
            if (UseParser)
                Parser = new Mp3Parser(parameters.PesPacketPool, AudioConfigurator.Configure, NextHandler);
        }
Example #9
0
        const int MinimumPacketSize = 7; // Well, it needs the ADTS header at least...

        public AacStreamHandler(PesStreamParameters parameters)
            : base(parameters, new AacFrameHeader(), new AacConfigurator(parameters.MediaStreamMetadata, parameters.StreamType.Description), MinimumPacketSize)
        {
            if (AacDecoderSettings.Parameters.UseParser)
                Parser = new AacParser(parameters.PesPacketPool, AudioConfigurator.Configure, NextHandler);
        }
Example #10
0
 public PesStreamHandler CreateHandler(PesStreamParameters parameters)
 {
     return new PesStreamCopyHandler(parameters);
 }