// The custom Allocator / Presenter is responsible of create the Direct3D device1
        // and must pass it to the VMR9...
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            IntPtr unmanagedDevice = device1.GetObjectByValue(DxMagicNumber);
            IntPtr hMonitor        = Manager.GetAdapterMonitor(Manager.Adapters.Default.Adapter);

            return(surfaceAllocatorNotify.SetD3DDevice(unmanagedDevice, hMonitor));
        }
        public void BuildGraph()
        {
            int hr = 0;

            graphBuilder = (IFilterGraph2) new FilterGraph();

            rot = new DsROTEntry(graphBuilder);

            vmr9 = (IBaseFilter) new VideoMixingRenderer9();

            IVMRFilterConfig9 filterConfig = (IVMRFilterConfig9)vmr9;

            hr = filterConfig.SetNumberOfStreams(2);
            DsError.ThrowExceptionForHR(hr);

            // Put the VMR9 in Renderless mode
            hr = filterConfig.SetRenderingMode(VMR9Mode.Renderless);
            DsError.ThrowExceptionForHR(hr);

            surfaceAllocatorNotify = (IVMRSurfaceAllocatorNotify9)vmr9;

            // Advise to VMR9 of our custom Allocator / Presenter
            hr = surfaceAllocatorNotify.AdviseSurfaceAllocator(cookie, this);
            DsError.ThrowExceptionForHR(hr);

            // Advise our custom Allocator / Presenter of the VMR9
            hr = this.AdviseNotify(surfaceAllocatorNotify);
            DsError.ThrowExceptionForHR(hr);

            hr = graphBuilder.AddFilter(vmr9, "VMR9");
            DsError.ThrowExceptionForHR(hr);

            hr = graphBuilder.RenderFile(@"..\..\..\Resources\foo.avi", null);
            DsError.ThrowExceptionForHR(hr);
        }
Esempio n. 3
0
        public void InitVMR9(string filename)
        {
            int hr = 0;

            // Create a DirectShow FilterGraph
            graphBuilder = (IFilterGraph2) new FilterGraph();

            // Add it in ROT for debug purpose
            rot = new DsROTEntry(graphBuilder);

            // Add a notification handler (see WndProc)
            hr = (graphBuilder as IMediaEventEx).SetNotifyWindow(this.Handle, WM_GRAPHNOTIFY, IntPtr.Zero);
            DsError.ThrowExceptionForHR(hr);

            // Create a VMR9 object
            vmr9 = (IBaseFilter) new VideoMixingRenderer9();

            IVMRFilterConfig9 filterConfig = (IVMRFilterConfig9)vmr9;

            // We want the Renderless mode!
            hr = filterConfig.SetRenderingMode(VMR9Mode.Renderless);
            DsError.ThrowExceptionForHR(hr);

            // One stream is enough for this sample
            hr = filterConfig.SetNumberOfStreams(1);
            DsError.ThrowExceptionForHR(hr);

            // Create the Allocator / Presenter object
            allocator = new Allocator(device);

            IVMRSurfaceAllocatorNotify9 vmrSurfAllocNotify = (IVMRSurfaceAllocatorNotify9)vmr9;

            // Notify the VMR9 filter about our allocator
            hr = vmrSurfAllocNotify.AdviseSurfaceAllocator(IntPtr.Zero, allocator);
            DsError.ThrowExceptionForHR(hr);

            // Notify our allocator about the VMR9 filter
            hr = allocator.AdviseNotify(vmrSurfAllocNotify);
            DsError.ThrowExceptionForHR(hr);

            IVMRMixerControl9 mixerControl = (IVMRMixerControl9)vmr9;

            // Select the mixer mode : YUV or RGB
            hr = mixerControl.SetMixingPrefs(VMR9MixerPrefs.RenderTargetYUV | VMR9MixerPrefs.NoDecimation | VMR9MixerPrefs.ARAdjustXorY | VMR9MixerPrefs.BiLinearFiltering);
            //hr = mixerControl.SetMixingPrefs(VMR9MixerPrefs.RenderTargetRGB | VMR9MixerPrefs.NoDecimation | VMR9MixerPrefs.ARAdjustXorY | VMR9MixerPrefs.BiLinearFiltering);
            DsError.ThrowExceptionForHR(hr);

            // Add the filter to the graph
            hr = graphBuilder.AddFilter(vmr9, "Video Mixing Renderer 9");
            DsError.ThrowExceptionForHR(hr);

            // Render the file
            hr = graphBuilder.RenderFile(filename, null);
            DsError.ThrowExceptionForHR(hr);

            // Run the graph
            hr = (graphBuilder as IMediaControl).Run();
            DsError.ThrowExceptionForHR(hr);
        }
Esempio n. 4
0
        /// <summary>
        /// The AdviseNotify method provides the allocator-presenter with the VMR-9 filter's
        /// interface for notification callbacks. If you are using a custom allocator-presenter,
        /// the application must call this method on the allocator-presenter, with a pointer to
        /// the VMR's IVMRSurfaceAllocatorNotify9 interface. The allocator-presenter uses this
        /// interface to communicate with the VMR.
        /// </summary>
        /// <param name="lpIVMRSurfAllocNotify">
        /// Specifies the IVMRSurfaceAllocatorNotify9 interface that the allocator-presenter will
        /// use to pass notifications back to the VMR.</param>
        /// <returns>Returns an HRESULT value</returns>
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock (_staticLock)
            {
                _allocatorNotify = lpIVMRSurfAllocNotify;

                return(_allocatorNotify.SetD3DDevice(GetComPointer(_device), GetAdapterMonitor(0)));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// The AdviseNotify method provides the allocator-presenter with the VMR-9 filter's
        /// interface for notification callbacks. If you are using a custom allocator-presenter,
        /// the application must call this method on the allocator-presenter, with a pointer to
        /// the VMR's IVMRSurfaceAllocatorNotify9 interface. The allocator-presenter uses this
        /// interface to communicate with the VMR.
        /// </summary>
        /// <param name="lpIVMRSurfAllocNotify">
        /// Specifies the IVMRSurfaceAllocatorNotify9 interface that the allocator-presenter will
        /// use to pass notifications back to the VMR.</param>
        /// <returns>Returns an HRESULT value</returns>
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock (m_staticLock)
            {
                m_allocatorNotify = lpIVMRSurfAllocNotify;

                var pMonitor = GetAdapterMonitor(0);
                var pDevice  = GetComPointer(m_device);
                return(m_allocatorNotify.SetD3DDevice(pDevice, pMonitor));
            }
        }
Esempio n. 6
0
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock(this)
            {
                vmrSurfaceAllocatorNotify = lpIVMRSurfAllocNotify;

                IntPtr unmanagedDevice = device.GetObjectByValue(DxMagicNumber);
                IntPtr hMonitor = Manager.GetAdapterMonitor(Manager.Adapters.Default.Adapter);

                return vmrSurfaceAllocatorNotify.SetD3DDevice(unmanagedDevice, hMonitor);
            }
        }
Esempio n. 7
0
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock (this)
            {
                vmrSurfaceAllocatorNotify = lpIVMRSurfAllocNotify;

                IntPtr unmanagedDevice = OpenSebJ.eRender.device.GetObjectByValue(DxMagicNumber);
                IntPtr hMonitor        = Manager.GetAdapterMonitor(Manager.Adapters.Default.Adapter);

                return(vmrSurfaceAllocatorNotify.SetD3DDevice(unmanagedDevice, hMonitor));
            }
        }
Esempio n. 8
0
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock (this)
            {
                vmrSurfaceAllocatorNotify = lpIVMRSurfAllocNotify;

                // Give our Direct3D device to the VMR9 filter
                IntPtr unmanagedDevice = device.GetObjectByValue(DxMagicNumber);
                IntPtr hMonitor        = Manager.GetAdapterMonitor(Manager.Adapters.Default.Adapter);

                return(vmrSurfaceAllocatorNotify.SetD3DDevice(unmanagedDevice, hMonitor));
            }
        }
