How do i render a web cam filter instead of video file in directshow?
How do i render a web cam filter instead of video file? I am looking at the vmr9compositor example included in the directshow sdk. It renders a video file. I would like to stream in the feed from the webcam. It SEEMS like this should be possible, but I dont have much of a grasp on directshow.
It uses this method call currently:
hr = g_graph->RenderFile( pFileName, NULL );
Looking at the playcap example in the sdk which can display the web cam feed in a window, I see that it uses
hr = g_pCapture->RenderStream (&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pSrcFilter, NULL, NULL));
to display the web cam stream. pSrcFilter is an IBaseFilter.
How can I can swap the video file in the vmr app with the web cam feed?
Windows XP, V开发者_JS百科isual Studio 2008 C++
Enumerate the webcam (video capture) sources and create a source filter using the techniques explained here:
http://msdn.microsoft.com/en-us/library/dd377566%28v=VS.85%29.aspx
From there, you just connect it as a source filter into your graph.
More details here on video capture with DShow here. http://msdn.microsoft.com/en-us/library/dd407331%28v=VS.85%29.aspx
I don't really understand what the playcap sample is not doing. RenderFile is the equivalent of calling AddSourceFilter, and then enumerating each output pin (using IEnumPins) and rendering each pin. RenderStream is a wrapper that locates the pin and then renders it. So what the playcap sample does to insert a source filter (from the capture moniker) and then render it (using RenderStream) is the live-source equivalent of RenderFile.
精彩评论