protected void DerenderGraph()
{
// Stop the graph if it is running (ignore errors)
if (MediaControl != null)
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 -= new SizeChangedEventHandler(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));
}
}