We are developing a software in which we preview and record an input video source captured from a video-capture card. The preview is implemented with DirectShow and the recording with Media Foundation (it´s an old software slowly upgrading to MediaFoundation)
The problem is with MediaFoundation: it seems to find correctly the video-capture card at our release machine, but not the "screen-capture" video emulator that we use at the testing machines. At the other hand, the DirectShow code finds correctly both, the video-capture device and the screen-capture device emulator.
So, why can´t MediaFoundation find the emulator driver?
Note: The emulator is made in DirectShow... It is VHScrCap
Here is the MediaFoundation code:
HRESULT DeviceList::EnumerateVideoDevices(){
HRESULT hr = S_OK;
IMFAttributes *pAttributes = NULL;
ClearVideo();
// Initialize an attribute store. We will use this to
// specify the enumeration parameters.
hr = MFCreateAttributes(&pAttributes, 1);
// Ask for source type = video capture devices
if (SUCCEEDED(hr))
{
hr = pAttributes->SetGUID(
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID
);
}
// Enumerate devices.
if (SUCCEEDED(hr))
{
hr = MFEnumDeviceSources(pAttributes, &m_ppVideoDevices, &m_cVideoDevices);
}
SafeRelease(&pAttributes);
return hr;
}
At hr = MFEnumDeviceSources(pAttributes, &m_ppVideoDevices, &m_cVideoDevices);
no devices are found.
Thanks!
Media Foundation is not supposed to pick so called "virtual" DirectShow video sources. DirectShow offers video sources through the Video Input category, which includes filters backed by WDM driver devices and then any other filters registered into this category. Media Foundation has its own adapter to expose WDM capture devices, but DirectShow filters are invisible there. Basically you want a separate emulator for Media Foundation.
From MSDN: