private void Configure2()
        {
            int         hr;
            IBaseFilter pFilter;
            IBaseFilter ibf;

            ICaptureGraphBuilder2 icgb        = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
            IFilterGraph2         FilterGraph = (IFilterGraph2) new FilterGraph();
            DsROTEntry            ds          = new DsROTEntry(FilterGraph);

            hr = icgb.SetFiltergraph(FilterGraph);
            DsError.ThrowExceptionForHR(hr);

            hr = FilterGraph.AddSourceFilter(FileName, "foo", out pFilter);
            DsError.ThrowExceptionForHR(hr);

            hr = icgb.RenderStream(null, null, pFilter, null, null);
            DsError.ThrowExceptionForHR(hr);

            hr = FilterGraph.FindFilterByName("AVI Splitter", out ibf);
            DsError.ThrowExceptionForHR(hr);

            m_pPersist2 = (IPersistMediaPropertyBag)ibf;

            Marshal.ReleaseComObject(pFilter);
            Marshal.ReleaseComObject(icgb);
        }
        private void Configure()
        {
            // In order to lock a profile, you have to have at least one stream
            // connected to the sink. I connect a video thru the DVVideoEnc into
            // the StreamBufferSink.
            int             hr;
            IBaseFilter     pFilter;
            IBaseFilter     mux;
            IFileSinkFilter ifsf;
            EventCode       ec;

            ICaptureGraphBuilder2 icgb        = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
            IFilterGraph2         filterGraph = (IFilterGraph2) new FilterGraph();
            DsROTEntry            ds          = new DsROTEntry(filterGraph);

            hr = icgb.SetFiltergraph(filterGraph);
            DsError.ThrowExceptionForHR(hr);

            hr = filterGraph.AddSourceFilter("foo.avi", "foo", out pFilter);
            DsError.ThrowExceptionForHR(hr);

            hr = icgb.SetOutputFileName(MediaSubType.Avi, FileName, out mux, out ifsf);
            DsError.ThrowExceptionForHR(hr);

            hr = icgb.RenderStream(null, null, pFilter, null, mux);
            DsError.ThrowExceptionForHR(hr);

            IMediaPropertyBag impb = (IMediaPropertyBag) new MediaPropertyBag();

            Load(impb, "IART", Author);
            Load(impb, "ICOP", Copyright);
            Load(impb, "INAM", Title);

            IPersistMediaPropertyBag pPersist = (IPersistMediaPropertyBag)mux;

            hr = pPersist.Load(impb, null);
            DsError.ThrowExceptionForHR(hr);

            ((IMediaControl)filterGraph).Run();
            ((IMediaEvent)filterGraph).WaitForCompletion(-1, out ec);
            ((IMediaControl)filterGraph).Stop();

            Marshal.ReleaseComObject(pFilter);
            Marshal.ReleaseComObject(mux);
            Marshal.ReleaseComObject(filterGraph);
            Marshal.ReleaseComObject(ifsf);
            Marshal.ReleaseComObject(impb);
            Marshal.ReleaseComObject(icgb);
        }
        private void Configure()
        {
            int             hr;
            IBaseFilter     pFilter;
            IBaseFilter     mux;
            IFileSinkFilter ifsf;

            ICaptureGraphBuilder2 icgb        = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
            IFilterGraph2         filterGraph = (IFilterGraph2) new FilterGraph();
            DsROTEntry            ds          = new DsROTEntry(filterGraph);

            hr = icgb.SetFiltergraph(filterGraph);
            DsError.ThrowExceptionForHR(hr);

            hr = filterGraph.AddSourceFilter("foo.avi", "foo", out pFilter);
            DsError.ThrowExceptionForHR(hr);

            hr = icgb.SetOutputFileName(MediaSubType.Avi, FileName, out mux, out ifsf);
            DsError.ThrowExceptionForHR(hr);

            hr = icgb.RenderStream(null, null, pFilter, null, mux);
            DsError.ThrowExceptionForHR(hr);

            m_impb = (IMediaPropertyBag) new MediaPropertyBag();

            Load(m_impb, "IART", Author);
            Load(m_impb, "ICOP", Copyright);
            Load(m_impb, "INAM", Title);

            IPersistMediaPropertyBag pPersist = (IPersistMediaPropertyBag)mux;

            hr = pPersist.Load(m_impb, null);
            DsError.ThrowExceptionForHR(hr);

            Marshal.ReleaseComObject(pFilter);
            Marshal.ReleaseComObject(mux);
            Marshal.ReleaseComObject(filterGraph);
            Marshal.ReleaseComObject(ifsf);
            Marshal.ReleaseComObject(icgb);
        }