user2004403
user2004403

Reputation: 233

DirectShow: dump the stream

I have some filters connection on wince device (camera -> sampleGrabber(which analyze the image ->rendering filter.

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?

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?

Upvotes: 1

Views: 926

Answers (1)

keelar
keelar

Reputation: 6026

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.

If you would like to dump stream without displaying it, then you can use the FileWriterFilter.

Upvotes: 1

Related Questions