1

The problem is to build a capture graph supported three states:

  1. Preview only
  2. Capture to AVI-file only
  3. Combine

I have built the graph like this:

enter image description here

This graph corresponds to state 3. Now, if I want to change on state 2 I remove the preview stream and get the graph like this:

enter image description here

Imagine I run the graph and start capture. Now I want to back to state 3. How can I do this (add a preview stream) without stopping the graph? (Capture should continue).

UPD. Maybe it will be possible to capture to the end of AVI-file? If so, I could stop the graph at state 2, add a preview stream to it (change to state 3) and continue capture to the end of exsisting AVI-file (generated on previous step). Is it possible?

UPD2. I found some hack. When I want to change on state 2 from state 3 I just hide a preview-window. When I want to back to state 3 I show a preview-window. Thus, I don't need state 2 anymore since state 2 is just state 3 with hided preview-window!

Community
  • 1
  • 1
gustav
  • 119
  • 13
  • Please upload your images in full size to http://imgur.com and post links to them e.g. to the comment. I couldn't find a way to get your images in larger size from the site where you've uploaded them. – TLama Feb 27 '14 at 13:31
  • 1
    Links to images have been changed – gustav Feb 28 '14 at 04:42

1 Answers1

3

Even though Dynamic Graph Building exists (see also Dynamic Reconnection), in most cases it is of little use:

In most DirectShow filters, pins cannot be reconnected while the graph is actively streaming data. The application must stop the graph before reconnecting the pins. However, some filters do support pin reconnections while the graph is running, a process known as dynamic reconnection.

Most likely the filters you are using would be incompatible with dynamic reconnection, or limiting extensibility. You might have other reasons to not use this approach, e.g. if you cannot afford delays and dropped data while dynamic operation is in progress.

The typical solution involves two graphs: live (capture, preview presentation) and recording. You pass data between the two to make the work in sync. You might want to read up of graph bridging and GMFBridge.

There are quite a few questions on this topic you might want to read as well:

Community
  • 1
  • 1
Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Most likely my capture filter does not support the IPinFlowControl interface, because QueryInterface puts NULL to the second parameter. – gustav Feb 28 '14 at 04:51
  • This is exactly what MSDN means by "cannot be reconnected". – Roman R. Feb 28 '14 at 06:51