问题描述
问题是构建一个支持三种状态的捕获图:
- 仅预览
- 仅捕获到AVI文件
- 组合
我已经像这样构建了图表:
这个图表对应于状态3.现在,如果我想改变状态2我删除预览流,并得到像这样的图:
想象一下,我运行图并开始捕获。现在我想回到状态3.我怎样才能做到这一点(添加预览流)而不停止图形? (捕获应继续)。
UPD。也许它有可能捕捉到AVI文件的末尾?如果是这样,我可以停止状态2的图形,向它添加一个预览流(更改为状态3)并继续捕获到现有AVI文件(在上一步中生成)的结尾。可能吗?
UPD2。我发现了一些黑客。当我想从状态3改变状态2时,我只隐藏一个预览窗口。当我想回到状态3时,我显示一个预览窗口。因此,我不再需要状态2,因为状态2只是隐藏预览窗口的状态3!即使存在(另见),在大多数情况下它几乎没有用处:
您使用的筛选器很可能与动态重新连接不兼容,或者限制扩展性。您可能有其他原因不使用此方法,例如如果您在动态操作过程中无法承受延迟和丢失数据。
典型的解决方案包含两个图表:实况(捕捉,预览演示)和录制。您可以在两者之间传递数据以使工作同步。您可能需要阅读图形桥接和。
有关此主题的相关问题您可能还需要阅读:
The problem is to build a capture graph supported three states:
- Preview only
- Capture to AVI-file only
- Combine
I have built the graph like this:
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:
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!
Even though Dynamic Graph Building exists (see also Dynamic Reconnection), in most cases it is of little use:
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:
- Directshow Preview Only and Capture & Preview with a single Graph
- DirectShow capturing to multiple files
- change recording file programmatically in directshow
这篇关于如何在不停止的情况下将预览流添加到图形中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!