Esempio n. 9
0
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock (this)
            {
                vmrSurfaceAllocatorNotify = lpIVMRSurfAllocNotify;

                // Give our Direct3D device to the VMR9 filter
                IntPtr unmanagedDevice = device.ComPointer;
                IntPtr hMonitor        = D3D.GetAdapterMonitor(D3D.Adapters.DefaultAdapter.Adapter);

                return(vmrSurfaceAllocatorNotify.SetD3DDevice(unmanagedDevice, hMonitor));
            }
        }
Esempio n. 10
0
 protected override HRESULT OnCloseInterfaces()
 {
     if (m_Renderer)
     {
         m_Renderer.Dispose();
         m_Renderer = null;
     }
     if (m_lpIVMRSurfAllocNotify != null)
     {
         Marshal.ReleaseComObject(m_lpIVMRSurfAllocNotify);
         m_lpIVMRSurfAllocNotify = null;
     }
     return(base.OnCloseInterfaces());
 }
Esempio n. 11
0
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock (m_csLock)
            {
                m_lpIVMRSurfAllocNotify = lpIVMRSurfAllocNotify;

                if (m_lpIVMRSurfAllocNotify != null)
                {
                    IntPtr  hMonitor = m_Device.Direct3D.GetAdapterMonitor(m_Device.CreationParameters.AdapterOrdinal);
                    HRESULT hr       = (HRESULT)m_lpIVMRSurfAllocNotify.SetD3DDevice(m_Device.ComPointer, hMonitor);
                    hr.Assert();
                    return(hr);
                }
            }
            return(NOERROR);
        }
Esempio n. 12
0
        private void SetAllocatorPresenter()
        {
            int hr = 0;

            IVMRSurfaceAllocatorNotify9 vmrSurfAllocNotify = (IVMRSurfaceAllocatorNotify9)filter;

            try
            {
                allocator = new Allocator(this);

                hr = vmrSurfAllocNotify.AdviseSurfaceAllocator(userId, allocator);
                DsError.ThrowExceptionForHR(hr);

                hr = allocator.AdviseNotify(vmrSurfAllocNotify);
                DsError.ThrowExceptionForHR(hr);
            }
            catch
            {
                allocator = null;
                throw;
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Part of the dispose pattern
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            //if (m_disposed) return;

            if (disposing)
            {
                InvokeNewSurfaceEvent(IntPtr.Zero);
                /* Pass a dummy cookie to TerminateDevice */
                TerminateDevice(IntPtr.Zero);

                if (m_allocatorNotify != null)
                {
                    Marshal.FinalReleaseComObject(m_allocatorNotify);
                    m_allocatorNotify = null;
                }

                if (m_d3d != null)
                {
                    Marshal.FinalReleaseComObject(m_d3d);
                    m_d3d = null;
                }

                if (m_d3dEx != null)
                {
                    Marshal.FinalReleaseComObject(m_d3dEx);
                    m_d3dEx = null;
                }

                if (m_device != null)
                {
                    Marshal.FinalReleaseComObject(m_device);
                    m_device = null;
                }
            }

            m_disposed = true;
        }
Esempio n. 14
0
 public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
 {
     _surfAllocatorNotify = lpIVMRSurfAllocNotify;
     return _surfAllocatorNotify.SetD3DDevice(_d3Device.NativePointer, _d3d.Adapters[0].Monitor);
 }
Esempio n. 15
0
        /// <summary>
        /// The AdviseNotify method provides the allocator-presenter with the VMR-9 filter's 
        /// interface for notification callbacks. If you are using a custom allocator-presenter, 
        /// the application must call this method on the allocator-presenter, with a pointer to 
        /// the VMR's IVMRSurfaceAllocatorNotify9 interface. The allocator-presenter uses this 
        /// interface to communicate with the VMR. 
        /// </summary>
        /// <param name="lpIVMRSurfAllocNotify">
        /// Specifies the IVMRSurfaceAllocatorNotify9 interface that the allocator-presenter will 
        /// use to pass notifications back to the VMR.</param>
        /// <returns>Returns an HRESULT value</returns>
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock (m_staticLock)
            {
                m_allocatorNotify = lpIVMRSurfAllocNotify;

                var pMonitor = GetAdapterMonitor(0);
                var pDevice = GetComPointer(m_device);
                return m_allocatorNotify.SetD3DDevice(pDevice, pMonitor);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Part of the dispose pattern
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            //if (m_disposed) return;

            if (disposing)
            {
                InvokeNewSurfaceEvent(IntPtr.Zero);
                /* Pass a dummy cookie to TerminateDevice */
                TerminateDevice(IntPtr.Zero);
               
                if (m_allocatorNotify != null)
                {
                    Marshal.FinalReleaseComObject(m_allocatorNotify);
                    m_allocatorNotify = null;
                }

                if (m_d3d != null)
                {
                    Marshal.FinalReleaseComObject(m_d3d);
                    m_d3d = null;
                }

                if (m_d3dEx != null)
                {
                    Marshal.FinalReleaseComObject(m_d3dEx);
                    m_d3dEx = null;
                }

                if (m_device != null)
                {
                    Marshal.FinalReleaseComObject(m_device);
                    m_device = null;
                }
            }

            m_disposed = true;
        }
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock (this)
            {
                vmrSurfaceAllocatorNotify = lpIVMRSurfAllocNotify;

                // Give our Direct3D device to the VMR9 filter
                IDirect3DDevice9 *unmanagedDevice = device.UnmanagedComPointer;
                IntPtr hMonitor = D3D.Manager.GetAdapterMonitor(D3D.Manager.Adapters.Default.Adapter);

                return vmrSurfaceAllocatorNotify.SetD3DDevice((IntPtr)unmanagedDevice, hMonitor);
            }
        }
