|
HRESULT hResult = S_FALSE;
CComPtr pFileSink;
CComPtr pUnkCaptureFilter;
CComPtr pStillPin;
CComPtr pVideoControl;
if( m_pCaptureGraphBuilder == NULL ) //|| ( m_fGraphBuilt == FALSE ))
{
goto Cleanup;
}
CHK(m_pMediaControl->Stop());
//得到IFileSinkFilter接口
CHK( m_pImageSinkFilter.QueryInterface( &pFileSink ));
//设置抓拍保存的图象文件名
CHK( pFileSink->SetFileName( strFileName, NULL ));
//得到StillPin
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 )); |
|