Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
75 views
in Technique[技术] by (71.8m points)

directshow.net - GMFBridge usage in DirectShow

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...