Exemplo n.º 1
0
        private void SetupH264Encoder()
        {
            throw new Exception("SetupH264Encoder disabled.");
#if COMMENT
            _hcwColorConverter = AddFilterByName(FilterCategory.LegacyAmFilterCategory, @"Hauppauge WinTV Color Format Converter 2");
            ConnectFilters(_captureFilter, "Capture", _hcwColorConverter, "Input");

            _leadYUVColorConverter = AddFilterByName(FilterCategory.LegacyAmFilterCategory, "LEAD Video YUV Converter");
            ConnectFilters(_hcwColorConverter, "Out", _leadYUVColorConverter, "Input");

            _frameRateController = (IBaseFilter) new LMVFramCtrlClass();
            ILMVFrameRateCtrl iFrc     = (ILMVFrameRateCtrl)_frameRateController;
            Profiles          profiles = Profiles.LoadFromFile(SourceConfig.ProfileGroupName);
            Profile           profile  = profiles[SourceConfig.ProfileName];
            iFrc.FrameRate = profile.VideoFrameRate;
            iFrc.Enable    = true;
            AddFilter((IBaseFilter)_frameRateController, "LEAD Video Frame Rate Controller Filter (2.0)");
            ConnectFilters(_leadYUVColorConverter, "XForm Out", (IBaseFilter)_frameRateController, "XForm In");

            _videoEncoder = AddFilterByName(FilterCategory.LegacyAmFilterCategory, "LEAD H264 Encoder (3.0)");
            LMH264Encoder enc = (LMH264Encoder)_videoEncoder;
            enc.OutputFormat      = eH264OUTPUTFORMAT.H264FORMAT_STANDARD_H264;
            enc.EnableRateControl = (Profile.VideoIsVBR == false);
            enc.BitRate           = Profile.VideoMaxBitRate * 1024;
            ConnectFilters((IBaseFilter)_frameRateController, "XForm Out", _videoEncoder, "XForm In");

            _audioEncoder = AddFilterByName(FilterCategory.LegacyAmFilterCategory, "LEAD MPEG Audio Encoder (2.0)");
            ConnectFilters(_captureFilter, "Audio Out", _audioEncoder, "XForm In");
            ConnectFilterToNetMux(_videoEncoder, "XForm Out", "Input 01");
            ConnectFilterToNetMux(_audioEncoder, "XForm Out", "Input 02");
#endif
        }
Exemplo n.º 2
0
        private void Construct(bool compressVideo)
        {
            this.Output = (IBaseFilter)this.Controller.InsertSinkFilter(this.graph);

            bouncingBall = FilterGraphTools.AddFilterByDevicePath(this.graph, @"@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{8D234572-35E6-495D-98AE-9A36856C49C8}", "Bouncing Ball");
            if (compressVideo)
            {
                videoEncoder = FilterGraphTools.AddFilterByName(this.graph, FilterCategory.VideoCompressorCategory, "LEAD H264 Encoder (4.0)");
                h264Encoder  = (LMH264Encoder)videoEncoder;
                h264Encoder.EnableRateControl      = true;
                h264Encoder.EnableSuperCompression = false;
                h264Encoder.BitRate         = 10000;
                h264Encoder.FrameRate       = -1;
                h264Encoder.EncodingSpeed   = eH264ENCODINGSPEED.H264SPEED_1;
                h264Encoder.EncodingThreads = eH264ENCODINGTHREADS.H264THREAD_AUTO;
                FilterGraphTools.ConnectFilters(this.graph, bouncingBall, "A Bouncing Ball!", videoEncoder, "XForm In", false);
                FilterGraphTools.ConnectFilters(this.graph, videoEncoder, "XForm Out", this.Output, "Input 1", false);
            }
            else
            {
                FilterGraphTools.ConnectFilters(this.graph, bouncingBall, "A Bouncing Ball!", this.Output, "Input 1", false);
            }
        }