private VideoInput GetCurrentCrossbarInput( IAMCrossbar crossbar )
{
VideoInput videoInput = VideoInput.Default;
int inPinsCount, outPinsCount;
// gen number of pins in the crossbar
if ( crossbar.get_PinCounts( out outPinsCount, out inPinsCount ) == 0 )
{
int videoOutputPinIndex = -1;
int pinIndexRelated;
PhysicalConnectorType type;
// find index of the video output pin
for ( int i = 0; i < outPinsCount; i++ )
{
if ( crossbar.get_CrossbarPinInfo( false, i, out pinIndexRelated, out type ) != 0 )
continue;
if ( type == PhysicalConnectorType.VideoDecoder )
{
videoOutputPinIndex = i;
break;
}
}
if ( videoOutputPinIndex != -1 )
{
int videoInputPinIndex;
// get index of the input pin connected to the output
if ( crossbar.get_IsRoutedTo( videoOutputPinIndex, out videoInputPinIndex ) == 0 )
{
PhysicalConnectorType inputType;
crossbar.get_CrossbarPinInfo( true, videoInputPinIndex, out pinIndexRelated, out inputType );
videoInput = new VideoInput( videoInputPinIndex, inputType );
}
}
}
return videoInput;
}