GMFBridge usage in DirectShow

一笑奈何 提交于 2019-11-27 07:16:52

问题


enter code hereI have to stop and start Video Renderer Filter dynamically . That is not possible with "normal" Direct Show Architecture without creating new graph. But with GMFBridge it seems it is possible.

But i can not figure out how to use it.( yes i read the paper at http://www.gdcl.co.uk/gmfbridge/index.htm )

My Graph is:

SourceFilter ---> MyCustomTransformFilter ---> Video Rendrer Filter

So GMFBridge fits where?

i) I can devide my graph two pieces 
       [ Source Filter + MyCustomFilter ] + Video Rendere


ii) Then how to add my filters to graph, and stop start Video Rendrere without 
affecting the rest of my grapg using GMFBridge?

Update:

Thanks Wimmel

I just confused... Let me clear what i understand

i) I have single graph at first

 (SingleGraph) SourceFilter ---> MyCustomTransformFilter ---> Video Rendrer Filter

ii) In order to use GMFBridge i divede my single graph into two separate graph

 First Graph  :  SourceFilter ---> MyCustomTransformFilter --> GMFBridgeSinkFilter
 Second Graph :  GMFBridgeSourceFilter ---> Video Renderer Filter

Well, GMFBridgeSinkFilter and GMFBridgeSourceFilter ? what are they? their class type?

iii) Then i create an intance of IGMFBridgeControllerPtr and make necessary init...

IGMFBridgeControllerPtr bridgeController = ......

.....
bridgeController->AddStream(true, eUncompressed, true); 
bridgeController->AddStream(false, eUncompressed, true); 

iv) Bridge Controller add a sink filter to the source graph and connect it:

 bridgeController->InsertSinkFilter(sourceGraph, sourceGraphSinkFilter);

What are sourceGraph, sourceGraphSinkFilter s ?

// now connect it like this:
// SourceFilter ---> MyCustomTransformFilter ---> SourceGraphSinkFilter

You mean programtically connect those filters in the source graph?

iv) In the second graph let the controller add a source filter, and connect it to the renderer:

bridgeController->InsertSourceFilter(sinkFilter, renderGraph, renderGraphSourceFilter);

Again what are sinkFilter,renderGraphSourceFilter etc?

 // now connect it like this:
 // RenderGraphSourceFilter ---> Video Renderer Filter

And You mean programtically connect those filters in the source graph?


回答1:


You probably want to create the following two graphs:

1: SourceFilter ---> MyCustomTransformFilter ---> GMFBridgeSinkFilter

2: GMFBridgeSourceFilter ---> Video Renderer Filter

Basically you do the following:

Create a GMFBridgeController and configure it, for example one video and one audio stream:

IGMFBridgeControllerPtr  m_pController; 
HRESULT hr = m_pController.CreateInstance(__uuidof(GMFBridgeController)); 
m_pController->AddStream(true, eUncompressed, true); 
m_pController->AddStream(false, eUncompressed, true); 

Now let the controller add a sink filter to the source graph and connect it:

hr = m_pController->InsertSinkFilter(m_pSourceGraph, &m_pSourceGraphSinkFilter);
// now connect it like this:
// SourceFilter ---> MyCustomTransformFilter ---> SourceGraphSinkFilter

In your second graph let the controller add a source filter, and connect it to the renderer:

hr = m_pController->InsertSourceFilter(m_pSourceGraphSinkFilter, m_pRenderGraph, &m_pRenderGraphSourceFilter); 
// now connect it like this:
// RenderGraphSourceFilter ---> Video Renderer Filter

Start both graphs and connect them:

hr = m_pController->BridgeGraphs(m_pSourceGraphSinkFilter, m_pRenderGraphSourceFilter); 

If you want to stop one graph, first disconnect:

m_pController->BridgeGraphs(NULL, NULL);

edit

Here are some clarifications you asked for:

GMFBridgeSinkFilter and GMFBridgeSourceFilter are the filters created by GMFBridge. I don't know their exact types, but at least they derive from IBaseFilter.

m_pSourceGraph and m_pRenderGraph are the IGraphBuilder interfaces of both graphs you have created.

m_pSourceGraphSinkFilter and m_pRenderGraphSourceFilter are pointers to IBaseFilter to receive the pointer to the filter created by GMFBridge.

And yes, when I say connect filters, I mean programtically connect them. As far as I know you cannot test GMFBridge in graphedit.



来源:https://stackoverflow.com/questions/6095452/gmfbridge-usage-in-directshow

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