pOutPin = GetOutPin( pGrabBaseAudio, 0 );
hr = m_pGraph->Render( pOutPin );
if( FAILED( hr ) )
{
OutputDebugString( "Could not render sample grabber output pin" );
return FALSE;
}
// ask for the connection media type so we know how big
// it is, so we can write out bitmaps
//
m_pGrabberAudio->SetOneShot( FALSE );
m_pGrabberAudio->SetCallback(m_pGrabCBAudio, 1 );
hr = m_pGrabberAudio->SetMediaType( &AudioType ); // shouldn't fail
if( FAILED( hr ) )
{
OutputDebugString( "Could not set media type audio" );
return FALSE;
}
// add the grabber to the graph
// Create the System Device Enumerator.
HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
reinterpret_cast<void**>(&pDevEnum));
if (SUCCEEDED(hr))
{
// Create an enumerator for the video capture category.
hr = pDevEnum->CreateClassEnumerator(
clsidFilterClass,
&pEnum, 0);
if (FAILED(hr))
pDevEnum->Release();
}
else
return;
IMoniker *pMoniker = NULL;
while (pEnum->Next(1, &pMoniker, NULL) == S_OK)
{
IPropertyBag *pPropBag;
hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag,
(void**)(&pPropBag));
if (FAILED(hr))
{
pMoniker->Release();
continue; // Skip this one, maybe the next one will work.
}