public void BuildGraph()
        {
            int hr = 0;

            graphBuilder = (IFilterGraph2) new FilterGraph();

            rot = new DsROTEntry(graphBuilder);

            vmr = (IBaseFilter) new VideoMixingRenderer();

            IVMRFilterConfig filterConfig = (IVMRFilterConfig)vmr;

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

            // Set the custom compositor
            hr = filterConfig.SetImageCompositor(this);
            DsError.ThrowExceptionForHR(hr);

            IVMRMixerControl mixerControl = (IVMRMixerControl)vmr;

            // In COLORREF, colors are coded in ABGR format
            hr = mixerControl.SetBackgroundClr(backgroundColorABGR);
            DsError.ThrowExceptionForHR(hr);

            hr = graphBuilder.AddFilter(vmr, "VMR");
            DsError.ThrowExceptionForHR(hr);

            // The 2 VMR pins must be connected...
            hr = graphBuilder.RenderFile(@"..\..\..\Resources\foo.avi", null);
            DsError.ThrowExceptionForHR(hr);

            hr = graphBuilder.RenderFile(@"..\..\..\Resources\foo.avi", null);
            DsError.ThrowExceptionForHR(hr);

            hr = (graphBuilder as IMediaControl).Run();
            DsError.ThrowExceptionForHR(hr);
        }