Tobze
Guest
|
Posted:
Wed Nov 03, 2004 8:32 pm Post subject:
WMEncoder SDK - How to use SetCaptureParent for the PrePrevi |
|
|
Hi everybody,
anybody experience with WMEncoder SDK 9 in C++?
I've got problems with the PrePreview Interface. I'cant show a stream
from an external device on my Dialog.
Hope somebody can help me!!!!
Thanks
Here's my code so far:
//////
// Initialize WMEncoder
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMEncoder,
NULL,
CLSCTX_INPROC_SERVER,
IID_IWMEncoder2,
(void**) &pEncoder);
// Retrieve the source group collection.
hr = pEncoder->get_SourceGroupCollection(&pSrcGrpColl);
// Add a source group to the collection.
hr = pSrcGrpColl->Add(CComBSTR("SG_1"), &pSrcGrp);
hr = pSrcGrp->QueryInterface(IID_IWMEncSourceGroup2,
(void**)&pSrcGrp2);
//Add a video and audio source to the source group.
hr = pSrcGrp->AddSource(WMENC_VIDEO, &pSrcVid);
// Add the device as the audio source and video source.
hr = pSrcVid->SetInput(CComBSTR("Device://Microsoft DV-Kamera und
Videorekorder"));
// Initialize the encoding session.
hr = pEncoder->PrepareToEncode(VARIANT_TRUE);
//////
//Creating the PrePreview-Window
HWND m_hWnd;
long stream;
CWnd *pWindow;
pWindow = new CWnd;
pWindow->Create(_T("STATIC"),"PrePreview",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP,
CRect(122,38,362,218),this,1234);
m_Wnd = pWindow->GetSafeHwnd();
hr = pSrcVid->GetSourcePlugin((IUnknown**)&pPrePreview)
hr = pPrePreview->SetCaptureParent((long)m_hWnd);
///End
|
|