ActiveX HWND、DirectX WindowLess 模式

发布于 2024-09-26 01:25:38 字数 327 浏览 9 评论 0原文

我想在 ActiveX 控件中渲染视频(而不是在弹出的 DirectShow 窗口中)。我有:

IID_IVMRWindowlessControl
IID_IVMRFilterConfig9
CLSID_VideoMixingRenderer9

我想设置 WindowLess 模式,但我不知道如何获取...的 HWND,确切地说,是什么? IEFrame、HTML 元素?

hr = pWc->SetVideoClippingWindow(???); 

有人有什么提示吗?

问候。

I would like to render video in ActiveX control (not in pop-up DirectShow window). I have:

IID_IVMRWindowlessControl
IID_IVMRFilterConfig9
CLSID_VideoMixingRenderer9

I would like to set WindowLess mode, but I don't know how to get HWND of..., exactly, of what? IEFrame, HTML element?

hr = pWc->SetVideoClippingWindow(???); 

Anyone with some hint?

Regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帥小哥 2024-10-03 01:25:38

首先,将其添加到 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 的文档很少,这很遗憾,因为它是一项出色的技术。无论如何,希望这有帮助!

First of all, add this to the constructor of your ActiveX control:

// 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;

Your ActiveX control will have a member variable called m_hWnd that you'll be able to use as a render target. without the m_bWindowOnly variable set true, the ActiveX control won't create its own window.

Finally, pick your renderer (VMR9 for example)

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();

Please note that my graph object is a custom object and that GetVideoRenderer() is one of my own functions - it returns an IBaseFilter*.

It took me ages to find this one out. ATL is poorly documented, which is a shame, because it's an excellent technology. Anyways, hope this helps!

流年已逝 2024-10-03 01:25:38

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。如果您找到更多详细信息,请在此处发布摘要=]

freefallr's info is extremely helpful, but I don't think it answers your question completely. The trick with windowless activex controls is that you don't get a window. When you draw you'll just basically get a device context and you have to respond to call from the browser and only draw when it tells you to.

The interfaces required are here: http://msdn.microsoft.com/en-us/library/ms682300%28v=VS.85%29.aspx

more info here: http://msdn.microsoft.com/en-us/library/aa751970%28VS.85%29.aspx#OC96_and_Windowless_

We've been meaning to add support for this in FireBreath (http://firebreath.org) for awhile; we have support for it in all npapi browsers, but looks like we don't (yet) support IE. If you find more details, post a summary here =]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文