public void RouteCrossbarPins(DirectShowLib.PhysicalConnectorType outputConnectorType, DirectShowLib.PhysicalConnectorType inputConnectorType) { int hr; if (_amCrossbar != null) { int i; int j; i = FindCrossbarPin(outputConnectorType, false); if (i != -1) { j = FindCrossbarPin(inputConnectorType, true); if (j != -1) { hr = _amCrossbar.Route(i, j); DsError.ThrowExceptionForHR(hr); } } } }
public int FindCrossbarPin(DirectShowLib.PhysicalConnectorType PhysicalType, bool bInput) { int hr; int cOut, cIn; hr = _amCrossbar.get_PinCounts(out cOut, out cIn); DsError.ThrowExceptionForHR(hr); // Enumerate pins and look for a matching pin. int count = (bInput ? cIn : cOut); for (int i = 0; i < count; i++) { int iRelated = 0; DirectShowLib.PhysicalConnectorType ThisPhysicalType = 0; hr = _amCrossbar.get_CrossbarPinInfo(bInput, i, out iRelated, out ThisPhysicalType); DsError.ThrowExceptionForHR(hr); if (ThisPhysicalType == (DirectShowLib.PhysicalConnectorType)PhysicalType) { return(i); } } return(-1); }