带有 GMF GDCL MPEG 4 Mux 滤波器的 GMFBridge
我尝试将 GDCL MPEG 4 Mux 与 GMFBridge 一起使用。
我的原始图表是:
SourceFilter ---> GDCL MPEG 4 Mux Filter ---> FileWriter
我想根据我的特殊标准(例如时间,例如每五分钟)给出新文件名,但不想再次创建整个图表。所以我尝试使用 GMFBridge。
我不工作。我真的不知道如何使用 GMFBridge 或者它不起作用。
注意:这是我对 GMFBridge 所做的事情
为了使用,我将图形分为两部分:
FirstPart ==> SourceFilter---> GDCL MPEG 4 Mux Filter--> BridgeSinkFilter
和
SecondPart ==> BridgeSourceFilter ---> FileWriter
我的程序伪代码
IGraphBuilder firstPartGraph = (IGraphBuilder) new FilterGraph();
IGraphBuilder secondPartGraph = (IGraphBuilder) new FilterGraph();
IBaseFilter bridgeSinkFilter;
IBaseFilter bridgeSourceFilter;
IBaseFilter sourceFilter;
IBaseFilter muxerFilter;
IBaseFilter fileWriterFilter;
// Create bridge controller and init
IGMFBridgeController bridge = (IGMFBridgeController)new GMFBridgeController();
bridge.AddStream(true,eFormatType.MuxInputs, true);
// Then insert Sink filter
bridge.InsertSinkFilter(firstPartGraph, bridgeSinkFilter);
// Configure first part filters
firstPartGraph.AddFilter(sourceFilter);
firstPartGraph.AddFilter(muxerFilter);
firstPartGraph.AddFilter(bridgeSinkFilter); // Have to add this??
ConnectFilters(firstPartGraph,sourceFilter,muxerFilter);
ConnectFilters(firstPartGraph,muxerFilter,bridgeSinkFilter);
// Now add bridge sourceFilter
bridge.InsertSourceFilter(bridgeSinkFilter,secondPartGraph,bridgeSourceFilter);
// Then configure second part graph
secondPartGraph.AddFilter(bridgeSourceFilter); // Have to add this??
secondPartGraph.AddFilter(fileWriterFilter);
ConnectFilters(secondPartGraph,bridgeSourceFilter,fileWriterFilter);
// Now bridge two graphs
bridge.BridgeGraphs(bridgeSinkFilter,fileWriterFilter,bridgeSourceFilter);
// Execute both graphs
IMediaControl mediaControlForPartOne = (IMediaControl)firstPartGraph;
mediaControlForPartOne->Run();
IMediaControl mediaControlForPartSecond = (IMediaControl)secondPartGraph;
mediaControlForPartSecond->Run();
现在如何停止第二个图形部分并设置新文件名,然后重新连接使用桥接图?
修复它:
谢谢。
我只是改变了我的 grpg 部门,现在开始工作:
FirstPart ==> SourceFilter--> BridgeSinkFilter
SecondPart ==> BridgeSourceFilter ---> GDCL MPEG 4 Mux Filter---> FileWriter
I try to use GDCL MPEG 4 Mux with GMFBridge.
My original graph is:
SourceFilter ---> GDCL MPEG 4 Mux Filter ---> FileWriter
I want to give new file name based on my special criteria (such as time , for example every five minute) but not want to create whole graph again. So i try to use GMFBridge.
I does not work. I really can not figure out how to use GMFBridge or it does not work.
Note: Here is what i do with GMFBridge
In order to use , i divide my graph into two pieces:
FirstPart ==> SourceFilter---> GDCL MPEG 4 Mux Filter--> BridgeSinkFilter
and
SecondPart ==> BridgeSourceFilter ---> FileWriter
My Program Pseudo Code
IGraphBuilder firstPartGraph = (IGraphBuilder) new FilterGraph();
IGraphBuilder secondPartGraph = (IGraphBuilder) new FilterGraph();
IBaseFilter bridgeSinkFilter;
IBaseFilter bridgeSourceFilter;
IBaseFilter sourceFilter;
IBaseFilter muxerFilter;
IBaseFilter fileWriterFilter;
// Create bridge controller and init
IGMFBridgeController bridge = (IGMFBridgeController)new GMFBridgeController();
bridge.AddStream(true,eFormatType.MuxInputs, true);
// Then insert Sink filter
bridge.InsertSinkFilter(firstPartGraph, bridgeSinkFilter);
// Configure first part filters
firstPartGraph.AddFilter(sourceFilter);
firstPartGraph.AddFilter(muxerFilter);
firstPartGraph.AddFilter(bridgeSinkFilter); // Have to add this??
ConnectFilters(firstPartGraph,sourceFilter,muxerFilter);
ConnectFilters(firstPartGraph,muxerFilter,bridgeSinkFilter);
// Now add bridge sourceFilter
bridge.InsertSourceFilter(bridgeSinkFilter,secondPartGraph,bridgeSourceFilter);
// Then configure second part graph
secondPartGraph.AddFilter(bridgeSourceFilter); // Have to add this??
secondPartGraph.AddFilter(fileWriterFilter);
ConnectFilters(secondPartGraph,bridgeSourceFilter,fileWriterFilter);
// Now bridge two graphs
bridge.BridgeGraphs(bridgeSinkFilter,fileWriterFilter,bridgeSourceFilter);
// Execute both graphs
IMediaControl mediaControlForPartOne = (IMediaControl)firstPartGraph;
mediaControlForPartOne->Run();
IMediaControl mediaControlForPartSecond = (IMediaControl)secondPartGraph;
mediaControlForPartSecond->Run();
Now how to stop the second graph part and set new file name and then reconnect graphs using bridge?
FIX IT:
Thanks.
I just change my grapg divison and Now work:
FirstPart ==> SourceFilter--> BridgeSinkFilter
SecondPart ==> BridgeSourceFilter ---> GDCL MPEG 4 Mux Filter---> FileWriter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将多路复用器和第二张图中的文件编写器。这有两个原因。首先,mux 和文件编写器之间的流量包括自定义接口,而不仅仅是标准 IMemInputPin 协议(以允许在图形停止后完成标头),其次,您要停止的是 mux 以关闭文件,而不是文件编写者。
因此,在第一个图中使用 source,在第二个图中使用 mux=>file writer,应该没问题。
G
You need to place the mux & file writer in the second graph. There are two reasons for this. Firstly, the traffic between mux and file writer includes custom interfaces, not just standard IMemInputPin protocols (to permit finalisation of headers after the graph has stopped) and secondly, it is the mux that you want to stop in order to close the file, not the file writer.
So, source in the first graph, and mux=>file writer in the second graph and you should be ok.
G
如果两个图表都工作,并且在第二个图表中获得正确的输出;您可以断开图表:
现在您可以停止第二个图表,将其删除并创建一个新图表。启动新图表,并再次连接它们:
If you have both graphs working, and getting correct output in the second graph; you can disconnect the graphs:
Now you can stop the second graph, delete it and create a new one. Start the new graph, and connect them again: