2

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?

wimh
  • 15,072
  • 6
  • 47
  • 98
setiGuy
  • 121
  • 1
  • 3
  • 8

1 Answers1

3

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.

wimh
  • 15,072
  • 6
  • 47
  • 98
  • Thanks Wimmel. I just confused with the variables u used.I make my points at Update part of my guestions. – setiGuy May 23 '11 at 12:59
  • @setiGuy I have added some clarification. – wimh May 23 '11 at 16:54
  • Thnask for clarification... Just one more question...To connect RenderGraphSourceFilter and SourceGraphSinkFilter to my other filters i should know their pin names... What are their pin names? Or any other smart way to connect them programtically? @Wimmel – setiGuy May 24 '11 at 07:12
  • @setiGuy, there are different ways to connect those filters, I never use the pin name. See for example http://msdn.microsoft.com/en-us/library/dd387915(v=vs.85).aspx, but you can also use "Render". But as this is a different topic, please ask a new quesion if it is not clear yet. – wimh May 24 '11 at 09:11
  • Ok. Thanks for your brief answer.Best Wishes – setiGuy May 24 '11 at 10:03