mangar
23rd January 2010, 01:13
Hi all,
I'm taking my first shot at directshow development.
As an "hello world", I'm trying to connect the ezrgb24 sample to the amcap sample in microsoft sdk v7.0.
I've managed to get them to compile (which took some time.. :) ),
Now I'm trying to connect the transform filter before the final output.
Questions (I've googled around, a concrete answer would be much appreciated).
1. Why does following code snippet fails?
2. how to I pass parameters (like effect type) to the filter?
Code (I've removed the various checks and fallbacks, for clarity):
Added to BuildPreviewGraph()
hr = gcap.pBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Interleaved, gcap.pVCap, NULL, NULL); //output
HRESULT hr = CoCreateInstance(CLSID_EZrgb24, 0, CLSCTX_INPROC_SERVER, IID_IBaseFilter, reinterpret_cast<void**>(&pF)); //create the filter
hr = gcap.pFg->AddFilter(pF, pFName);
hr = gcap.pBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, NULL, pF, gcap.pVCap); //attach the filter before the render stream, fails with E_POINTER error
hr = gcap.pBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, gcap.pVCap, NULL, NULL); //
I'm taking my first shot at directshow development.
As an "hello world", I'm trying to connect the ezrgb24 sample to the amcap sample in microsoft sdk v7.0.
I've managed to get them to compile (which took some time.. :) ),
Now I'm trying to connect the transform filter before the final output.
Questions (I've googled around, a concrete answer would be much appreciated).
1. Why does following code snippet fails?
2. how to I pass parameters (like effect type) to the filter?
Code (I've removed the various checks and fallbacks, for clarity):
Added to BuildPreviewGraph()
hr = gcap.pBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Interleaved, gcap.pVCap, NULL, NULL); //output
HRESULT hr = CoCreateInstance(CLSID_EZrgb24, 0, CLSCTX_INPROC_SERVER, IID_IBaseFilter, reinterpret_cast<void**>(&pF)); //create the filter
hr = gcap.pFg->AddFilter(pF, pFName);
hr = gcap.pBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, NULL, pF, gcap.pVCap); //attach the filter before the render stream, fails with E_POINTER error
hr = gcap.pBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, gcap.pVCap, NULL, NULL); //