Exemple #1
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 PesStreamHandler CreateHandler(PesStreamParameters parameters)
        {
            IPesStreamFactoryInstance streamFactoryInstance;

            return(!_factories.TryGetValue(parameters.StreamType.StreamType, out streamFactoryInstance)
                ? new DefaultPesStreamHandler(parameters)
                : streamFactoryInstance.Create(parameters));
        }
Exemple #3
0
 protected PesStreamHandler(PesStreamParameters parameters)
 {
     if (null == parameters)
     {
         throw new ArgumentNullException(nameof(parameters));
     }
     StreamType = parameters.StreamType;
     _pid       = parameters.Pid;
 }
 public AacStreamHandler(PesStreamParameters parameters)
     : base(parameters, (IAudioFrameHeader) new AacFrameHeader(), (IAudioConfigurator) new AacConfigurator(parameters.MediaStreamMetadata, parameters.StreamType.Description), 7)
 {
     if (!AacDecoderSettings.Parameters.UseParser)
     {
         return;
     }
     this.Parser = (AudioParserBase) new AacParser(parameters.PesPacketPool, new Action <IAudioFrameHeader>(this.AudioConfigurator.Configure), this.NextHandler);
 }
 protected PesStreamHandler(PesStreamParameters parameters)
 {
     if (null == parameters)
     {
         throw new ArgumentNullException("parameters");
     }
     this.StreamType = parameters.StreamType;
     this.Pid        = parameters.Pid;
 }
Exemple #6
0
        public PesStreamHandler CreateHandler(PesStreamParameters parameters)
        {
            IPesStreamFactoryInstance streamFactoryInstance;

            if (!this._factories.TryGetValue(parameters.StreamType.StreamType, out streamFactoryInstance))
            {
                return((PesStreamHandler) new DefaultPesStreamHandler(parameters));
            }
            return(streamFactoryInstance.Create(parameters));
        }
Exemple #7
0
 public DefaultPesStreamHandler(PesStreamParameters parameters)
     : base(parameters)
 {
     if (null == parameters)
     {
         throw new ArgumentNullException("parameters");
     }
     if (null == parameters.NextHandler)
     {
         throw new ArgumentException("NextHandler cannot be null", "parameters");
     }
     this._nextHandler = parameters.NextHandler;
 }
 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);
 }
 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));
 }
Exemple #10
0
        public PesStreamHandler GetPesHandler(TsStreamType streamType, uint pid, IMediaStreamMetadata mediaStreamMetadata, Action <TsPesPacket> nextHandler)
        {
            PesStreamHandler handler;

            if (this._handlers.TryGetValue(pid, out handler))
            {
                Debug.WriteLine("Found PES {0} stream ({1}) with PID {2}", (object)streamType.Contents, (object)streamType.Description, (object)pid);
            }
            else
            {
                Debug.WriteLine("Create PES {0} stream ({1}) with PID {2}", (object)streamType.Contents, (object)streamType.Description, (object)pid);
                PesStreamParameters parameters = this._parameterFactory();
                parameters.Pid                 = pid;
                parameters.StreamType          = streamType;
                parameters.NextHandler         = nextHandler;
                parameters.MediaStreamMetadata = mediaStreamMetadata;
                handler             = this._handlerFactory.CreateHandler(parameters);
                this._handlers[pid] = handler;
            }
            return(handler);
        }
 public PesStreamHandler Create(PesStreamParameters parameters)
 {
     return((PesStreamHandler) new AacStreamHandler(parameters));
 }
Exemple #12
0
 public Ac3StreamHandler(PesStreamParameters parameters)
     : base(parameters, (IAudioFrameHeader) new Ac3FrameHeader(), (IAudioConfigurator) new Ac3Configurator(parameters.MediaStreamMetadata, parameters.StreamType.Description), 7)
 {
     this.Parser = (AudioParserBase) new Ac3Parser(parameters.PesPacketPool, new Action <IAudioFrameHeader>(this.AudioConfigurator.Configure), this.NextHandler);
 }
 public PesStreamHandler Create(PesStreamParameters parameters)
 {
     return(new Mp3StreamHandler(parameters));
 }
 public Mp3StreamHandler(PesStreamParameters parameters)
     : base(parameters, new Mp3FrameHeader(), new Mp3Configurator(parameters.MediaStreamMetadata, parameters.StreamType.Description), MINIMUM_PACKET_SIZE)
 {
     Parser = new Mp3Parser(parameters.PesPacketPool, AudioConfigurator.Configure, NextHandler);
 }