1

我在wince设备上有一些过滤器连接(相机-> sampleGrabber(分析图像->渲染过滤器。

渲染需要很多时间,我真的不需要看到结果(仅在“调试”模式下。

如何在 sampleGrabber 过滤器之后“转储”流?

这是主要代码:

CHK( m_pCaptureGraphBuilder.CoCreateInstance( CLSID_CaptureGraphBuilder ));
CHK( pFilterGraph.CoCreateInstance( CLSID_FilterGraph ));
CHK( m_pCaptureGraphBuilder->SetFiltergraph( pFilterGraph ));

CHK( m_pVideoCaptureFilter.CoCreateInstance( CLSID_VideoCapture ));
CHK( m_pVideoCaptureFilter.QueryInterface( &pPropertyBag ));

CHK( GetFirstCameraDriver( wzDeviceName ));
CHK( PropBag.Write( L"VCapName", &varCamName ));   
CHK( pPropertyBag->Load( &PropBag, NULL ));
// Everything succeeded, now adding the video capture filter to the filtergraph
CHK( pFilterGraph->AddFilter( m_pVideoCaptureFilter, L"Video Capture Filter Source" ));

CHK( pGrabberFilter.CoCreateInstance( CLSID_CameraGrabber ));
CHK( pFilterGraph->AddFilter( pGrabberFilter, L"Sample Grabber" ));
CHK( pGrabberFilter->QueryInterface( &m_pSampleGrabber ));

// set callback method to the grabber
m_pSampleGrabber->SetCallback(&MYCALLBACK, 0);

CHK( pVideoRenderer.CoCreateInstance( CLSID_VideoRenderer ));
CHK( pFilterGraph->AddFilter( pVideoRenderer, L"VideoMixingRenderer" ));
CHK( m_pCaptureGraphBuilder->RenderStream( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, m_pVideoCaptureFilter, NULL, pVideoRenderer ));

有什么建议么?

4

1 回答 1

1

要停止渲染,您可以将您的 sampleGrabber 连接到nullRenderer,它会丢弃它收到的所有样本,并且不会减慢您的程序。

如果您想转储流而不显示它,那么您可以使用FileWriterFilter

于 2013-06-09T06:02:57.360 回答