简体   繁体   English

DirectShow:转储流

[英]DirectShow: dump the stream

I have some filters connection on wince device (camera -> sampleGrabber(which analyze the image ->rendering filter. 我在wince设备上有一些滤镜连接(相机-> sampleGrabber(用于分析图像->渲染滤镜。

The rendering takes a lot of time, and I don't really need to see the result (only on "debugging" mode. 渲染会花费很多时间,我真的不需要查看结果(仅在“调试”模式下)。

How can I "dump" the stream after the sampleGrabber filter? 如何在sampleGrabber过滤器之后“转储”流?

This is the main code: 这是主要代码:

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 ));

Any suggestions? 有什么建议么?

To stop rendering, you can connect your sampleGrabber to the nullRenderer which discards all the samples it receives and won't slow down your program. 要停止渲染,您可以将sampleGrabber连接到nullRenderer ,后者将丢弃它收到的所有样本,并且不会降低程序速度。

If you would like to dump stream without displaying it, then you can use the FileWriterFilter . 如果要转储流而不显示它,则可以使用FileWriterFilter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM