Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
        public void Configure(IAudioFrameHeader frameHeader)
        {
            Ac3FrameHeader ac3FrameHeader = (Ac3FrameHeader)frameHeader;

            this.Name              = frameHeader.Name;
            this.Bitrate           = new int?(ac3FrameHeader.Bitrate);
            this.SamplingFrequency = frameHeader.SamplingFrequency;
            this.SetConfigured();
        }
Ejemplo n.º 3
0
        public void Configure(IAudioFrameHeader frameHeader)
        {
            AacFrameHeader aacFrameHeader = (AacFrameHeader)frameHeader;

            this.CodecPrivateData  = AacConfigurator.BuildCodecPrivateData(aacFrameHeader);
            this.Name              = frameHeader.Name;
            this.Channels          = (int)aacFrameHeader.ChannelConfig;
            this.SamplingFrequency = frameHeader.SamplingFrequency;
            this.SetConfigured();
        }
Ejemplo n.º 4
0
        public void Configure(IAudioFrameHeader frameHeader)
        {
            var ac3FrameHeader = (Ac3FrameHeader)frameHeader;

            Name = frameHeader.Name;
            Bitrate = ac3FrameHeader.Bitrate;
            SamplingFrequency = frameHeader.SamplingFrequency;

            SetConfigured();
        }
Ejemplo n.º 5
0
        public void Configure(IAudioFrameHeader frameHeader)
        {
            var aacFrameHeader = (AacFrameHeader)frameHeader;

            CodecPrivateData = BuildCodecPrivateData(aacFrameHeader);

            Name = frameHeader.Name;
            Channels = aacFrameHeader.ChannelConfig;
            SamplingFrequency = frameHeader.SamplingFrequency;

            SetConfigured();
        }
Ejemplo n.º 6
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;
        }
Ejemplo n.º 7
0
        public void Configure(IAudioFrameHeader frameHeader)
        {
            Mp3FrameHeader       mp3FrameHeader    = (Mp3FrameHeader)frameHeader;
            MpegLayer3WaveFormat layer3WaveFormat1 = new MpegLayer3WaveFormat();

            layer3WaveFormat1.nChannels       = (ushort)mp3FrameHeader.Channels;
            layer3WaveFormat1.nSamplesPerSec  = (uint)frameHeader.SamplingFrequency;
            layer3WaveFormat1.nAvgBytesPerSec = (uint)mp3FrameHeader.Bitrate / 8U;
            layer3WaveFormat1.nBlockSize      = (ushort)frameHeader.FrameLength;
            MpegLayer3WaveFormat layer3WaveFormat2 = layer3WaveFormat1;

            this.CodecPrivateData  = WaveFormatExExtensions.ToCodecPrivateData((WaveFormatEx)layer3WaveFormat2);
            this.Channels          = (int)layer3WaveFormat2.nChannels;
            this.SamplingFrequency = frameHeader.SamplingFrequency;
            this.Bitrate           = new int?(mp3FrameHeader.Bitrate);
            this.Name = frameHeader.Name;
            this.SetConfigured();
        }
Ejemplo n.º 8
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;
        }
Ejemplo n.º 9
0
        public void Configure(IAudioFrameHeader frameHeader)
        {
            var mp3FrameHeader    = (Mp3FrameHeader)frameHeader;
            var layer3WaveFormat1 = new MpegLayer3WaveFormat
            {
                nChannels       = (ushort)mp3FrameHeader.Channels,
                nSamplesPerSec  = (uint)frameHeader.SamplingFrequency,
                nAvgBytesPerSec = (uint)mp3FrameHeader.Bitrate / 8U,
                nBlockSize      = (ushort)frameHeader.FrameLength
            };

            var layer3WaveFormat2 = layer3WaveFormat1;

            CodecPrivateData  = layer3WaveFormat2.ToCodecPrivateData();
            Channels          = layer3WaveFormat2.nChannels;
            SamplingFrequency = frameHeader.SamplingFrequency;
            Bitrate           = mp3FrameHeader.Bitrate;
            Name = frameHeader.Name;
            SetConfigured();
        }
Ejemplo n.º 10
0
        public void Configure(IAudioFrameHeader frameHeader)
        {
            var mp3FrameHeader = (Mp3FrameHeader)frameHeader;

            var waveFormat = new MpegLayer3WaveFormat
            {
                nChannels = (ushort)mp3FrameHeader.Channels,
                nSamplesPerSec = (uint)frameHeader.SamplingFrequency,
                nAvgBytesPerSec = (uint)mp3FrameHeader.Bitrate / 8,
                nBlockSize = (ushort)frameHeader.FrameLength
            };

            var cpd = waveFormat.ToCodecPrivateData();

            CodecPrivateData = cpd;

            Channels = waveFormat.nChannels;
            SamplingFrequency = frameHeader.SamplingFrequency;
            Bitrate = mp3FrameHeader.Bitrate;
            Name = frameHeader.Name;

            SetConfigured();
        }
Ejemplo n.º 11
0
 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;
 }