views:

923

answers:

1

I've built the following graph in GraphEdit: Logitech Webcam -> Infinite Tee Pin Filter -> VideoRenderer. This works fine (with GraphEdit automatically inserting a few intermediate filters between the TEe filter and the VideoRenderer filter).

I've tried doing the same thing in code, and it fails when trying to connect the Tee filter to the VideoRenderer. I connect the webcam to the tee filter first, which works (the webcam turns on and I get S_OK), and then I attempt to connect the single output pin from the tee filter to the first, which fails (the error is that it could not find a set of intermediate filters to connect them). I've tried connecting them with both IGraphBuilder::Connect as well as ICaptureGraphBuilder2::RenderStream, with the same effect. To enumerate the pins, I use hr = _CaptureGraphBuilder.FindPin(theFilter, PinDirection.Input, null, null, true, 0, out thePin); for the video renderer, and the same except with PinDirection.Output for the Tee Filter (this is in C#, but the construct maps exactly to C++).

Any ideas?

+2  A: 

Found the problem. Apparently, the Webcam filter doesn't update its output media types correctly until the graph is started. So starting the graph, then restarting the graph once everything is done did the trick.