- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 GmfBridge 库将源过滤器从 cam 动态更改为文件,反之亦然。所有函数都返回 S_OK(嗯,几乎所有 - pMediaControlOutput->Run() 实际上返回 S_FALSE,但在 msdn 中说这也可以),所以我假设一切正常但数据没有传输到另一个桥的一侧。我使用 GraphStudio 连接到远程图形,一切似乎都正常 - 两个图形中的所有过滤器都按应有的方式连接。但是在播放时我在桥日志文件中收到以下消息:
0: Started 2011-09-10 15:58:38
0: Buffer minimum 100
0: Added stream 1: 畡楤o, Decompressed Only, Discard mode
1: Sink 0x7ae0ca8 has 1 pins
1: Sink filter 0x7ae0cf8 in graph 0x193bf0
2: Source 0x7ae1030 has 1 pins
2: Source filter 0x7ae1080 in graph 0x194c18
14: ReceiveConnection Aware: false
14: Bridging 0x194c18 to 0x193bf0
14: Pin 0x7ae3438 disconnect
25: Source 0x7ae1030 pause from 0
25: Source pin 0x7ae3618 active
2234: Pin 0x7ae3438 receive 0x721ec68
2234: Sink pin 0x7ae3438 disconnected: discarding 0x721ec68
3389: Pin 0x7ae3438 receive 0x721ec68
3389: Sink pin 0x7ae3438 disconnected: discarding 0x721ec68
3940: Pin 0x7ae3438 receive 0x721ec68
3940: Sink pin 0x7ae3438 disconnected: discarding 0x721ec68
4440: Pin 0x7ae3438 receive 0x721ec68
如您所见,尽管 BridgeGraphs() 返回 S_OK 并且媒体样本被丢弃,但左图并未连接到右图。下面是我的代码。我哪里错了?
// Create graphs
HRESULT hr = m_graphInput.CreateInstance(CLSID_FilterGraph);
ATLASSERT( SUCCEEDED( hr ) );
hr = m_graphOutput.CreateInstance(CLSID_FilterGraph);
ATLASSERT( SUCCEEDED( hr ) );
// Get IMediaControl interfaces
hr = m_graphInput.QueryInterface( IID_IMediaControl, (void**)&pMediaControlInput );
ATLASSERT( SUCCEEDED( hr ) );
hr = m_graphOutput.QueryInterface( IID_IMediaControl, (void**)&pMediaControlOutput );
ATLASSERT( SUCCEEDED( hr ) );
// Get builder interfaces
hr = m_graphInput.QueryInterface( IID_IGraphBuilder, (void**)&pBuilderInput );
ATLASSERT( SUCCEEDED( hr ) );
hr = m_graphOutput.QueryInterface( IID_IGraphBuilder, (void**)&pBuilderOutput );
ATLASSERT( SUCCEEDED( hr ) );
// Load source filter (on sink side)
LocateFilter( SOURCE_FILTER_NAME, CLSID_LegacyAmFilterCategory, &inputDevice );
hr = m_graphInput->AddFilter( inputDevice, SOURCE_FILTER_NAME );
ATLASSERT( SUCCEEDED( hr ) );
// Load render filter (on bridge's source side)
LocateFilter( _T( "Default DirectSound Device" ), CLSID_AudioRendererCategory, &audioOutputPreview );
hr = m_graphOutput->AddFilter( audioOutputPreview, _T( "Default DirectSound Device" ) );
ATLASSERT( SUCCEEDED( hr ) );
// Init bridge
bridge.CreateInstance( __uuidof(GMFBridgeController) );
hr = bridge->SetBufferMinimum( 100 );
ATLASSERT( SUCCEEDED( hr ) );
hr = bridge->AddStream( false, eUncompressed, false );
ATLASSERT( SUCCEEDED( hr ) );
// Add sink filter and connect to input graph
IUnknownPtr pSinkFilter;
{
hr = bridge->InsertSinkFilter( m_graphInput, (IUnknown**)&pSinkFilter );
ATLASSERT( SUCCEEDED( hr ) );
// Using own functions get pins
IPin* pInAudio = CPinController::getOutputPin( inputDevice, _T("Audio"));
IPin* pOutAudio = CPinController::getInputPin( pSinkFilter );
hr = pBuilderInput->Connect( pOutAudio, pInAudio );
ATLASSERT( SUCCEEDED( hr ) );
}
// Add output filter and connect to output graph
IUnknownPtr pFeederFilter;
{
hr = bridge->InsertSourceFilter( pSinkFilter, m_graphOutput, &pFeederFilter );
ATLASSERT( SUCCEEDED( hr ) );
// Get pins
IPin* pInAudio = CPinController::getOutputPin( pFeederFilter/*, _T("Audio")*/);
IPin* pOutAudio = CPinController::getInputPin( audioOutputPreview );
hr = pBuilderOutput->Connect( pInAudio, pOutAudio );
ATLASSERT( SUCCEEDED( hr ) );
}
// Run left
hr = pMediaControlInput->Run();
ATLASSERT( SUCCEEDED( hr ) );
// Run right
hr = pMediaControlOutput->Run();
ATLASSERT( SUCCEEDED( hr ) );
hr = bridge->BridgeGraphs( m_graphOutput, m_graphInput );
ATLASSERT( SUCCEEDED( hr ) );
最佳答案
这真的很荒谬,但大约几分钟前,经过一天的搜索,我们找到了答案。所有的交易都是关于 GmfBridge 中的巨大漏洞。我在这里给出了错误的接口(interface)(有图形而不是桥的接收器和源过滤器)'因为函数需要指向 IUnknown 的指针:
hr = bridge->BridgeGraphs( m_graphOutput, m_graphInput );
在 GmfBridge 库中,这种情况没有得到妥善处理——没有“else”brunch 来处理错误,函数返回在 begin 中设置的 hr 到 S_OK:
HRESULT STDMETHODCALLTYPE BridgeGraphs(
/* [in] */ IUnknown *pSourceGraphSinkFilter,
/* [in] */ IUnknown *pRenderGraphSourceFilter)
{
HRESULT hr = S_OK;
...
// if we are not given both filters, then
// we need do nothing
IBridgeSinkPtr pSink = pSourceGraphSinkFilter;
IBridgeSourcePtr pSource = pRenderGraphSourceFilter;
if ((pSink != NULL) && (pSource != NULL))
{
...
}
return hr;
}
如您所见,它只是说没有问题,然后什么也不做!我认为将此错误通知库的作者是个好主意。希望此信息对某人有所帮助。
关于c++ - GmfBridge 不将接收器过滤器与源过滤器连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7372683/
我正在尝试使用 GmfBridge 库将源过滤器从 cam 动态更改为文件,反之亦然。所有函数都返回 S_OK(嗯,几乎所有 - pMediaControlOutput->Run() 实际上返回 S_
enter code here我必须动态停止和启动 Video Renderer Filter。在不创建新图表的情况下,使用“普通”直接展示架构是不可能的。但是使用 GMFBridge 似乎是可能的。
我使用 GMFBridge 将流源视频文件录制成直接文件。就像 DSBoy GMFBridge with GMF GDCL MPEG 4 Mux Filter FirstPart ==> Sourc
我正在尝试使用 GMFBuilder,这样我就可以从网络摄像头预览流并定期保存它,而无需重新启动整个图形。但是我不确定这是否正确,我试图按照示例进行操作,但代码已更新并且情况已发生变化。 我尝试创造:
我是一名优秀的程序员,十分优秀!