带有 GMF GDCL MPEG 4 Mux 滤波器的 GMFBridge

发布于 2024-11-10 15:26:53 字数 2409 浏览 1 评论 0原文

我尝试将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

呢古 2024-11-17 15:26:53

您需要将多路复用器和第二张图中的文件编写器。这有两个原因。首先,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

情魔剑神 2024-11-17 15:26:53

如果两个图表都工作,并且在第二个图表中获得正确的输出;您可以断开图表:

BridgeGraphs(NULL, NULL);

现在您可以停止第二个图表,将其删除并创建一个新图表。启动新图表,并再次连接它们:

BridgeGraphs(bridgeSinkFilter, newBridgeSourceFilter);

If you have both graphs working, and getting correct output in the second graph; you can disconnect the graphs:

BridgeGraphs(NULL, NULL);

Now you can stop the second graph, delete it and create a new one. Start the new graph, and connect them again:

BridgeGraphs(bridgeSinkFilter, newBridgeSourceFilter);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文