/// <summary> /// Releases the capture device /// </summary> private void Release() { // Stop the thread _worker = null; // Clear the event if (_stopSignal != null) { _stopSignal.Close(); _stopSignal = null; } if (_graph != null) { _graph.Abort(); _graph.Disconnect(_sourceObject.GetPin(PinDirection.Output, 0)); _graph.Disconnect(_grabberObject.GetPin(PinDirection.Input, 0)); _graph.RemoveFilter(_sourceObject); _graph.RemoveFilter(_grabberObject); } // Clean up _graph = null; _sourceObject = null; _grabberObject = null; _grabber = null; _capGrabber = null; _control = null; }
public void Abort() { lock (_graphStateLock) { if (_graphBuilder != null) { _graphBuilder.Abort(); } } }
/// <summary> /// Attempts to abort the graph /// </summary> public virtual void Abort() { #if DEBUG_SHOW_STATECALLS Debug.WriteLine(this.GetType().ToString() + ".Abort()"); #endif lock (graphStateLock) { if (graph != null) { graph.Abort(); } } }
private void DisposeGraph() { if (mediaEvent != null) { mediaEvent.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero); mediaEvent = null; } if (mediaSeeking != null) { mediaSeeking = null; } if (mediaControl != null) { mediaControl.Stop(); mediaControl = null; } if (graphBuilder != null) { graphBuilder.Abort(); int a = Marshal.ReleaseComObject(graphBuilder); graphBuilder = null; } }