/// <summary> /// Disconnect and remove all filters except the device /// and compressor filters. This is the opposite of /// renderGraph(). Soem properties such as FrameRate /// can only be set when the device output pins are not /// connected. /// </summary> protected void DerenderGraph() { // Stop the graph if it is running (ignore errors) MediaControl?.Stop(); // Free the preview window (ignore errors) if (VideoWindow != null) { VideoWindow.put_Visible(CoreStreaming.DsHlp.OAFALSE); VideoWindow.put_Owner(IntPtr.Zero); VideoWindow = null; } // Remove the Resize event handler if (PreviewWindow != null) { PreviewWindow.SizeChanged -= OnPreviewWindowResize; } if ((int)ActualGraphState >= (int)GraphState.Rendered) { // Update the state ActualGraphState = GraphState.Created; IsPreviewRendered = false; // Disconnect all filters downstream of the // video and audio devices. If we have a compressor // then disconnect it, but don't remove it if (VideoDeviceFilter != null) { RemoveDownstream(VideoDeviceFilter, VideoCompressor == null); } } }