简体   繁体   中英

ActiveX HWND, DirectX WindowLess mode

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.

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!

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 =]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM