get out of windowless mode
- From: "cosminb" <cosminb@xxxxxxxxx>
- Date: 17 Mar 2006 07:33:36 -0800
I have created a class to handle my webcams in C++/CLI (I further use
C# code for the application). I am trying to use an attach/detach
approach, meaning you can attach the preview video of a webcam to a
window, and after detach it.
So, in the constructor I am creating the main interfaces, in the attach
method I am setting the windowless mode and the window that receives
the video, then call Render Stream and Run. The detach method doesn't
do much, just releases few interfaces. I want to know what is the
proper way to 'detach' the preview video from the window. Logically, it
should bring my object into the state it was before the attach was
performed.
Here's the code for my attach method:
// get the vmr filter config interface
IVMRFilterConfig9* pConfig = NULL;
hr = _pVmrFilter->QueryInterface(IID_IVMRFilterConfig9, (void**)
&pConfig);
_pConfig = pConfig;
TREATCODE(hr);
// set the rendering mode to windowless
hr = _pConfig->SetRenderingMode(VMRMode_Windowless);
TREATCODE(hr);
// interface for vmr windowless previewing
IVMRWindowlessControl9* pVMRwc9 = NULL;
hr = _pVmrFilter->QueryInterface(IID_IVMRWindowlessControl9, (void **)
&pVMRwc9);
_pVMRwc9 = pVMRwc9;
TREATCODE(hr);
// set the display control window
hr = _pVMRwc9->SetVideoClippingWindow((HWND)display->Handle.ToInt32());
TREATCODE(hr);
// ask the capture builder to link the filters
hr = _pCapture->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video,
_pSrcFilter, _pColor, _pVmrFilter);
TREATCODE(hr);
// set the output window size
RECT r;
r.left = 0;
r.top = 0;
r.right = display->Width;
r.bottom = display->Height;
hr = _pVMRwc9->SetVideoPosition(NULL, &r);
TREATCODE(hr);
// get the media control interface
IMediaControl* pMC = NULL;
hr = _pGraph->QueryInterface(IID_IMediaControl, (void **) &pMC);
_pMC = pMC;
TREATCODE(hr);
// start previewing
hr = _pMC->Run();
TREATCODE(hr);
How do I undo these actions?
.
- Follow-Ups:
- Re: get out of windowless mode
- From: The March Hare [MVP]
- Re: get out of windowless mode
- Prev by Date: Re: Connection Points
- Next by Date: Re: Connection Points
- Previous by thread: how to make sure about buffer alignment in transform filter
- Next by thread: Re: get out of windowless mode
- Index(es):
Relevant Pages
|