Beispiel #1
0
        private void RenderToNullRenderer(IDESCombineCB audioCallback, IDESCombineCB videoCallback)
        {
            int hr;

            ICaptureGraphBuilder2 icgb = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();

            try
            {
                hr = icgb.SetFiltergraph(_graph);
                DESError.ThrowExceptionForHR(hr);

                IBaseFilter audioDest = StandardFilters.RenderNull(_dc, _graph);
                IBaseFilter videoDest = StandardFilters.RenderNull(_dc, _graph);

                try
                {
                    RenderGroups(icgb, null, null, audioDest, videoDest, audioCallback, videoCallback);
                }
                finally
                {
                    if (audioDest != null)
                    {
                        Marshal.ReleaseComObject(audioDest);
                    }
                    if (videoDest != null)
                    {
                        Marshal.ReleaseComObject(videoDest);
                    }
                }
            }
            finally
            {
                Marshal.ReleaseComObject(icgb);
            }
        }
Beispiel #2
0
        private void RenderToNullRenderer(ICallbackParticipant[] audioParticipants,
                                          ICallbackParticipant[] videoParticipants)
        {
            int hr;

            var graphBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();

            try
            {
                hr = graphBuilder.SetFiltergraph(Graph);
                DESError.ThrowExceptionForHR(hr);

                IBaseFilter audioDest = StandardFilters.RenderNull(Cleanup, Graph);
                IBaseFilter videoDest = StandardFilters.RenderNull(Cleanup, Graph);

                try
                {
                    RenderGroups(graphBuilder, null, null, audioDest, videoDest, audioParticipants, videoParticipants);
                }
                finally
                {
                    if (audioDest != null)
                    {
                        Marshal.ReleaseComObject(audioDest);
                    }
                    if (videoDest != null)
                    {
                        Marshal.ReleaseComObject(videoDest);
                    }
                }

                DisableClock();
            }
            finally
            {
                Marshal.ReleaseComObject(graphBuilder);
            }
        }