Esempio n. 18
0
 protected override HRESULT OnCloseInterfaces()
 {
     if (m_Renderer)
     {
         m_Renderer.Dispose();
         m_Renderer = null;
     }
     if (m_lpIVMRSurfAllocNotify != null)
     {
         Marshal.ReleaseComObject(m_lpIVMRSurfAllocNotify);
         m_lpIVMRSurfAllocNotify = null;
     }
     return base.OnCloseInterfaces();
 }
Esempio n. 19
0
        public int AdviseNotify(IVMRSurfaceAllocatorNotify9 lpIVMRSurfAllocNotify)
        {
            lock (m_csLock)
            {
                m_lpIVMRSurfAllocNotify = lpIVMRSurfAllocNotify;

                if (m_lpIVMRSurfAllocNotify != null)
                {
                    IntPtr hMonitor = m_Device.Direct3D.GetAdapterMonitor(m_Device.CreationParameters.AdapterOrdinal);
                    HRESULT hr = (HRESULT)m_lpIVMRSurfAllocNotify.SetD3DDevice(m_Device.ComPointer, hMonitor);
                    hr.Assert();
                    return hr;
                }
            }
            return NOERROR;
        }
Esempio n. 20
0
        protected override HRESULT OnInitInterfaces()
        {
            m_Renderer             = new VMR9Renderer();
            m_Renderer.FilterGraph = m_GraphBuilder;
            IVMRFilterConfig9 _config = (IVMRFilterConfig9)m_Renderer.QueryInterface(typeof(IVMRFilterConfig9).GUID);
            HRESULT           hr;

            if (_config != null)
            {
                hr = (HRESULT)_config.SetRenderingMode(VMR9Mode.Renderless);
                hr.Assert();
                hr = (HRESULT)_config.SetNumberOfStreams(2);
                hr.Assert();
            }

            m_mixerControl = (IVMRMixerControl9)m_Renderer.QueryInterface(typeof(IVMRMixerControl9).GUID);

            m_mixerControl.SetBackgroundClr((int)0xbf7f2f);

            VMR9MixerPrefs mixerPrefs;

            m_mixerControl.GetMixingPrefs(out mixerPrefs);
            m_mixerControl.SetMixingPrefs(mixerPrefs);

            IVMRSurfaceAllocatorNotify9 _notify = (IVMRSurfaceAllocatorNotify9)m_Renderer.QueryInterface(typeof(IVMRSurfaceAllocatorNotify9).GUID);

            if (_notify != null)
            {
                hr = (HRESULT)_notify.AdviseSurfaceAllocator(new IntPtr(g_ciUsedID), this);
                hr.Assert();
                hr = (HRESULT)this.AdviseNotify(_notify);
                hr.Assert();
            }

            DSVideoCaptureCategory captureCategory = new DSVideoCaptureCategory();
            List <DSFilter>        capFilters      = new List <DSFilter>();

            foreach (var captureDevice in captureCategory.Objects)
            {
                if (captureDevice.DevicePath == m_leftEyeDevicePath)
                {
                    capFilters.Add(captureDevice.Filter);
                    break;
                }
            }

            foreach (var captureDevice in captureCategory.Objects)
            {
                if (captureDevice.DevicePath == m_rightEyeDevicePath)
                {
                    capFilters.Add(captureDevice.Filter);
                    break;
                }
            }

            if (capFilters.Count < 2)
            {
                MessageBox.Show("Not enough capture devices found (" + capFilters.Count.ToString() + " device(s))");
                throw new Exception();
            }


            for (int i = 0; i < 2; i++)
            {
                if (capFilters[i] == null)
                {
                    return(E_FAIL);
                }

                DSPin capturePin = null;

                foreach (var outputPin in capFilters[i].Output)
                {
                    if (outputPin.Name == "Capture")
                    {
                        capturePin = outputPin;
                        break;
                    }
                }

                AMMediaType mjpgMediaType = null;

                int maxPixels = -1;
                foreach (var mediaType in capturePin.MediaTypes)
                {
                    VideoInfoHeader videoInfo = new VideoInfoHeader();
                    videoInfo = (VideoInfoHeader)Marshal.PtrToStructure(mediaType.formatPtr, typeof(VideoInfoHeader));

                    // pick the highest res mode...
                    if ((videoInfo.BmiHeader.Width * videoInfo.BmiHeader.Height) > maxPixels)
                    {
                        maxPixels     = videoInfo.BmiHeader.Width * videoInfo.BmiHeader.Height;
                        mjpgMediaType = mediaType;
                        //break;
                    }
                }

                capFilters[i].OutputPin.Format = mjpgMediaType;

                capFilters[i].FilterGraph = m_GraphBuilder;
                capFilters[i].Connect(m_Renderer);
            }


            VMR9NormalizedRect r1 = new VMR9NormalizedRect(0, 0, 0.5f, 1f);
            VMR9NormalizedRect r2 = new VMR9NormalizedRect(0.5f, 0f, 1f, 1f);

            int rt0 = m_mixerControl.SetOutputRect(0, ref r1);
            int rt1 = m_mixerControl.SetOutputRect(1, ref r2);

            hr = base.OnInitInterfaces();

            return(hr);
        }
