我想在ActiveX控件中渲染视频(而不是在弹出的DirectShow窗口中)。我有:
IID_IVMRWindowlessControl
IID_IVMRFilterConfig9
CLSID_VideoMixingRenderer9我想设置WindowLess模式,但我不知道如何获得...,确切地说,是什么的HWND?IEFrame元素?
hr = pWc->SetVideoClippingWindow(???); 有谁能给点提示吗?
致以问候。
发布于 2010-10-13 07:02:26
首先,将以下代码添加到ActiveX控件的构造函数中:
// this seemingly innocent line is _extremely_ important.
// This causes the window for the control to be created
// otherwise, you won't get an hWnd to render to!
m_bWindowOnly = true;您的ActiveX控件将有一个名为m_hWnd的成员变量,您可以将其用作呈现目标。如果不将m_bWindowOnly变量设置为true,ActiveX控件将不会创建自己的窗口。
最后,选择渲染器(例如VMR9)
CRect rcClient;
CComPtr<IBaseFilter> spRenderer;
CComPtr<IVMRWindowlessControl9> spWindowless;
// Get the client window size
::GetClientRect(m_hWnd, rcClient);
// Get the renderer filter
spRenderer.Attach( m_pGraph->GetVideoRenderer() );
if( ! spRenderer )
return E_POINTER;
spWindowless = spRenderer;
if( spWindowless )
{
spWindowless->SetVideoClippingWindow( m_hWnd );
spWindowless->SetVideoPosition(NULL, rcClient);
spWindowless.Release();
}
spRenderer.Detach();请注意,我的图形对象是一个自定义对象,而GetVideoRenderer()是我自己的函数之一-它返回一个IBaseFilter*。
我花了很长时间才弄明白这件事。ATL的文档很少,这令人遗憾,因为它是一项优秀的技术。无论如何,希望这能有所帮助!
发布于 2010-11-06 11:57:17
freefallr的信息非常有用,但我不认为它完全回答了你的问题。使用无窗口activex控件的诀窍是你不会得到一个窗口。当你绘制时,你基本上只会得到一个设备上下文,你必须响应来自浏览器的调用,并且只在它告诉你的时候绘制。
所需的接口如下:http://msdn.microsoft.com/en-us/library/ms682300%28v=VS.85%29.aspx
更多信息请点击此处:http://msdn.microsoft.com/en-us/library/aa751970%28VS.85%29.aspx#OC96_and_Windowless_
我们打算在FireBreath (http://firebreath.org)中添加对它的支持已经有一段时间了;我们在所有的npapi浏览器中都支持它,但看起来(还)不支持IE。如果您找到更多详细信息,请在此处发布摘要=]
https://stackoverflow.com/questions/3865663
复制相似问题