|
我看 cameracapture的例子,没问题,也可以实现 实时监控,但是想用硬件来触发他,
使用这个参数来调用硬件 VideoControlFlag_ExternalTriggerEnable
程序可以编译成功,运行,不过只要一按拍照按钮,程序就推出了。。。
代码如下
CGraphManager::CaptureStillImageInternal()
{
HRESULT hr = S_OK;
CComPtr pFileSink;
CComPtr pUnkCaptureFilter;
CComPtr pStillPin;
CComPtr pVideoControl;
// Make sure that the capture graph builder is present
if(( m_pCaptureGraphBuilder == NULL ) || ( m_fGraphBuilt == FALSE ))
{
ERR( E_FAIL );
}
CHK( m_pImageSinkFilter.QueryInterface( &pFileSink ));
CHK( pFileSink->SetFileName( L"\\test.jpg", NULL ));
CHK( m_pVideoCaptureFilter.QueryInterface( &pUnkCaptureFilter ));
CHK( m_pCaptureGraphBuilder->FindPin( pUnkCaptureFilter, PINDIR_OUTPUT, &PIN_CATEGORY_STILL, &MEDIATYPE_Video, FALSE, 0, &pStillPin ));
CHK( m_pVideoCaptureFilter.QueryInterface( &pVideoControl ));
//CHK( pVideoControl->SetMode( pStillPin, VideoControlFlag_Trigger ));
CHK( pVideoControl->SetMode( pStillPin, VideoControlFlag_ExternalTriggerEnable )); |
|