GMFBridge在DirectShow中的用法 [英] GMFBridge usage in DirectShow

查看:72
本文介绍了GMFBridge在DirectShow中的用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此处输入代码我必须停止并动态启动视频渲染器过滤器。如果不创建新图形,则使用常规 Direct Show Architecture是不可能的。



但是我不知道如何使用它。(是的,我在 http://www.gdcl.co.uk/gmfbridge/index.htm



我的图表是:

  SourceFilter ---> MyCustomTransformFilter --->视频Rendrer过滤器

那么GMFBridge适合放在哪里?

  i)我可以将图表分为两块
[Source Filter + MyCustomFilter] + Video Rendere


ii)然后,如何使用GMFBridge将过滤器添加到图形中,并停止启动Video Rendrere,而没有
影响我的其余图形?

更新:



感谢Wimmel



我只是感到困惑...让我清楚我的理解



i)我在首先

 (SingleGraph)SourceFilter ---> MyCustomTransformFilter --->视频Rendrer过滤器

ii)为了使用GMFBridge,我将我的单个图分成两个单独的图图

 第一张图:SourceFilter ---> MyCustomTransformFilter-> GMFBridgeSinkFilter 
第二个图表:GMFBridgeSourceFilter --->视频渲染器过滤器

嗯,GMFBridgeSinkFilter和GMFBridgeSourceFilter吗?这些是什么?



iii)然后我创建一个IGMFBridgeControllerPtr实例并进行必要的初始化...

  IGMFBridgeControllerPtr bridgeController = ...... 

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

iv)桥控制器将宿过滤器添加到源图中并连接它:

  bridgeController-> InsertSinkFilter(sourceGraph,sourceGraphSinkFilter); 

什么是sourceGraph,sourceGraphSinkFilter?

  //现在像这样连接它:
// SourceFilter ---> MyCustomTransformFilter ---> SourceGraphSinkFilter

您是说以编程方式将这些过滤器连接到源图中?

iv)在第二张图中,让控制器添加源过滤器,并将其连接到渲染器:

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

再说一下接收器,renderGraphSourceFilter等是什么?

  //现在像这样连接它:
// RenderGraphSourceFilter --->视频渲染器过滤器

您是说要在源图中以编程方式连接这些过滤器?

解决方案

您可能要创建以下两个图形:

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

2:GMFBridgeSourceFilter --->视频渲染器过滤器

基本上,您可以执行以下操作:



创建并配置GMFBridgeController,例如一个视频和一个音频流:

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

现在,让控制器向源图添加一个接收器过滤器并将其连接:

  hr = m_pController-> InsertSinkFilter(m_pSourceGraph,& m_pSourceGraphSinkFilter); 
//现在像这样连接它:
// SourceFilter ---> MyCustomTransformFilter ---> SourceGraphSinkFilter

在第二张图中,让控制器添加源过滤器,并将其连接到渲染器:

  hr = m_pController-> InsertSourceFilter(m_pSourceGraphSinkFilter,m_pRenderGraph,& m_pRenderGraphSourceFilter); 
//现在像这样连接它:
// RenderGraphSourceFilter --->视频渲染器过滤器

启动两个图形并连接它们:

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

如果要停止一个图形,请先断开连接:

  m_pController-> BridgeGraphs(NULL,NULL); 

编辑



以下是您要求的一些澄清:



GMFBridgeSinkFilter和GMFBridgeSourceFilter是GMFBridge创建的过滤器。我不知道它们的确切类型,但至少它们是从IBaseFilter派生的。



m_pSourceGraph和m_pRenderGraph是您创建的两个图形的IGraphBuilder接口。



m_pSourceGraphSinkFilter和m_pRenderGraphSourceFilter是指向IBaseFilter的指针,以接收指向GMFBridge创建的过滤器的指针。



是的,当我说连接过滤器,是指以编程方式连接它们。据我所知,您无法在graphedit中测试GMFBridge。


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?

解决方案

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.

这篇关于GMFBridge在DirectShow中的用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