How do I make a webcam filter instead of a video file in directshow?

How do I make a webcam filter instead of a video file? I am looking at the vmr9compositor example included in the directshow sdk. It displays a video file. I would like to stream from a webcam. This is SEEMS as it should be possible, but I am not very good at directshow.

He is using this method call currently:

hr = g_graph->RenderFile( pFileName, NULL );

      

Have a look at an example playcap in sdk that can display the webcam feed in the window, I can see it is using

hr = g_pCapture->RenderStream (&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pSrcFilter, NULL, NULL));

      

to display the webcam stream. pSrcFilter is an IBaseFilter.

How can I change the video file in vmr app using webcam?

Windows XP, Visual Studio 2008 C ++

+2


a source to share


2 answers


List your webcam (video capture) sources and create an original filter using the methods described here:

http://msdn.microsoft.com/en-us/library/dd377566%28v=VS.85%29.aspx



From there, you just connect it as a source filter to your graph.

More details here about video capture with DShow here. http://msdn.microsoft.com/en-us/library/dd407331%28v=VS.85%29.aspx

+2


a source


I don't quite understand what the playout sample does not. RenderFile is equivalent to calling AddSourceFilter and then enumerating each output of the output (using IEnumPins) and rendering each output. RenderStream is a wrapper that finds a pin and then renders it. So what the playback sample does to insert the original filter (from the capture scroll) and then render it (using a RenderStream) is the realtime equivalent of a RenderFile.



0


a source







All Articles