The problem is to build a capture graph supported three states:
I have built the g
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: