Click to See Complete Forum and Search --> : Connect two input pin to Smart Tee


Cooker
October 6th, 2005, 04:18 AM
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! :confused:

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

MikeR
October 16th, 2005, 01:03 PM
The smart tee is a strange component :

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.