GMFBridge with GMF GDCL MPEG 4 Mux Filter

人走茶凉 提交于 2019-12-11 04:09:38

问题


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 

回答1:


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);



回答2:


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



来源:https://stackoverflow.com/questions/6177961/gmfbridge-with-gmf-gdcl-mpeg-4-mux-filter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!