/// <summary> /// Connects pins of graph /// </summary> private void GraphBuilding_ConnectPins() { // Pins used in graph IPin pinSourceCapture = null; IPin pinSampleGrabberInput = null; int hr = 0; try { // Collect pins //pinSourceCapture = DsFindPin.ByCategory(DX.CaptureFilter, PinCategory.Capture, 0); pinSourceCapture = DsFindPin.ByDirection(DX.CaptureFilter, PinDirection.Output, 0); pinSampleGrabberInput = DsFindPin.ByDirection(DX.SampleGrabberFilter, PinDirection.Input, 0); // Connect source to tee splitter hr = DX.FilterGraph.Connect(pinSourceCapture, pinSampleGrabberInput); DsError.ThrowExceptionForHR(hr); } catch { throw; } finally { CameraHelpers.SafeReleaseComObject(pinSourceCapture); pinSourceCapture = null; CameraHelpers.SafeReleaseComObject(pinSampleGrabberInput); pinSampleGrabberInput = null; } }
/// <summary> /// Displays property page for filter's pin output. /// </summary> /// <param name="hwndOwner">The window handler for to make it parent of property page.</param> public void DisplayPropertyPage_SourcePinOutput(IntPtr hwndOwner) { IPin pinSourceCapture = null; try { pinSourceCapture = DsFindPin.ByDirection(DX.CaptureFilter, PinDirection.Output, 0); CameraHelpers.DisplayPropertyPagePin(pinSourceCapture, hwndOwner); } catch (Exception) { throw; } finally { CameraHelpers.SafeReleaseComObject(pinSourceCapture); pinSourceCapture = null; } }
// ==================================================================== #region Graph building stuff /// <summary> /// Sets the Framerate, and video size. /// </summary> private void GraphBuilding_SetSourceParams() { // Pins used in graph IPin pinSourceCapture = null; try { // Collect pins //pinSourceCapture = DsFindPin.ByCategory(DX.CaptureFilter, PinCategory.Capture, 0); pinSourceCapture = DsFindPin.ByDirection(DX.CaptureFilter, PinDirection.Output, 0); CameraHelpers.SetSourceParams(pinSourceCapture, _Resolution); } catch { throw; } finally { CameraHelpers.SafeReleaseComObject(pinSourceCapture); pinSourceCapture = null; } }