Hi,
I would like to capture live video, preview live video and grab live video.
But I find that the input pin of SampleGrab can't connect to the output Preview pin of Smart Tee.
Could someone tell me how to coonect between Smart Tee's Preview Pin and SampleGrab's input Pin ?
Thank you!
Code:
pFilterGraph->AddFilter(pSourceFilter,L"Source Filter");
pCaptureGraphBuilder->RenderStream(&PIN_CATEGORY_PREVIEW,&MEDIATYPE_Video,pSourceFilter,NULL,NULL);
pCaptureGraphBuilder->SetOutputFileName(&MEDIASUBTYPE_Avi,L"Example.avi",&pMux,NULL);
pCaptureGraphBuilder->RenderStream(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video,pSourceFilter,NULL,pMux);
// Setting of grabbing image
IBaseFilter *pSG_Filter;
IBaseFilter *pNull;
CoCreateInstance(CLSID_SampleGrabber,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**)&pSG_Filter);
pFilterGraph->AddFilter(pSG_Filter, L"SampleGrab");
CoCreateInstance(CLSID_NullRenderer,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**)&pNull);
pFilterGraph->AddFilter(pNull, L"NullRender");
// I get the FAILED
pCaptureGraphBuilder->RenderStream
(&PIN_CATEGORY_PREVIEW,&MEDIATYPE_Video,pSourceFilter,pSG_Filter,pNull);
SaveGraphFile(pFilterGraph, L"C:\\MyGraph.grf");
Last edited by Cooker; October 6th, 2005 at 04:21 AM.
The Smart Tee filter is used in video capture graphs to split the video stream into a preview stream and a capture stream. This is done without any additional data copying.
In other words, the smart tee does not allocate a sample for preview...
There is no extra sample travelling in the preview path, just a reference to the actual sample used by the capture path. This is why you cannot put the sample grabber there.
So I suggest that you insert the sample grabber in the capture path. This should not cause any problem.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.