A few days ago I started prototyping an application which required the computer to see thuru a webcam. To do that, I had to go with DirectShow. Yeah, it isn't part of DirectX really, but I suspect this forum is the closest to Windows.
I read the documentation for a few days and worked on the code to produce essentially a blank screen with camera output, as well as experimenting a bit with GraphEdit.
At the end of yesterday, everything essentially boiled down to
HRESULT res = captureBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video,
source, NULL, renderer);
This greeted me with a nice capture. I hoped I could start immediately working at how to process the data, instead I had to turn me back at the horror of a capture getting stuck. It simply stopped acquiring with no apparent reason after a few seconds. I investigated the possibility of the graph somehow getting paused/stopped, I tried restarting it, I investigated other DirectShow events using IMediaControl with no success. I then looked at the DShow examples and found the way to let GraphEdit connect to my graph. Very neat stuff.
It turns out that the graph generated by the above call is somewhat different from what I get when I try to connect the two pins in GraphEdit, with a
Smart Tee filter being added immediately after the webcam, with its Preview pin connected to fetch Video Decoder's input pin.
For first,
I do not understand why having more information can be troublesome, but I just asked for the PREVIEW pin as above since this is what PREVIEW pins are for right?
Anyway, the graph failed to deliver even in GraphEdit.
Playing with it a bit, I tried using the CAPTURE pin instead and everything seemed to work. So, I went back to my program and changed to
HRESULT res = captureBuilder->RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,
source, NULL, renderer);
This just did it. Now everything seems to be almost ok.
What's wrong with PREVIEW pins? Can someone share some experiences about them and the Smart Tee filter? Can someone reproduce the issue systems?