Esempio n. 21
0
        /// <summary> build the capture graph for grabber. </summary>
        bool SetupGraph()
        {
            int  hr;
            IPin pin1, pin2;

            try
            {
                hr = capGraph.SetFiltergraph(graphBuilder);
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                if (atiTVCardFound)
                {
                    SetupVideoCrossbar();
                    AddFilter(atiCrossbar, "ATI Crossbar");
                    AddFilter(capFilter, "Analog Capture Device");
                    AddFilter(wmVideoDecoder, "AVI Decompressor");
                    AddFilter(stretchVideo, "Stretch Video");
                    AddFilter(colorConverter, "Color Space Converter");
                }
                else if (videoSource.Equals("File"))
                {
                    graphBuilder.AddSourceFilter(filePath, "WM ASF Reader", out capFilter);
                    AddFilter(modFrameRate, "Modify Frame Rate");
                    AddFilter(stretchVideo, "Stretch Video");
                    AddFilter(colorConverter, "Color Space Converter");
                }
                else
                {
                    int state;
                    if (capFilter.GetState(100, out state) == 0)
                    {
                        AddFilter(capFilter, "Capture Filter");
                    }
                }

                AddFilter(sampleGrabber, "Sample Grabber"); // make sure samples grabbed have 32 bits per pixel to work with Ge Force 7900

                AddFilter(baseGrabFlt, "Vector Grabber");
                AddFilter(motionVector, "Motion Flow Vector Filter");

                if (videoPreview)
                {
                    AddFilter(teeSplitter, "Smart Tee Splitter");
                    AddFilter(colorConverter, "Color Space Converter");
                    AddFilter(videoRenderer, "Video Renderer");
                }

#if false // Attempt to use VMR9 abandoned for now
                IVMRFilterConfig9 vmrConfig = videoRenderer as IVMRFilterConfig9;
                hr = vmrConfig.SetRenderingMode(VMR9Mode.Renderless);
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
                IVMRSurfaceAllocatorNotify9 vmrAllocNotify = videoRenderer as IVMRSurfaceAllocatorNotify9;
                vmrAllocNotify.AdviseSurfaceAllocator(userID, vmrAllocator);
                vmrAllocator.AdviseNotify(vmrAllocNotify);
#endif

                // connect the pins
                if (videoSource.Equals("File"))
                {
                    ConnectPins(capFilter, "Raw Video 1", modFrameRate, "In");
                    ConnectPins(modFrameRate, "Out", stretchVideo, "In");
                    //ConnectPins(wmVideoDecoder, "out0", stretchVideo, "In");
                    ConnectPins(stretchVideo, "Out", colorConverter, "In");
                    ConnectPins(colorConverter, "Out", sampleGrabber, "In");
                }
                else
                {
                    if (atiTVCardFound)
                    {
                        ConnectPins(atiCrossbar, "0: Video Decoder Out", capFilter, "0");
                        ConnectPins(capFilter, "2", wmVideoDecoder, "In");
                        ConnectPins(wmVideoDecoder, "Out", stretchVideo, "In");
                        ConnectPins(stretchVideo, "Out", colorConverter, "In");
                        ConnectPins(colorConverter, "Out", sampleGrabber, "In");
                    }
                    else // webcam case
                    {
                        //ConnectPins(capFilter, "CapturePin", stretchVideo, "In");
                        ConnectPins(capFilter, "CapturePin", sampleGrabber, "In");
                    }
                }


                if (videoPreview)
                {
                    ConnectPins(sampleGrabber, "Out", teeSplitter, "Input");
                    //ConnectPins(teeSplitter, "0", videoRenderer, "In");
                    ConnectPins(teeSplitter, "Preview", colorConverter, "In");
                    ConnectPins(colorConverter, "Out", videoRenderer, "VMR Input0");
                    ConnectPins(teeSplitter, "Capture", motionVector, "In");
                }
                else
                {
                    ConnectPins(sampleGrabber, "Out", motionVector, "In");
                }
                ConnectPins(motionVector, "Out", baseGrabFlt, "In");

                // check that all filters are accounted for
                // there must be a total of 7 filters if source is "File"
                IEnumFilters enumFilters;
                graphBuilder.EnumFilters(out enumFilters);
                enumFilters.Reset();
                IBaseFilter[] filters = new IBaseFilter[1];
                int           count   = 0;
                int           total   = 0;
                while (0 == (hr = enumFilters.Next(1, filters, out count)))
                {
                    FilterInfo info = new FilterInfo();
                    hr = filters[0].QueryFilterInfo(info);
                    if (hr < 0)
                    {
                        Marshal.ThrowExceptionForHR(hr);
                    }
                    LogInfo(LogGroups.Console, info.achName);
                    IPin[]    pins = new IPin[1];
                    IEnumPins enumPins;
                    filters[0].EnumPins(out enumPins);
                    while (0 == (hr = enumPins.Next(1, pins, out count)))
                    {
                        IPin pin;
                        hr = pins[0].ConnectedTo(out pin);
                        if (pin != null)
                        {
                            string pinID;
                            hr = pin.QueryId(out pinID);
                            LogInfo(LogGroups.Console, pinID);
                        }
                    }
                    Marshal.ReleaseComObject(filters[0]);
                    total++;
                }
                Marshal.ReleaseComObject(enumFilters);

                SetupVideoGrabber();

                SetupVectorGrabber();

                return(true);
            }
            catch (Exception ee)
            {
                LogInfo(LogGroups.Console, "Could not setup graph\r\n" + ee.Message);
                return(false);
            }
        }