J.P. de Ruiter
2006-04-27 09:39:02 UTC
Hello,
I have a problem connecting a Video Mixing Renderer 9.
I use the following code:
int ConnectPreviewFilter(IGraphBuilder *pGraph, IPin *pPreviewPin, HWND
hPreviewWindow)
{
char out[40];
HRESULT hr;
RECT rc;
IBaseFilter *pColorSpaceFilter;
pColorSpaceFilter=NULL;
hr=CoCreateInstance(CLSID_Colour,NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void **)&pColorSpaceFilter);
if(FAILED(hr))
{
sprintf(out,"Create pColorSpaceFilter failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
hr=pGraph->AddFilter(pColorSpaceFilter,L"ColorSpace Converter");
if(FAILED(hr))
{
sprintf(out,"AddFilter pColorSpaceFilter failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
hr=CoCreateInstance(CLSID_VideoMixingRenderer9,NULL,CLSCTX_INPROC,IID_IBaseFilter,(void**)&pVideoMixFilter);
if(SUCCEEDED(hr))
{
hr=pGraph->AddFilter(pVideoMixFilter,L"Video Mixing Filter");
if(SUCCEEDED(hr))
{
IVMRFilterConfig9 *pVMRConfig;
pVMRConfig=NULL;
pVideoMixFilter->QueryInterface(IID_IVMRFilterConfig9,(void**)&pVMRConfig);
pVMRConfig->SetRenderingMode(VMR9Mode_Windowless);
pVMRConfig->SetNumberOfStreams(1);
SAFE_RELEASE(pVMRConfig);
pVideoMixFilter->QueryInterface(IID_IVMRWindowlessControl9,(void**)&pVMRControl);
hr=pVMRControl->SetVideoClippingWindow(hPreviewWindow);
if(FAILED(hr))AfxMessageBox("SetVideoClippingWindow failed");
}
else
{
sprintf(out,"AddFilter pVideoMixFilter failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
}
else
{
sprintf(out,"Create pVideoMixFilter failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
SaveGraphFile(pGraph,L"C:\\temp2.grf");
hr=pGraph->Connect(pPreviewPin,GetPin(pVideoMixFilter,PINDIR_INPUT));
if(FAILED(hr))
{
sprintf(out,"ConnectDirect pColorSpaceFilter and pVideoMixFilter
failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
SaveGraphFile(pGraph,L"C:\\temp3.grf");
GetClientRect(hPreviewWindow, &rc);
hr=pVMRControl->SetVideoPosition(NULL, &rc);
if(FAILED(hr))AfxMessageBox("pVMRControl->SetVideoPosition failed");
return 0;
}
The function creates a Videomixingrendererfilter and connects it with a
supplied pin (Smart tee preview pin).
On my development computer with DXSDK installed all works fine.
But on another computer with only installed DirectX 9 (Apr 2006) the error
0x80040217 occures, which meanes it cannot connect.
When I look at both created .grf files, temp2.grf is opened corectly and all
filters and connections are ok (Except ofcourse the connection between the
previewpin and the renderer filter).
And I can connect the smart tee filter and the renderer filter manually in
GraphEdit as well.
But when I try to open temp3.grf graphedit says it cannot open the file.
And when I open the file in Notepad, the first part is ok, until "R o o t
E n t r y".
But after that the file is filled with spaces.
Anyone an ide what's the problem.
I'm now going to install DXSDK on the other computer, but that can't be the
real solution.
Thanks in advance,
Jan Pieter de Ruiter
Nucletron B.V.
Netherlands
I have a problem connecting a Video Mixing Renderer 9.
I use the following code:
int ConnectPreviewFilter(IGraphBuilder *pGraph, IPin *pPreviewPin, HWND
hPreviewWindow)
{
char out[40];
HRESULT hr;
RECT rc;
IBaseFilter *pColorSpaceFilter;
pColorSpaceFilter=NULL;
hr=CoCreateInstance(CLSID_Colour,NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void **)&pColorSpaceFilter);
if(FAILED(hr))
{
sprintf(out,"Create pColorSpaceFilter failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
hr=pGraph->AddFilter(pColorSpaceFilter,L"ColorSpace Converter");
if(FAILED(hr))
{
sprintf(out,"AddFilter pColorSpaceFilter failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
hr=CoCreateInstance(CLSID_VideoMixingRenderer9,NULL,CLSCTX_INPROC,IID_IBaseFilter,(void**)&pVideoMixFilter);
if(SUCCEEDED(hr))
{
hr=pGraph->AddFilter(pVideoMixFilter,L"Video Mixing Filter");
if(SUCCEEDED(hr))
{
IVMRFilterConfig9 *pVMRConfig;
pVMRConfig=NULL;
pVideoMixFilter->QueryInterface(IID_IVMRFilterConfig9,(void**)&pVMRConfig);
pVMRConfig->SetRenderingMode(VMR9Mode_Windowless);
pVMRConfig->SetNumberOfStreams(1);
SAFE_RELEASE(pVMRConfig);
pVideoMixFilter->QueryInterface(IID_IVMRWindowlessControl9,(void**)&pVMRControl);
hr=pVMRControl->SetVideoClippingWindow(hPreviewWindow);
if(FAILED(hr))AfxMessageBox("SetVideoClippingWindow failed");
}
else
{
sprintf(out,"AddFilter pVideoMixFilter failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
}
else
{
sprintf(out,"Create pVideoMixFilter failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
SaveGraphFile(pGraph,L"C:\\temp2.grf");
hr=pGraph->Connect(pPreviewPin,GetPin(pVideoMixFilter,PINDIR_INPUT));
if(FAILED(hr))
{
sprintf(out,"ConnectDirect pColorSpaceFilter and pVideoMixFilter
failed.\nError: 0x%x",hr);
AfxMessageBox(out);
}
SaveGraphFile(pGraph,L"C:\\temp3.grf");
GetClientRect(hPreviewWindow, &rc);
hr=pVMRControl->SetVideoPosition(NULL, &rc);
if(FAILED(hr))AfxMessageBox("pVMRControl->SetVideoPosition failed");
return 0;
}
The function creates a Videomixingrendererfilter and connects it with a
supplied pin (Smart tee preview pin).
On my development computer with DXSDK installed all works fine.
But on another computer with only installed DirectX 9 (Apr 2006) the error
0x80040217 occures, which meanes it cannot connect.
When I look at both created .grf files, temp2.grf is opened corectly and all
filters and connections are ok (Except ofcourse the connection between the
previewpin and the renderer filter).
And I can connect the smart tee filter and the renderer filter manually in
GraphEdit as well.
But when I try to open temp3.grf graphedit says it cannot open the file.
And when I open the file in Notepad, the first part is ok, until "R o o t
E n t r y".
But after that the file is filled with spaces.
Anyone an ide what's the problem.
I'm now going to install DXSDK on the other computer, but that can't be the
real solution.
Thanks in advance,
Jan Pieter de Ruiter
Nucletron B.V.
Netherlands