採集卡連攝像機選擇模擬輸入源

用AMCAP看,發現了兩個輸入源,默認的那個總是出不來數據,需要在DS採集模塊裏設置一下。

	IAMCrossbar *pXBar1 = NULL;
	hr = _dsInfo.GetCpatureGraphBuilder2Ptr()->FindInterface(&LOOK_UPSTREAM_ONLY, NULL,
		_captureFilter,IID_IAMCrossbar, (void**)&pXBar1);
	if(FAILED(hr))
	{
		WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
			"IAMCrossbar Failed to FindInterface.");
	}
	else
	{
		long OutputPinCount = 0;
		long InputPinCount = 0;
		long PinIndexRelated;
		long PhysicalType;
		long inPort = 0;
		long outPort = 0;
		pXBar1->get_PinCounts(&OutputPinCount,&InputPinCount);

		for(int i =0;i<InputPinCount;i++)
		{
			pXBar1->get_CrossbarPinInfo(TRUE,i,&PinIndexRelated,&PhysicalType);
			if(PhysConn_Video_Composite==PhysicalType)
			{
				inPort = i;
				break;
			}
		}
		for(int i =0;i<OutputPinCount;i++)
		{
			pXBar1->get_CrossbarPinInfo(FALSE,i,&PinIndexRelated,&PhysicalType);
			if(PhysConn_Video_VideoDecoder==PhysicalType) 
			{
				outPort = i;
				break;
			}
		}
		if(S_OK==pXBar1->CanRoute(outPort,inPort))
		{
			hr = pXBar1->Route(outPort,inPort);
		}
		WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, _id,
			"IAMCrossbar Route hr = %d.", hr);
	}
	SAFE_RELEASE(pXBar1);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章