Ejemplo n.º 1
0
        protected IBaseFilter AddFilterByDevicePath(string devicePath, string friendlyName)
        {
            IBaseFilter filter = FilterGraphTools.AddFilterByDevicePath(_graphBuilder, devicePath, friendlyName);

            if (filter == null)
            {
                throw new Exception("The DirectShow filter " + friendlyName + " not found.");
            }
            return(filter);
        }
Ejemplo n.º 2
0
        public FCNSource2VMR()
        {
            source = FilterGraphTools.AddFilterByName(graph, FilterCategory.LegacyAmFilterCategory, "FC Network Source");
            xform  = FilterGraphTools.AddFilterByName(graph, FilterCategory.LegacyAmFilterCategory, "H.264 Byte Stream Transform");
            dec    = FilterGraphTools.AddFilterByName(graph, FilterCategory.LegacyAmFilterCategory, "LEAD H264 Decoder (3.0)");
            vmr    = FilterGraphTools.AddFilterByDevicePath(graph, @"@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{6BC1CFFA-8FC1-4261-AC22-CFB4CC38DB50}", "VMR7");

            FilterGraphTools.ConnectFilters(graph, source, "Output 1", xform, "XForm In", false);
            FilterGraphTools.ConnectFilters(graph, xform, "XForm Out", dec, "XForm In", false);
            FilterGraphTools.ConnectFilters(graph, dec, "XForm Out", vmr, "VMR Input0", false);
        }
Ejemplo n.º 3
0
 public static IBaseFilter AddToFilterGraph(FilterDefinition fd, ref IGraphBuilder graph, string _graphDisplayName)
 {
     if (fd.HasDevicePath)
     {
         return(FilterGraphTools.AddFilterByDevicePath(graph, fd.DevicePath, _graphDisplayName));
     }
     else
     if (fd.CLSID != Guid.Empty)
     {
         return(FilterGraphTools.AddFilterFromClsid(graph, fd.CLSID, _graphDisplayName));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
        public IBaseFilter AddFilterByDevicePath(string devicePath, string friendlyName)
        {
            if (_graphBuilder == null)
            {
                throw new Exception("_graphBuilder is null");
            }
            if (devicePath == null)
            {
                throw new Exception("device path is null");
            }
            if (friendlyName == null)
            {
                throw new Exception("friendlyName is null");
            }
            IBaseFilter filter = FilterGraphTools.AddFilterByDevicePath(_graphBuilder, devicePath, friendlyName);

            if (filter == null)
            {
                throw new Exception("The DirectShow filter " + friendlyName + " not found.");
            }
            return(filter);
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
0
        public WinTV418ATSC(StreamSourceInfo sourceConfig, OpenGraphRequest openGraphRequest)
            : base(sourceConfig, openGraphRequest)
        {
            if (SourceConfig.TVTuner == null)
            {
                throw new SourceConfigException("TVTuner config section not found!");
            }

            _deviceIndex = sourceConfig.TVTuner.DeviceIndex;

            tuningSpace = GetTuningSpace();

            Guid networkType;

            tuningSpace.get__NetworkType(out networkType);
            if (networkType.Equals(Guid.Empty))
            {
                throw new Exception("Not a digital Network Type!");
            }

            networkProvider = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(networkType));
            int hr = _graphBuilder.AddFilter(networkProvider, "Network Provider");

            DsError.ThrowExceptionForHR(hr);
            tuner = (ITuner)networkProvider;

            //add MPEG2 Demux
            mpeg2Demux = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, "MPEG-2 Demultiplexer");

            //add BDA MPEG-2 Transport Information Filter
            bdaTransportInfo = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDATransportInformationRenderersCategory, "BDA MPEG2 Transport Information Filter");
            //add MPEG-2 Sections and Tables Filter
            mpeg2SectionsAndTables = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDATransportInformationRenderersCategory, "MPEG-2 Sections and Tables");

            //tunerFilter = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDASourceFiltersCategory, "Hauppauge WinTV 418 BDA Tuner");
            DsDevice tunerDevice = FindDevice(FilterCategory.BDASourceFiltersCategory, "Hauppauge WinTV 418 BDA Tuner");

            tunerFilter = FilterGraphTools.AddFilterByDevicePath(_graphBuilder, tunerDevice.DevicePath, tunerDevice.Name);
            //captureFilter = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDAReceiverComponentsCategory, "Hauppauge WinTV 418 TS Capture");
            DsDevice captureDevice = FindDevice(FilterCategory.BDAReceiverComponentsCategory, "Hauppauge WinTV 418 TS Capture");

            captureFilter = FilterGraphTools.AddFilterByDevicePath(_graphBuilder, captureDevice.DevicePath, captureDevice.Name);

            //connect network provider to BDA tuner
            ConnectFilters(networkProvider, "Antenna Out", (IBaseFilter)tunerFilter, "Input0", false);
            ConnectFilters((IBaseFilter)tunerFilter, "MPEG2 Transport", captureFilter, "MPEG2 Transport", false);

            //These filters need to be connected via their explicit pins,
            //  because Hauppauge saw fit to name all the pins on the capture filter the same name.
            IPin captureFilterOut = DsFindPin.ByDirection(captureFilter, PinDirection.Output, 0);
            IPin mpeg2DemuxIn     = DsFindPin.ByDirection(mpeg2Demux, PinDirection.Input, 0);

            FilterGraphTools.ConnectFilters(_graphBuilder, captureFilterOut, mpeg2DemuxIn, false);
            //clean up the two pins
            Marshal.ReleaseComObject(captureFilterOut);
            Marshal.ReleaseComObject(mpeg2DemuxIn);

            //add and connect meta data filters and connect them to the Demux
            ConnectFilters(mpeg2Demux, "1", bdaTransportInfo, "Input", false);
            ConnectFilters(mpeg2Demux, "5", mpeg2SectionsAndTables, "In", false);

            //this interface must be queried after the S&T filter has been connected.
            mpeg2Data  = (IMpeg2Data)mpeg2SectionsAndTables;
            _vctParser = new Parser(mpeg2Data);

            //build out the rest of the graph for the given source config / profile
            BuildForProfile();

            ConnectNetMuxToNetSnk();

            if (KnownChannels.Count > 0)
            {
                this.Channel = KnownChannels.Items[0];
            }

            SaveGraphFile("WinTV418ATSC.grf");
        }