PDA

View Full Version : DFG/SV1 - DirectX compatibility problems



ivec
May 12, 2005, 20:35:31
I have just replaced my previous DirectX(DirectShow)-combatible analog capture board with the DFG/SV1.

The code worked ok without change (once all drivers were properly installed) except for one thing: when I launch the program from Visual Studio (in the debugger), a standard DirectShow call will exit the process -- it appears to call the exit() C library function or an equivalent.
And this happens only when running under a debugger! - all functions ok when running the same program independently.

Are the libraries/drivers provided for DirectX compatibility somehow crippled?
This does not seem consistent with how the board is advertised.
Is this a bug?

For portability (and historical reasons), I prefer to use the DirectShow API (so I can keep doing tests with a simple webcam, etc).


Code included below, FYI, based on a standard DirectShow sample (provided with the SDK).



//#### may not be the right place to put this ! --ivec20050228
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);


HRESULT hr;

// create a filter graph
//
hr = m_pGraph.CoCreateInstance( CLSID_FilterGraph );
if( !m_pGraph )
{
//THROW1("Could not create filter graph");
return E_FAIL;
}

// get whatever capture device exists
//
CComPtr< IBaseFilter > pCap;
std::string name = getDefaultCapDevice( &pCap );
if( !pCap )
{
m_pGraph.Release();
//THROW1("No video capture device was detected on the system.");
return E_FAIL;
}

ECHO("Found video input device: "<<name);

// add the capture filter to the graph
//
hr = m_pGraph->AddFilter( pCap, L"Cap" );
if( FAILED( hr ) )
{
//Error( TEXT("Could not put capture device in graph"));
return E_FAIL;
}

// build the graph
CComPtr<ICaptureGraphBuilder2> pCGB2;
hr = pCGB2.CoCreateInstance (CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC);
if (FAILED( hr ))
{
//Error(TEXT ("Can't get a ICaptureGraphBuilder2 reference"));
return hr;
}

hr = pCGB2->SetFiltergraph( m_pGraph );
if (FAILED( hr ))
{
//Error(TEXT("SetGraph failed"));
return hr;
}


// If there is a VP pin present on the video device, then put the
// renderer on CLSID_NullRenderer
CComPtr<IPin> pVPPin;
hr = pCGB2->FindPin(
pCap,
PINDIR_OUTPUT,
&PIN_CATEGORY_VIDEOPORT,
NULL,
FALSE,
0,
&pVPPin);


// If there is a VP pin, put the renderer on NULL Renderer
CComPtr<IBaseFilter> pRenderer;
if (S_OK == hr)
{
hr = pRenderer.CoCreateInstance(CLSID_NullRenderer);
if (S_OK != hr)
{
//Error(TEXT("Unable to make a NULL renderer"));
return S_OK;
}
hr = m_pGraph->AddFilter(pRenderer, L"NULL renderer");
if (FAILED (hr))
{
//Error(TEXT("Can't add the filter to graph"));
return hr;
}
}

IBaseFilter* const pIntermediate = NULL; //could be used to plug a FrameGrabber into the pipeline (see StillCap demo)

///### HERE
// the first call below fails with an error code (which is ok)
/// the second one will never return as it calls exit() right away

if( FAILED(hr=pCGB2->RenderStream( &PIN_CATEGORY_PREVIEW, &MEDIATYPE_Interleaved, pCap, pIntermediate, pRenderer ))
&& FAILED(hr=pCGB2->RenderStream( &PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pCap, pIntermediate, pRenderer ))
&& FAILED(hr=pCGB2->RenderStream( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pCap, pIntermediate, pRenderer )) )
{
return hr;
}

Stefan Geissler
May 17, 2005, 13:04:25
Hello,

IC Imaging Control is completely based on DirectShow and is able to work unlimited with the DFG/SV1
WDM driver. There is no non DirectShow specific. I personally am not very experienced with
DirectShow programming, so it is very hard to me, to support it. You may check your project
settings, if you are using Debug Multithreaded DLL in your code generation.

It would be a good idea to create a very small project, that only contains the DirectX stuff you want to use and send it to support@imagingcontrol.com, so perhabs we can find a solution.